diff options
33 files changed, 282 insertions, 39 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 52e1dd9ef3..638af13b7b 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1627,7 +1627,7 @@ Error ViaLite::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin return err; } dl->draw(canvas); - return ""; //check_against_reference(bitmap, src, fSink); + return check_against_reference(bitmap, src, fSink); }); } diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-AndroidOne-GPU-Mali400MP2-Arm7-Release.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-AndroidOne-GPU-Mali400MP2-Arm7-Release.json index ce1ce851f0..d7997dce2a 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-AndroidOne-GPU-Mali400MP2-Arm7-Release.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-AndroidOne-GPU-Mali400MP2-Arm7-Release.json @@ -652,6 +652,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug.json index 0f5964de86..c3d9742984 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug.json @@ -561,6 +561,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Debug.json index 120ab7e420..c80bfba460 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Debug.json @@ -654,6 +654,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus10-GPU-MaliT604-Arm7-Release.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus10-GPU-MaliT604-Arm7-Release.json index c582f49f61..a3a01209b3 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus10-GPU-MaliT604-Arm7-Release.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus10-GPU-MaliT604-Arm7-Release.json @@ -652,6 +652,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Debug.json index 562ed73024..dd3017038c 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Debug.json @@ -653,6 +653,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Debug.json index 3609eb7404..ee62cf9883 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Debug.json @@ -651,6 +651,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus9-CPU-Denver-Arm64-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus9-CPU-Denver-Arm64-Debug.json index c1ea4bbcdc..19f32d99d0 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus9-CPU-Denver-Arm64-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-Nexus9-CPU-Denver-Arm64-Debug.json @@ -652,6 +652,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NexusPlayer-CPU-SSE4-x86-Release.json b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NexusPlayer-CPU-SSE4-x86-Release.json index 2b4e1190a9..60da73b062 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NexusPlayer-CPU-SSE4-x86-Release.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Android-GCC-NexusPlayer-CPU-SSE4-x86-Release.json @@ -648,6 +648,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini4.1-GPU-GeForce320M-x86_64-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini4.1-GPU-GeForce320M-x86_64-Debug.json index 9c6196164e..cfeeea1a60 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini4.1-GPU-GeForce320M-x86_64-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini4.1-GPU-GeForce320M-x86_64-Debug.json @@ -368,6 +368,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Debug.json index 7ba2cc0af3..ddf17ec564 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Debug.json @@ -370,6 +370,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug-CommandBuffer.json b/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug-CommandBuffer.json index ee07ff35c9..208141d575 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug-CommandBuffer.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug-CommandBuffer.json @@ -362,6 +362,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json index 1efe83e1d8..f19e36b261 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot.json @@ -154,6 +154,7 @@ "srgb", "sp-8888", "2ndpic-8888", + "lite-8888", "serialize-8888", "tiles_rt-8888", "pic-8888", @@ -295,6 +296,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug.json index d1966d8c64..c41e64aef0 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug.json @@ -208,6 +208,7 @@ "srgb", "sp-8888", "2ndpic-8888", + "lite-8888", "serialize-8888", "tiles_rt-8888", "pic-8888", @@ -349,6 +350,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN.json b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN.json index 6ad742946e..e36b25fe69 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN.json @@ -90,6 +90,7 @@ "srgb", "sp-8888", "2ndpic-8888", + "lite-8888", "serialize-8888", "tiles_rt-8888", "pic-8888", @@ -231,6 +232,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug.json index 779241e18b..3d42f26d50 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug.json @@ -207,6 +207,7 @@ "srgb", "sp-8888", "2ndpic-8888", + "lite-8888", "serialize-8888", "tiles_rt-8888", "pic-8888", @@ -348,6 +349,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN.json b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN.json index 104bc5d9b7..6fc8f4eb5f 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN.json @@ -90,6 +90,7 @@ "srgb", "sp-8888", "2ndpic-8888", + "lite-8888", "serialize-8888", "tiles_rt-8888", "pic-8888", @@ -231,6 +232,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind.json b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind.json index 08b4347d42..9a8f103495 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind.json @@ -255,6 +255,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", @@ -621,6 +625,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", @@ -988,6 +996,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan.json b/infra/bots/recipes/swarm_test.expected/Test-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan.json index 7d5ffbce0b..be5e6172b1 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan.json @@ -389,6 +389,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release-Trybot.json b/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release-Trybot.json index 222e1c2278..ae673933ee 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release-Trybot.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release-Trybot.json @@ -407,6 +407,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-GPU-GTX960-x86_64-Debug-ANGLE.json b/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-GPU-GTX960-x86_64-Debug-ANGLE.json index bef199b2fe..8c18e2f8b4 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-GPU-GTX960-x86_64-Debug-ANGLE.json +++ b/infra/bots/recipes/swarm_test.expected/Test-Win8-MSVC-ShuttleB-GPU-GTX960-x86_64-Debug-ANGLE.json @@ -402,6 +402,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug.json b/infra/bots/recipes/swarm_test.expected/Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug.json index a3a8d9438a..08dff46352 100644 --- a/infra/bots/recipes/swarm_test.expected/Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug.json +++ b/infra/bots/recipes/swarm_test.expected/Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug.json @@ -619,6 +619,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/adb_in_path.json b/infra/bots/recipes/swarm_test.expected/adb_in_path.json index 0672a5d632..d773c74584 100644 --- a/infra/bots/recipes/swarm_test.expected/adb_in_path.json +++ b/infra/bots/recipes/swarm_test.expected/adb_in_path.json @@ -647,6 +647,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/big_issue_number.json b/infra/bots/recipes/swarm_test.expected/big_issue_number.json index 11589d6896..32abbffed4 100644 --- a/infra/bots/recipes/swarm_test.expected/big_issue_number.json +++ b/infra/bots/recipes/swarm_test.expected/big_issue_number.json @@ -407,6 +407,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/download_and_push_skimage.json b/infra/bots/recipes/swarm_test.expected/download_and_push_skimage.json index 4f6cc0a754..2368ea9458 100644 --- a/infra/bots/recipes/swarm_test.expected/download_and_push_skimage.json +++ b/infra/bots/recipes/swarm_test.expected/download_and_push_skimage.json @@ -749,6 +749,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/download_and_push_skps.json b/infra/bots/recipes/swarm_test.expected/download_and_push_skps.json index 75628b8662..8976e56309 100644 --- a/infra/bots/recipes/swarm_test.expected/download_and_push_skps.json +++ b/infra/bots/recipes/swarm_test.expected/download_and_push_skps.json @@ -749,6 +749,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/failed_dm.json b/infra/bots/recipes/swarm_test.expected/failed_dm.json index 85cb4e4938..4e6c0b4283 100644 --- a/infra/bots/recipes/swarm_test.expected/failed_dm.json +++ b/infra/bots/recipes/swarm_test.expected/failed_dm.json @@ -207,6 +207,7 @@ "srgb", "sp-8888", "2ndpic-8888", + "lite-8888", "serialize-8888", "tiles_rt-8888", "pic-8888", @@ -348,6 +349,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/failed_get_hashes.json b/infra/bots/recipes/swarm_test.expected/failed_get_hashes.json index a369f324e5..8a6b20349d 100644 --- a/infra/bots/recipes/swarm_test.expected/failed_get_hashes.json +++ b/infra/bots/recipes/swarm_test.expected/failed_get_hashes.json @@ -653,6 +653,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/missing_SKP_VERSION_device.json b/infra/bots/recipes/swarm_test.expected/missing_SKP_VERSION_device.json index 14d2baffbf..78196fcf6b 100644 --- a/infra/bots/recipes/swarm_test.expected/missing_SKP_VERSION_device.json +++ b/infra/bots/recipes/swarm_test.expected/missing_SKP_VERSION_device.json @@ -753,6 +753,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.expected/missing_SK_IMAGE_VERSION_device.json b/infra/bots/recipes/swarm_test.expected/missing_SK_IMAGE_VERSION_device.json index 0c7103a0de..df335d07ce 100644 --- a/infra/bots/recipes/swarm_test.expected/missing_SK_IMAGE_VERSION_device.json +++ b/infra/bots/recipes/swarm_test.expected/missing_SK_IMAGE_VERSION_device.json @@ -753,6 +753,10 @@ "gm", "_", "drawfilter", + "lite-8888", + "gm", + "_", + "drawfilter", "sp-8888", "gm", "_", diff --git a/infra/bots/recipes/swarm_test.py b/infra/bots/recipes/swarm_test.py index 5ee343d021..bf574581ec 100644 --- a/infra/bots/recipes/swarm_test.py +++ b/infra/bots/recipes/swarm_test.py @@ -84,6 +84,7 @@ def dm_flags(bot): if '-GCE-' in bot: configs.extend(['f16', 'srgb']) # Gamma-correct formats. configs.extend(['sp-8888', '2ndpic-8888']) # Test niche uses of SkPicture. + configs.extend(['lite-8888']) # Experimental display list. if '-TSAN' not in bot: if ('TegraK1' in bot or @@ -247,6 +248,7 @@ def dm_flags(bot): blacklist.extend([ 'sp-8888', 'gm', '_', test]) blacklist.extend([ 'pic-8888', 'gm', '_', test]) blacklist.extend(['2ndpic-8888', 'gm', '_', test]) + blacklist.extend([ 'lite-8888', 'gm', '_', test]) # skia:4703 for test in ['image-cacherator-from-picture', 'image-cacherator-from-raster', diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp index 77b1704d70..f13255b494 100644 --- a/src/core/SkLiteDL.cpp +++ b/src/core/SkLiteDL.cpp @@ -15,25 +15,24 @@ #include "SkSpinlock.h" #include "SkTextBlob.h" -// TODO: make sure DrawPosText and DrawPosTextH positions are aligned -// (move the text after the positions). - // A stand-in for an optional SkRect which was not set, e.g. bounds for a saveLayer(). static const SkRect kUnset = {SK_ScalarInfinity, 0,0,0}; static const SkRect* maybe_unset(const SkRect& r) { return r.left() == SK_ScalarInfinity ? nullptr : &r; } -// memcpy_v(dst, src,bytes, src,bytes, ...) copies an arbitrary number of srcs into dst. -static void memcpy_v(void* dst) {} +// copy_v(dst, src,n, src,n, ...) copies an arbitrary number of typed srcs into dst. +static void copy_v(void* dst) {} -template <typename... Rest> -static void memcpy_v(void* dst, const void* src, size_t bytes, Rest&&... rest) { - sk_careful_memcpy(dst, src, bytes); - memcpy_v(SkTAddOffset<void>(dst, bytes), std::forward<Rest>(rest)...); +template <typename S, typename... Rest> +static void copy_v(void* dst, const S* src, int n, Rest&&... rest) { + SkASSERTF(((uintptr_t)dst & (alignof(S)-1)) == 0, + "Expected %p to be aligned for at least %zu bytes.", dst, alignof(S)); + sk_careful_memcpy(dst, src, n*sizeof(S)); + copy_v(SkTAddOffset<void>(dst, n*sizeof(S)), std::forward<Rest>(rest)...); } -// Helper for getting back at arrays which have been memcpy_v'd together after an Op. +// Helper for getting back at arrays which have been copy_v'd together after an Op. template <typename D, typename T> static D* pod(T* op, size_t offset = 0) { return SkTAddOffset<D>(op+1, offset); @@ -53,11 +52,18 @@ static void optimize_for(GrContext* ctx, SkPaint* paint, sk_sp<const SkImage>* i } } +// Pre-cache lazy non-threadsafe fields on SkPath and/or SkMatrix. +static void make_threadsafe(SkPath* path, SkMatrix* matrix) { + if (path) { path->updateBoundsCache(); } + if (matrix) { (void)matrix->getType(); } +} + namespace { struct Op { virtual ~Op() {} virtual void draw(SkCanvas*) = 0; virtual void optimizeFor(GrContext*) {} + virtual void makeThreadsafe() {} size_t skip; }; @@ -86,11 +92,13 @@ namespace { Concat(const SkMatrix& matrix) : matrix(matrix) {} SkMatrix matrix; void draw(SkCanvas* c) override { c->concat(matrix); } + void makeThreadsafe() override { make_threadsafe(nullptr, &matrix); } }; struct SetMatrix final : Op { SetMatrix(const SkMatrix& matrix) : matrix(matrix) {} SkMatrix matrix; void draw(SkCanvas* c) override { c->setMatrix(matrix); } + void makeThreadsafe() override { make_threadsafe(nullptr, &matrix); } }; struct TranslateZ final : Op { TranslateZ(SkScalar dz) : dz(dz) {} @@ -108,6 +116,7 @@ namespace { SkRegion::Op op; bool aa; void draw(SkCanvas* c) override { c->clipPath(path, op, aa); } + void makeThreadsafe() override { make_threadsafe(&path, nullptr); } }; struct ClipRect final : Op { ClipRect(const SkRect& rect, SkRegion::Op op, bool aa) : rect(rect), op(op), aa(aa) {} @@ -142,6 +151,7 @@ namespace { SkPaint paint; void draw(SkCanvas* c) override { c->drawPath(path, paint); } void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } + void makeThreadsafe() override { make_threadsafe(&path, nullptr); } }; struct DrawRect final : Op { DrawRect(const SkRect& rect, const SkPaint& paint) : rect(rect), paint(paint) {} @@ -183,21 +193,33 @@ namespace { DrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) : drawable(sk_ref_sp(drawable)) { if (matrix) { this->matrix = *matrix; } } - sk_sp<SkDrawable> drawable; - SkMatrix matrix = SkMatrix::I(); - void draw(SkCanvas* c) override { c->drawDrawable(drawable.get(), &matrix); } + sk_sp<SkDrawable> drawable; + sk_sp<const SkPicture> snapped; + SkMatrix matrix = SkMatrix::I(); + void draw(SkCanvas* c) override { + snapped ? c->drawPicture(snapped.get(), &matrix, nullptr) + : c->drawDrawable(drawable.get(), &matrix); + } + void makeThreadsafe() override { + snapped.reset(drawable->newPictureSnapshot()); + make_threadsafe(nullptr, &matrix); + } }; struct DrawPicture final : Op { DrawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) : picture(sk_ref_sp(picture)) { if (matrix) { this->matrix = *matrix; } - if (paint) { this->paint = *paint; } + if (paint) { this->paint = *paint; has_paint = true; } } sk_sp<const SkPicture> picture; SkMatrix matrix = SkMatrix::I(); SkPaint paint; - void draw(SkCanvas* c) override { c->drawPicture(picture.get(), &matrix, &paint); } + bool has_paint = false; // TODO: why is a default paint not the same? + void draw(SkCanvas* c) override { + c->drawPicture(picture.get(), &matrix, has_paint ? &paint : nullptr); + } void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } + void makeThreadsafe() override { make_threadsafe(nullptr, &matrix); } }; struct DrawShadowedPicture final : Op { DrawShadowedPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) @@ -214,6 +236,7 @@ namespace { #endif } void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } + void makeThreadsafe() override { make_threadsafe(nullptr, &matrix); } }; struct DrawImage final : Op { @@ -284,23 +307,29 @@ namespace { void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } }; struct DrawPosText final : Op { - DrawPosText(size_t bytes, const SkPaint& paint) - : bytes(bytes), paint(paint) {} + DrawPosText(size_t bytes, const SkPaint& paint, int n) + : bytes(bytes), paint(paint), n(n) {} size_t bytes; SkPaint paint; + int n; void draw(SkCanvas* c) override { - c->drawPosText(pod<void>(this), bytes, pod<SkPoint>(this, bytes), paint); + auto points = pod<SkPoint>(this); + auto text = pod<void>(this, n*sizeof(SkPoint)); + c->drawPosText(text, bytes, points, paint); } void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } }; struct DrawPosTextH final : Op { - DrawPosTextH(size_t bytes, SkScalar y, const SkPaint& paint) - : bytes(bytes), y(y), paint(paint) {} + DrawPosTextH(size_t bytes, SkScalar y, const SkPaint& paint, int n) + : bytes(bytes), y(y), paint(paint), n(n) {} size_t bytes; SkScalar y; SkPaint paint; + int n; void draw(SkCanvas* c) override { - c->drawPosTextH(pod<void>(this), bytes, pod<SkScalar>(this, bytes), y, paint); + auto xs = pod<SkScalar>(this); + auto text = pod<void>(this, n*sizeof(SkScalar)); + c->drawPosTextH(text, bytes, xs, y, paint); } void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } }; @@ -318,6 +347,7 @@ namespace { c->drawTextOnPath(pod<void>(this), bytes, path, &matrix, paint); } void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } + void makeThreadsafe() override { make_threadsafe(&path, &matrix); } }; struct DrawTextRSXform final : Op { DrawTextRSXform(size_t bytes, const SkRect* cull, const SkPaint& paint) @@ -343,6 +373,27 @@ namespace { void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } }; + struct DrawPatch final : Op { + DrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texs[4], + SkXfermode* xfermode, const SkPaint& paint) + : xfermode(sk_ref_sp(xfermode)), paint(paint) { + copy_v(this->cubics, cubics, 12); + if (colors) { copy_v(this->colors, colors, 4); has_colors = true; } + if (texs ) { copy_v(this->texs , texs , 4); has_texs = true; } + } + SkPoint cubics[12]; + SkColor colors[4]; + SkPoint texs[4]; + sk_sp<SkXfermode> xfermode; + SkPaint paint; + bool has_colors = false; + bool has_texs = false; + void draw(SkCanvas* c) override { + c->drawPatch(cubics, has_colors ? colors : nullptr, has_texs ? texs : nullptr, + xfermode.get(), paint); + } + void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } + }; struct DrawPoints final : Op { DrawPoints(SkCanvas::PointMode mode, size_t count, const SkPaint& paint) : mode(mode), count(count), paint(paint) {} @@ -352,6 +403,44 @@ namespace { void draw(SkCanvas* c) override { c->drawPoints(mode, count, pod<SkPoint>(this), paint); } void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } }; + struct DrawVertices final : Op { + DrawVertices(SkCanvas::VertexMode mode, int count, SkXfermode* xfermode, int nindices, + const SkPaint& paint, bool has_texs, bool has_colors, bool has_indices) + : mode(mode), count(count), xfermode(sk_ref_sp(xfermode)), nindices(nindices) + , paint(paint), has_texs(has_texs), has_colors(has_colors), has_indices(has_indices) {} + SkCanvas::VertexMode mode; + int count; + sk_sp<SkXfermode> xfermode; + int nindices; + SkPaint paint; + bool has_texs; + bool has_colors; + bool has_indices; + void draw(SkCanvas* c) override { + SkPoint* vertices = pod<SkPoint>(this, 0); + size_t offset = count*sizeof(SkPoint); + + SkPoint* texs = nullptr; + if (has_texs) { + texs = pod<SkPoint>(this, offset); + offset += count*sizeof(SkPoint); + } + + SkColor* colors = nullptr; + if (has_colors) { + colors = pod<SkColor>(this, offset); + offset += count*sizeof(SkColor); + } + + uint16_t* indices = nullptr; + if (has_indices) { + indices = pod<uint16_t>(this, offset); + } + c->drawVertices(mode, count, vertices, texs, colors, xfermode.get(), + indices, nindices, paint); + } + void optimizeFor(GrContext* ctx) override { optimize_for(ctx, &paint); } + }; struct DrawAtlas final : Op { DrawAtlas(const SkImage* atlas, int count, SkXfermode::Mode xfermode, const SkRect* cull, const SkPaint* paint, bool has_colors) @@ -442,7 +531,7 @@ void SkLiteDL::drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPa void SkLiteDL::drawAnnotation(const SkRect& rect, const char* key, SkData* value) { size_t bytes = strlen(key)+1; void* pod = push<DrawAnnotation>(&fBytes, bytes, rect, value); - memcpy_v(pod, key,bytes); + copy_v(pod, key,bytes); } void SkLiteDL::drawDrawable(SkDrawable* drawable, const SkMatrix* matrix) { push<DrawDrawable>(&fBytes, 0, drawable, matrix); @@ -484,46 +573,64 @@ void SkLiteDL::drawImageLattice(const SkImage* image, const SkCanvas::Lattice& l int xs = lattice.fXCount, ys = lattice.fYCount; size_t bytes = (xs + ys) * sizeof(int); void* pod = push<DrawImageLattice>(&fBytes, bytes, sk_ref_sp(image), xs, ys, dst, paint); - memcpy_v(pod, lattice.fXDivs,xs*sizeof(int), - lattice.fYDivs,ys*sizeof(int)); + copy_v(pod, lattice.fXDivs, xs, + lattice.fYDivs, ys); } void SkLiteDL::drawText(const void* text, size_t bytes, SkScalar x, SkScalar y, const SkPaint& paint) { void* pod = push<DrawText>(&fBytes, bytes, bytes, x, y, paint); - memcpy_v(pod, text,bytes); + copy_v(pod, (const char*)text,bytes); } void SkLiteDL::drawPosText(const void* text, size_t bytes, const SkPoint pos[], const SkPaint& paint) { int n = paint.countText(text, bytes); - void* pod = push<DrawPosText>(&fBytes, bytes+n*sizeof(SkPoint), bytes, paint); - memcpy_v(pod, text,bytes, pos,n*sizeof(SkPoint)); + void* pod = push<DrawPosText>(&fBytes, n*sizeof(SkPoint)+bytes, bytes, paint, n); + copy_v(pod, pos,n, (const char*)text,bytes); } void SkLiteDL::drawPosTextH(const void* text, size_t bytes, const SkScalar xs[], SkScalar y, const SkPaint& paint) { int n = paint.countText(text, bytes); - void* pod = push<DrawPosTextH>(&fBytes, bytes+n*sizeof(SkScalar), bytes, y, paint); - memcpy_v(pod, text,bytes, xs,n*sizeof(SkScalar)); + void* pod = push<DrawPosTextH>(&fBytes, n*sizeof(SkScalar)+bytes, bytes, y, paint, n); + copy_v(pod, xs,n, (const char*)text,bytes); } void SkLiteDL::drawTextOnPath(const void* text, size_t bytes, const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) { void* pod = push<DrawTextOnPath>(&fBytes, bytes, bytes, path, matrix, paint); - memcpy_v(pod, text,bytes); + copy_v(pod, (const char*)text,bytes); } void SkLiteDL::drawTextRSXform(const void* text, size_t bytes, const SkRSXform xforms[], const SkRect* cull, const SkPaint& paint) { int n = paint.countText(text, bytes); void* pod = push<DrawTextRSXform>(&fBytes, bytes+n*sizeof(SkRSXform), bytes, cull, paint); - memcpy_v(pod, text,bytes, xforms,n*sizeof(SkRSXform)); + copy_v(pod, (const char*)text,bytes, xforms,n); } void SkLiteDL::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) { push<DrawTextBlob>(&fBytes, 0, blob, x,y, paint); } +void SkLiteDL::drawPatch(const SkPoint points[12], const SkColor colors[4], const SkPoint texs[4], + SkXfermode* xfermode, const SkPaint& paint) { + push<DrawPatch>(&fBytes, 0, points, colors, texs, xfermode, paint); +} void SkLiteDL::drawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint points[], const SkPaint& paint) { void* pod = push<DrawPoints>(&fBytes, count*sizeof(SkPoint), mode, count, paint); - memcpy_v(pod, points,count*sizeof(SkPoint)); + copy_v(pod, points,count); +} +void SkLiteDL::drawVertices(SkCanvas::VertexMode mode, int count, const SkPoint vertices[], + const SkPoint texs[], const SkColor colors[], SkXfermode* xfermode, + const uint16_t indices[], int nindices, const SkPaint& paint) { + size_t bytes = count * sizeof(SkPoint); + if (texs ) { bytes += count * sizeof(SkPoint); } + if (colors) { bytes += count * sizeof(SkColor); } + if (indices) { bytes += nindices * sizeof(uint16_t); } + void* pod = push<DrawVertices>(&fBytes, bytes, mode, count, xfermode, nindices, paint, + texs != nullptr, colors != nullptr, indices != nullptr); + copy_v(pod, vertices, count, + texs, texs ? count : 0, + colors, colors ? count : 0, + indices, indices ? nindices : 0); } void SkLiteDL::drawAtlas(const SkImage* atlas, const SkRSXform xforms[], const SkRect texs[], const SkColor colors[], int count, SkXfermode::Mode xfermode, @@ -534,9 +641,9 @@ void SkLiteDL::drawAtlas(const SkImage* atlas, const SkRSXform xforms[], const S } void* pod = push<DrawAtlas>(&fBytes, bytes, atlas, count, xfermode, cull, paint, colors != nullptr); - memcpy_v(pod, xforms, count*sizeof(SkRSXform), - texs, count*sizeof(SkRect), - colors, colors ? count*sizeof(SkColor) : 0); + copy_v(pod, xforms, count, + texs, count, + colors, colors ? count : 0); } @@ -548,6 +655,10 @@ void SkLiteDL::optimizeFor(GrContext* ctx) { map(&fBytes, [ctx](Op* op) { op->optimizeFor(ctx); }); } +void SkLiteDL::makeThreadsafe() { + map(&fBytes, [](Op* op) { op->makeThreadsafe(); }); +} + SkRect SkLiteDL::onGetBounds() { return fBounds; } diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h index ad9c086af9..132bc376c8 100644 --- a/src/core/SkLiteDL.h +++ b/src/core/SkLiteDL.h @@ -22,6 +22,7 @@ public: static sk_sp<SkLiteDL> New(SkRect); void optimizeFor(GrContext*); + void makeThreadsafe(); void save(); void saveLayer(const SkRect*, const SkPaint*, const SkImageFilter*, SkCanvas::SaveLayerFlags); @@ -36,7 +37,6 @@ public: void clipRRect (const SkRRect&, SkRegion::Op, bool aa); void clipRegion(const SkRegion&, SkRegion::Op); - void drawPaint (const SkPaint&); void drawPath (const SkPath&, const SkPaint&); void drawRect (const SkRect&, const SkPaint&); @@ -68,10 +68,10 @@ public: void drawImageLattice(const SkImage*, const SkCanvas::Lattice&, const SkRect&, const SkPaint*); void drawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], - SkXfermode*, const SkPaint&) {/*TODO*/} + SkXfermode*, const SkPaint&); void drawPoints(SkCanvas::PointMode, size_t, const SkPoint[], const SkPaint&); void drawVertices(SkCanvas::VertexMode, int, const SkPoint[], const SkPoint[], const SkColor[], - SkXfermode*, const uint16_t[], int, const SkPaint&) {/*TODO*/} + SkXfermode*, const uint16_t[], int, const SkPaint&); void drawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, SkXfermode::Mode, const SkRect*, const SkPaint*); |