diff options
author | Florin Malita <fmalita@chromium.org> | 2018-05-25 12:43:51 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-25 17:11:52 +0000 |
commit | 3b526b05d652ad6c310d9c636187b20b51c7648c (patch) | |
tree | 6c6fa99f2e80db81e9c3f593fe5883aabdaa442b | |
parent | 59da548b0c4d4239e0ec1855d3f7f77a2bff4b93 (diff) |
"Modularize" SkSG
* relocate all SkSG-related files under modules/sksg/
* fix various tidbits to make non-sksg builds possible
* drop obsolete SampleSGInval.cpp
Change-Id: I54e6c5bb1a09f45030fa8d607b3eb3f7cba78957
Reviewed-on: https://skia-review.googlesource.com/130025
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
-rw-r--r-- | BUILD.gn | 52 | ||||
-rw-r--r-- | gn/samples.gni | 2 | ||||
-rw-r--r-- | gn/tests.gni | 1 | ||||
-rw-r--r-- | modules/sksg/BUILD.gn | 90 | ||||
-rw-r--r-- | modules/sksg/include/SkSGClipEffect.h (renamed from experimental/sksg/effects/SkSGClipEffect.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGColor.h (renamed from experimental/sksg/paint/SkSGColor.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGDraw.h (renamed from experimental/sksg/SkSGDraw.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGEffectNode.h (renamed from experimental/sksg/SkSGEffectNode.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGGeometryNode.h (renamed from experimental/sksg/SkSGGeometryNode.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGGeometryTransform.h (renamed from experimental/sksg/geometry/SkSGGeometryTransform.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGGradient.h (renamed from experimental/sksg/paint/SkSGGradient.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGGroup.h (renamed from experimental/sksg/SkSGGroup.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGImage.h (renamed from experimental/sksg/SkSGImage.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGInvalidationController.h (renamed from experimental/sksg/SkSGInvalidationController.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGMaskEffect.h (renamed from experimental/sksg/effects/SkSGMaskEffect.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGMerge.h (renamed from experimental/sksg/geometry/SkSGMerge.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGNode.h (renamed from experimental/sksg/SkSGNode.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGOpacityEffect.h (renamed from experimental/sksg/effects/SkSGOpacityEffect.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGPaintNode.h (renamed from experimental/sksg/SkSGPaintNode.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGPath.h (renamed from experimental/sksg/geometry/SkSGPath.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGPlane.h (renamed from experimental/sksg/geometry/SkSGPlane.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGRect.h (renamed from experimental/sksg/geometry/SkSGRect.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGRenderNode.h (renamed from experimental/sksg/SkSGRenderNode.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGRoundEffect.h (renamed from experimental/sksg/geometry/SkSGRoundEffect.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGScene.h (renamed from experimental/sksg/SkSGScene.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGText.h (renamed from experimental/sksg/geometry/SkSGText.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGTransform.h (renamed from experimental/sksg/effects/SkSGTransform.h) | 0 | ||||
-rw-r--r-- | modules/sksg/include/SkSGTrimEffect.h (renamed from experimental/sksg/geometry/SkSGTrimEffect.h) | 0 | ||||
-rw-r--r-- | modules/sksg/samples/SampleSVGPong.cpp (renamed from samplecode/SampleSVGPong.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGClipEffect.cpp (renamed from experimental/sksg/effects/SkSGClipEffect.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGColor.cpp (renamed from experimental/sksg/paint/SkSGColor.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGDraw.cpp (renamed from experimental/sksg/SkSGDraw.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGEffectNode.cpp (renamed from experimental/sksg/SkSGEffectNode.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGGeometryNode.cpp (renamed from experimental/sksg/SkSGGeometryNode.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGGeometryTransform.cpp (renamed from experimental/sksg/geometry/SkSGGeometryTransform.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGGradient.cpp (renamed from experimental/sksg/paint/SkSGGradient.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGGroup.cpp (renamed from experimental/sksg/SkSGGroup.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGImage.cpp (renamed from experimental/sksg/SkSGImage.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGInvalidationController.cpp (renamed from experimental/sksg/SkSGInvalidationController.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGMaskEffect.cpp (renamed from experimental/sksg/effects/SkSGMaskEffect.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGMerge.cpp (renamed from experimental/sksg/geometry/SkSGMerge.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGNode.cpp (renamed from experimental/sksg/SkSGNode.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGOpacityEffect.cpp (renamed from experimental/sksg/effects/SkSGOpacityEffect.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGPaintNode.cpp (renamed from experimental/sksg/SkSGPaintNode.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGPath.cpp (renamed from experimental/sksg/geometry/SkSGPath.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGPlane.cpp (renamed from experimental/sksg/geometry/SkSGPlane.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGRect.cpp (renamed from experimental/sksg/geometry/SkSGRect.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGRenderNode.cpp (renamed from experimental/sksg/SkSGRenderNode.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGRoundEffect.cpp (renamed from experimental/sksg/geometry/SkSGRoundEffect.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGScene.cpp (renamed from experimental/sksg/SkSGScene.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGText.cpp (renamed from experimental/sksg/geometry/SkSGText.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGTransform.cpp (renamed from experimental/sksg/effects/SkSGTransform.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/src/SkSGTrimEffect.cpp (renamed from experimental/sksg/geometry/SkSGTrimEffect.cpp) | 0 | ||||
-rw-r--r-- | modules/sksg/tests/SGTest.cpp (renamed from tests/SGTest.cpp) | 0 | ||||
-rw-r--r-- | samplecode/SampleSGInval.cpp | 94 | ||||
-rw-r--r-- | tools/viewer/SlideDir.cpp | 4 | ||||
-rw-r--r-- | tools/viewer/Viewer.cpp | 8 |
57 files changed, 107 insertions, 144 deletions
@@ -1376,11 +1376,11 @@ if (skia_enable_tools) { public_include_dirs = [ "gm" ] sources = gm_sources deps = [ - ":experimental_sksg", ":flags", ":gpu_tool_utils", ":skia", ":tool_utils", + "modules/sksg", ] } @@ -1392,12 +1392,12 @@ if (skia_enable_tools) { sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ] } deps = [ - ":experimental_sksg", ":experimental_svg_model", ":flags", ":skia", ":third_party_skcms", ":tool_utils", + "modules/sksg:tests", "//third_party/libpng", "//third_party/zlib", ] @@ -1432,8 +1432,8 @@ if (skia_enable_tools) { "experimental/skottie/SkottieValue.cpp", ] deps = [ - ":experimental_sksg", ":skia", + "modules/sksg", "//third_party/rapidjson", ] } @@ -1475,44 +1475,6 @@ if (skia_enable_tools) { } } - test_lib("experimental_sksg") { - public_include_dirs = [ - "experimental/sksg", - "experimental/sksg/effects", - "experimental/sksg/geometry", - "experimental/sksg/paint", - ] - sources = [ - "experimental/sksg/SkSGDraw.cpp", - "experimental/sksg/SkSGEffectNode.cpp", - "experimental/sksg/SkSGGeometryNode.cpp", - "experimental/sksg/SkSGGroup.cpp", - "experimental/sksg/SkSGImage.cpp", - "experimental/sksg/SkSGInvalidationController.cpp", - "experimental/sksg/SkSGNode.cpp", - "experimental/sksg/SkSGPaintNode.cpp", - "experimental/sksg/SkSGRenderNode.cpp", - "experimental/sksg/SkSGScene.cpp", - "experimental/sksg/effects/SkSGClipEffect.cpp", - "experimental/sksg/effects/SkSGMaskEffect.cpp", - "experimental/sksg/effects/SkSGOpacityEffect.cpp", - "experimental/sksg/effects/SkSGTransform.cpp", - "experimental/sksg/geometry/SkSGGeometryTransform.cpp", - "experimental/sksg/geometry/SkSGMerge.cpp", - "experimental/sksg/geometry/SkSGPath.cpp", - "experimental/sksg/geometry/SkSGPlane.cpp", - "experimental/sksg/geometry/SkSGRect.cpp", - "experimental/sksg/geometry/SkSGRoundEffect.cpp", - "experimental/sksg/geometry/SkSGText.cpp", - "experimental/sksg/geometry/SkSGTrimEffect.cpp", - "experimental/sksg/paint/SkSGColor.cpp", - "experimental/sksg/paint/SkSGGradient.cpp", - ] - deps = [ - ":skia", - ] - } - if (target_cpu != "wasm") { test_lib("views") { public_include_dirs = [ "include/views" ] @@ -1591,7 +1553,6 @@ if (skia_enable_tools) { include_dirs = [ "experimental" ] sources = samples_sources deps = [ - ":experimental_sksg", ":experimental_svg_model", ":flags", ":gm", @@ -1599,6 +1560,7 @@ if (skia_enable_tools) { ":tool_utils", ":views", ":xml", + "modules/sksg:samples", ] if (skia_use_lua) { @@ -1620,7 +1582,6 @@ if (skia_enable_tools) { deps = [ ":common_flags", ":experimental_skottie", - ":experimental_sksg", ":experimental_svg_model", ":flags", ":gm", @@ -1629,6 +1590,7 @@ if (skia_enable_tools) { ":tests", ":third_party_skcms", ":tool_utils", + "modules/sksg", "//third_party/jsoncpp", "//third_party/libpng", ] @@ -1653,13 +1615,13 @@ if (skia_enable_tools) { deps = [ ":bench", ":common_flags", - ":experimental_sksg", ":experimental_svg_model", ":flags", ":gm", ":gpu_tool_utils", ":skia", ":tool_utils", + "modules/sksg", "//third_party/jsoncpp", ] } @@ -2069,7 +2031,6 @@ if (skia_enable_tools) { include_dirs = [] deps = [ - ":experimental_sksg", ":experimental_svg_model", ":flags", ":gm", @@ -2079,6 +2040,7 @@ if (skia_enable_tools) { ":skia", ":tool_utils", ":views", + "modules/sksg", "//third_party/imgui", "//third_party/jsoncpp", ] diff --git a/gn/samples.gni b/gn/samples.gni index 135cf78013..b5728b3bfd 100644 --- a/gn/samples.gni +++ b/gn/samples.gni @@ -88,9 +88,7 @@ samples_sources = [ "$_samplecode/SampleStrokePath.cpp", "$_samplecode/SampleStrokeRect.cpp", "$_samplecode/SampleSubpixelTranslate.cpp", - "$_samplecode/SampleSGInval.cpp", "$_samplecode/SampleSVGFile.cpp", - "$_samplecode/SampleSVGPong.cpp", "$_samplecode/SampleText.cpp", "$_samplecode/SampleTextAlpha.cpp", "$_samplecode/SampleTextBox.cpp", diff --git a/gn/tests.gni b/gn/tests.gni index bbab21e76a..a40ce68bdb 100644 --- a/gn/tests.gni +++ b/gn/tests.gni @@ -205,7 +205,6 @@ tests_sources = [ "$_tests/ScaleToSidesTest.cpp", "$_tests/SerializationTest.cpp", "$_tests/SerialProcsTest.cpp", - "$_tests/SGTest.cpp", "$_tests/ShaderOpacityTest.cpp", "$_tests/ShaderTest.cpp", "$_tests/ShadowTest.cpp", diff --git a/modules/sksg/BUILD.gn b/modules/sksg/BUILD.gn new file mode 100644 index 0000000000..2809cf1876 --- /dev/null +++ b/modules/sksg/BUILD.gn @@ -0,0 +1,90 @@ +# Copyright 2018 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { + skia_enable_sksg = true +} + +config("public_config") { + if (skia_enable_sksg) { + defines = [ "SK_HAS_SKSG" ] + include_dirs = [ "include" ] + } +} + +source_set("sksg") { + if (skia_enable_sksg) { + public_configs = [ ":public_config" ] + sources = [ + "src/SkSGClipEffect.cpp", + "src/SkSGColor.cpp", + "src/SkSGDraw.cpp", + "src/SkSGEffectNode.cpp", + "src/SkSGGeometryNode.cpp", + "src/SkSGGeometryTransform.cpp", + "src/SkSGGradient.cpp", + "src/SkSGGroup.cpp", + "src/SkSGImage.cpp", + "src/SkSGInvalidationController.cpp", + "src/SkSGMaskEffect.cpp", + "src/SkSGMerge.cpp", + "src/SkSGNode.cpp", + "src/SkSGOpacityEffect.cpp", + "src/SkSGPaintNode.cpp", + "src/SkSGPath.cpp", + "src/SkSGPlane.cpp", + "src/SkSGRect.cpp", + "src/SkSGRenderNode.cpp", + "src/SkSGRoundEffect.cpp", + "src/SkSGScene.cpp", + "src/SkSGText.cpp", + "src/SkSGTransform.cpp", + "src/SkSGTrimEffect.cpp", + ] + configs += [ "../../:skia_private" ] + deps = [ + "../..:skia", + ] + } +} + +source_set("tests") { + if (skia_enable_sksg) { + testonly = true + + configs += [ + "../..:skia_private", + "../..:tests_config", # TODO: refactor to make this nicer + ] + sources = [ + "tests/SGTest.cpp", + ] + deps = [ + ":sksg", + "../..:gpu_tool_utils", # TODO: refactor to make this nicer + "../..:skia", + ] + } +} + +source_set("samples") { + if (skia_enable_sksg) { + testonly = true + + configs += [ + "../..:skia_private", + "../..:samples_config", # TODO: refactor to make this nicer + ] + sources = [ + "samples/SampleSVGPong.cpp", + ] + deps = [ + ":sksg", + "../..:gm", # TODO: refactor to make this nicer + "../..:skia", + "../..:views", # TODO: refactor to make this nicer + ] + } +} diff --git a/experimental/sksg/effects/SkSGClipEffect.h b/modules/sksg/include/SkSGClipEffect.h index 674edb2b5c..674edb2b5c 100644 --- a/experimental/sksg/effects/SkSGClipEffect.h +++ b/modules/sksg/include/SkSGClipEffect.h diff --git a/experimental/sksg/paint/SkSGColor.h b/modules/sksg/include/SkSGColor.h index a19921cfd3..a19921cfd3 100644 --- a/experimental/sksg/paint/SkSGColor.h +++ b/modules/sksg/include/SkSGColor.h diff --git a/experimental/sksg/SkSGDraw.h b/modules/sksg/include/SkSGDraw.h index 20ead3d5f6..20ead3d5f6 100644 --- a/experimental/sksg/SkSGDraw.h +++ b/modules/sksg/include/SkSGDraw.h diff --git a/experimental/sksg/SkSGEffectNode.h b/modules/sksg/include/SkSGEffectNode.h index ab0968e96c..ab0968e96c 100644 --- a/experimental/sksg/SkSGEffectNode.h +++ b/modules/sksg/include/SkSGEffectNode.h diff --git a/experimental/sksg/SkSGGeometryNode.h b/modules/sksg/include/SkSGGeometryNode.h index 7ce3aa9b79..7ce3aa9b79 100644 --- a/experimental/sksg/SkSGGeometryNode.h +++ b/modules/sksg/include/SkSGGeometryNode.h diff --git a/experimental/sksg/geometry/SkSGGeometryTransform.h b/modules/sksg/include/SkSGGeometryTransform.h index fe7e026031..fe7e026031 100644 --- a/experimental/sksg/geometry/SkSGGeometryTransform.h +++ b/modules/sksg/include/SkSGGeometryTransform.h diff --git a/experimental/sksg/paint/SkSGGradient.h b/modules/sksg/include/SkSGGradient.h index d69cb1495c..d69cb1495c 100644 --- a/experimental/sksg/paint/SkSGGradient.h +++ b/modules/sksg/include/SkSGGradient.h diff --git a/experimental/sksg/SkSGGroup.h b/modules/sksg/include/SkSGGroup.h index 482f10db8c..482f10db8c 100644 --- a/experimental/sksg/SkSGGroup.h +++ b/modules/sksg/include/SkSGGroup.h diff --git a/experimental/sksg/SkSGImage.h b/modules/sksg/include/SkSGImage.h index 7d17a50aaa..7d17a50aaa 100644 --- a/experimental/sksg/SkSGImage.h +++ b/modules/sksg/include/SkSGImage.h diff --git a/experimental/sksg/SkSGInvalidationController.h b/modules/sksg/include/SkSGInvalidationController.h index df3857c1fe..df3857c1fe 100644 --- a/experimental/sksg/SkSGInvalidationController.h +++ b/modules/sksg/include/SkSGInvalidationController.h diff --git a/experimental/sksg/effects/SkSGMaskEffect.h b/modules/sksg/include/SkSGMaskEffect.h index c4fd0120e5..c4fd0120e5 100644 --- a/experimental/sksg/effects/SkSGMaskEffect.h +++ b/modules/sksg/include/SkSGMaskEffect.h diff --git a/experimental/sksg/geometry/SkSGMerge.h b/modules/sksg/include/SkSGMerge.h index 54924d6475..54924d6475 100644 --- a/experimental/sksg/geometry/SkSGMerge.h +++ b/modules/sksg/include/SkSGMerge.h diff --git a/experimental/sksg/SkSGNode.h b/modules/sksg/include/SkSGNode.h index 17619de485..17619de485 100644 --- a/experimental/sksg/SkSGNode.h +++ b/modules/sksg/include/SkSGNode.h diff --git a/experimental/sksg/effects/SkSGOpacityEffect.h b/modules/sksg/include/SkSGOpacityEffect.h index d906775b44..d906775b44 100644 --- a/experimental/sksg/effects/SkSGOpacityEffect.h +++ b/modules/sksg/include/SkSGOpacityEffect.h diff --git a/experimental/sksg/SkSGPaintNode.h b/modules/sksg/include/SkSGPaintNode.h index 5c9563b3a6..5c9563b3a6 100644 --- a/experimental/sksg/SkSGPaintNode.h +++ b/modules/sksg/include/SkSGPaintNode.h diff --git a/experimental/sksg/geometry/SkSGPath.h b/modules/sksg/include/SkSGPath.h index 1a8718868d..1a8718868d 100644 --- a/experimental/sksg/geometry/SkSGPath.h +++ b/modules/sksg/include/SkSGPath.h diff --git a/experimental/sksg/geometry/SkSGPlane.h b/modules/sksg/include/SkSGPlane.h index c0a26375b2..c0a26375b2 100644 --- a/experimental/sksg/geometry/SkSGPlane.h +++ b/modules/sksg/include/SkSGPlane.h diff --git a/experimental/sksg/geometry/SkSGRect.h b/modules/sksg/include/SkSGRect.h index f5fcb962c6..f5fcb962c6 100644 --- a/experimental/sksg/geometry/SkSGRect.h +++ b/modules/sksg/include/SkSGRect.h diff --git a/experimental/sksg/SkSGRenderNode.h b/modules/sksg/include/SkSGRenderNode.h index 4ca1aec616..4ca1aec616 100644 --- a/experimental/sksg/SkSGRenderNode.h +++ b/modules/sksg/include/SkSGRenderNode.h diff --git a/experimental/sksg/geometry/SkSGRoundEffect.h b/modules/sksg/include/SkSGRoundEffect.h index 67124ca072..67124ca072 100644 --- a/experimental/sksg/geometry/SkSGRoundEffect.h +++ b/modules/sksg/include/SkSGRoundEffect.h diff --git a/experimental/sksg/SkSGScene.h b/modules/sksg/include/SkSGScene.h index 2081c1d747..2081c1d747 100644 --- a/experimental/sksg/SkSGScene.h +++ b/modules/sksg/include/SkSGScene.h diff --git a/experimental/sksg/geometry/SkSGText.h b/modules/sksg/include/SkSGText.h index eb43337a10..eb43337a10 100644 --- a/experimental/sksg/geometry/SkSGText.h +++ b/modules/sksg/include/SkSGText.h diff --git a/experimental/sksg/effects/SkSGTransform.h b/modules/sksg/include/SkSGTransform.h index 6b7fbc010b..6b7fbc010b 100644 --- a/experimental/sksg/effects/SkSGTransform.h +++ b/modules/sksg/include/SkSGTransform.h diff --git a/experimental/sksg/geometry/SkSGTrimEffect.h b/modules/sksg/include/SkSGTrimEffect.h index 18f15921e7..18f15921e7 100644 --- a/experimental/sksg/geometry/SkSGTrimEffect.h +++ b/modules/sksg/include/SkSGTrimEffect.h diff --git a/samplecode/SampleSVGPong.cpp b/modules/sksg/samples/SampleSVGPong.cpp index 993af38be8..993af38be8 100644 --- a/samplecode/SampleSVGPong.cpp +++ b/modules/sksg/samples/SampleSVGPong.cpp diff --git a/experimental/sksg/effects/SkSGClipEffect.cpp b/modules/sksg/src/SkSGClipEffect.cpp index b2d68fc8cf..b2d68fc8cf 100644 --- a/experimental/sksg/effects/SkSGClipEffect.cpp +++ b/modules/sksg/src/SkSGClipEffect.cpp diff --git a/experimental/sksg/paint/SkSGColor.cpp b/modules/sksg/src/SkSGColor.cpp index d5d4d1ce62..d5d4d1ce62 100644 --- a/experimental/sksg/paint/SkSGColor.cpp +++ b/modules/sksg/src/SkSGColor.cpp diff --git a/experimental/sksg/SkSGDraw.cpp b/modules/sksg/src/SkSGDraw.cpp index b73bf3b577..b73bf3b577 100644 --- a/experimental/sksg/SkSGDraw.cpp +++ b/modules/sksg/src/SkSGDraw.cpp diff --git a/experimental/sksg/SkSGEffectNode.cpp b/modules/sksg/src/SkSGEffectNode.cpp index 70050ccb70..70050ccb70 100644 --- a/experimental/sksg/SkSGEffectNode.cpp +++ b/modules/sksg/src/SkSGEffectNode.cpp diff --git a/experimental/sksg/SkSGGeometryNode.cpp b/modules/sksg/src/SkSGGeometryNode.cpp index 6b78c488b7..6b78c488b7 100644 --- a/experimental/sksg/SkSGGeometryNode.cpp +++ b/modules/sksg/src/SkSGGeometryNode.cpp diff --git a/experimental/sksg/geometry/SkSGGeometryTransform.cpp b/modules/sksg/src/SkSGGeometryTransform.cpp index 5b366b9620..5b366b9620 100644 --- a/experimental/sksg/geometry/SkSGGeometryTransform.cpp +++ b/modules/sksg/src/SkSGGeometryTransform.cpp diff --git a/experimental/sksg/paint/SkSGGradient.cpp b/modules/sksg/src/SkSGGradient.cpp index 98e7f395f8..98e7f395f8 100644 --- a/experimental/sksg/paint/SkSGGradient.cpp +++ b/modules/sksg/src/SkSGGradient.cpp diff --git a/experimental/sksg/SkSGGroup.cpp b/modules/sksg/src/SkSGGroup.cpp index aeccf233f7..aeccf233f7 100644 --- a/experimental/sksg/SkSGGroup.cpp +++ b/modules/sksg/src/SkSGGroup.cpp diff --git a/experimental/sksg/SkSGImage.cpp b/modules/sksg/src/SkSGImage.cpp index a0c3a759dc..a0c3a759dc 100644 --- a/experimental/sksg/SkSGImage.cpp +++ b/modules/sksg/src/SkSGImage.cpp diff --git a/experimental/sksg/SkSGInvalidationController.cpp b/modules/sksg/src/SkSGInvalidationController.cpp index 81a3376bf6..81a3376bf6 100644 --- a/experimental/sksg/SkSGInvalidationController.cpp +++ b/modules/sksg/src/SkSGInvalidationController.cpp diff --git a/experimental/sksg/effects/SkSGMaskEffect.cpp b/modules/sksg/src/SkSGMaskEffect.cpp index 16e4c0dd8d..16e4c0dd8d 100644 --- a/experimental/sksg/effects/SkSGMaskEffect.cpp +++ b/modules/sksg/src/SkSGMaskEffect.cpp diff --git a/experimental/sksg/geometry/SkSGMerge.cpp b/modules/sksg/src/SkSGMerge.cpp index be1ff4123a..be1ff4123a 100644 --- a/experimental/sksg/geometry/SkSGMerge.cpp +++ b/modules/sksg/src/SkSGMerge.cpp diff --git a/experimental/sksg/SkSGNode.cpp b/modules/sksg/src/SkSGNode.cpp index 35b2640dbb..35b2640dbb 100644 --- a/experimental/sksg/SkSGNode.cpp +++ b/modules/sksg/src/SkSGNode.cpp diff --git a/experimental/sksg/effects/SkSGOpacityEffect.cpp b/modules/sksg/src/SkSGOpacityEffect.cpp index b1ff10d217..b1ff10d217 100644 --- a/experimental/sksg/effects/SkSGOpacityEffect.cpp +++ b/modules/sksg/src/SkSGOpacityEffect.cpp diff --git a/experimental/sksg/SkSGPaintNode.cpp b/modules/sksg/src/SkSGPaintNode.cpp index 9220b0f0af..9220b0f0af 100644 --- a/experimental/sksg/SkSGPaintNode.cpp +++ b/modules/sksg/src/SkSGPaintNode.cpp diff --git a/experimental/sksg/geometry/SkSGPath.cpp b/modules/sksg/src/SkSGPath.cpp index 230442d409..230442d409 100644 --- a/experimental/sksg/geometry/SkSGPath.cpp +++ b/modules/sksg/src/SkSGPath.cpp diff --git a/experimental/sksg/geometry/SkSGPlane.cpp b/modules/sksg/src/SkSGPlane.cpp index 806fcc7d29..806fcc7d29 100644 --- a/experimental/sksg/geometry/SkSGPlane.cpp +++ b/modules/sksg/src/SkSGPlane.cpp diff --git a/experimental/sksg/geometry/SkSGRect.cpp b/modules/sksg/src/SkSGRect.cpp index 16f0a6f1e1..16f0a6f1e1 100644 --- a/experimental/sksg/geometry/SkSGRect.cpp +++ b/modules/sksg/src/SkSGRect.cpp diff --git a/experimental/sksg/SkSGRenderNode.cpp b/modules/sksg/src/SkSGRenderNode.cpp index e952c69f20..e952c69f20 100644 --- a/experimental/sksg/SkSGRenderNode.cpp +++ b/modules/sksg/src/SkSGRenderNode.cpp diff --git a/experimental/sksg/geometry/SkSGRoundEffect.cpp b/modules/sksg/src/SkSGRoundEffect.cpp index 8cf9068f65..8cf9068f65 100644 --- a/experimental/sksg/geometry/SkSGRoundEffect.cpp +++ b/modules/sksg/src/SkSGRoundEffect.cpp diff --git a/experimental/sksg/SkSGScene.cpp b/modules/sksg/src/SkSGScene.cpp index 8d7e0b369b..8d7e0b369b 100644 --- a/experimental/sksg/SkSGScene.cpp +++ b/modules/sksg/src/SkSGScene.cpp diff --git a/experimental/sksg/geometry/SkSGText.cpp b/modules/sksg/src/SkSGText.cpp index c149390023..c149390023 100644 --- a/experimental/sksg/geometry/SkSGText.cpp +++ b/modules/sksg/src/SkSGText.cpp diff --git a/experimental/sksg/effects/SkSGTransform.cpp b/modules/sksg/src/SkSGTransform.cpp index 6a985a971e..6a985a971e 100644 --- a/experimental/sksg/effects/SkSGTransform.cpp +++ b/modules/sksg/src/SkSGTransform.cpp diff --git a/experimental/sksg/geometry/SkSGTrimEffect.cpp b/modules/sksg/src/SkSGTrimEffect.cpp index b8c59bcfe8..b8c59bcfe8 100644 --- a/experimental/sksg/geometry/SkSGTrimEffect.cpp +++ b/modules/sksg/src/SkSGTrimEffect.cpp diff --git a/tests/SGTest.cpp b/modules/sksg/tests/SGTest.cpp index 1228e666e7..1228e666e7 100644 --- a/tests/SGTest.cpp +++ b/modules/sksg/tests/SGTest.cpp diff --git a/samplecode/SampleSGInval.cpp b/samplecode/SampleSGInval.cpp deleted file mode 100644 index 44cdcb91d9..0000000000 --- a/samplecode/SampleSGInval.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SampleCode.h" -#include "SkCanvas.h" -#include "SkSGColor.h" -#include "SkSGDraw.h" -#include "SkSGGroup.h" -#include "SkSGInvalidationController.h" -#include "SkSGRect.h" -#include "SkSGTransform.h" -#include "SkAnimTimer.h" - -#include <cmath> - -class SGInvalView final : public SampleView { -public: - SGInvalView() {} - -protected: - void onOnceBeforeDraw() override { - fRect1 = sksg::Rect::Make(SkRect::MakeLTRB(100, 100, 100, 100)); - fRect2 = sksg::Rect::Make(SkRect::MakeLTRB(300, 200, 300, 200)); - fColor1 = sksg::Color::Make(0); - fColor2 = sksg::Color::Make(0); - - fRoot = sksg::Group::Make(); - fRoot->addChild(sksg::Draw::Make(fRect1, fColor1)); - fRoot->addChild(sksg::Transform::Make(sksg::Draw::Make(fRect2, fColor2), - SkMatrix::MakeScale(1.5f, 1.5f))); - } - - bool onQuery(SkEvent* evt) override { - if (SampleCode::TitleQ(*evt)) { - SampleCode::TitleR(evt, "SGInval"); - return true; - } - - return this->INHERITED::onQuery(evt); - } - - void onDrawContent(SkCanvas* canvas) override { - sksg::InvalidationController ic; - fRoot->revalidate(&ic, SkMatrix::I()); - - // TODO: clip/cull - fRoot->render(canvas); - - SkPaint p; - p.setColor(0xffff0000); - p.setStyle(SkPaint::kStroke_Style); - p.setAntiAlias(true); - p.setStrokeWidth(0); - - for (const auto& r : ic) { - canvas->drawRect(r, p); - } - } - - bool onAnimate(const SkAnimTimer& timer) override { - if (!fRoot) { - return true; - } - - static constexpr SkScalar kSize = 50; - static constexpr SkScalar kRate = 1.0f / 500; - const auto t = timer.msec() * kRate; - - fRect1->setR(fRect1->getL() + kSize * (1 + std::sin(t))); - fRect1->setB(fRect1->getT() + kSize * (1 + std::cos(t))); - fRect2->setR(fRect2->getL() + kSize * (1 + std::cos(SK_ScalarPI / 2 + t))); - fRect2->setB(fRect2->getT() + kSize * (1 + std::sin(SK_ScalarPI / 2 + t))); - - fColor1->setColor(SkColorSetARGB(128 * (1 + std::sin(t)), 0, 0x80, 0)); - fColor2->setColor(SkColorSetARGB(128 * (1 + std::cos(t)), 0, 0, 0x80)); - return true; - } - -private: - typedef SampleView INHERITED; - - sk_sp<sksg::Rect> fRect1, - fRect2; - sk_sp<sksg::Color> fColor1, - fColor2; - sk_sp<sksg::Group> fRoot; -}; - -static SkView* SGInvalFactory() { return new SGInvalView; } -static SkViewRegister reg(SGInvalFactory); diff --git a/tools/viewer/SlideDir.cpp b/tools/viewer/SlideDir.cpp index 1da6df4678..41bff87b79 100644 --- a/tools/viewer/SlideDir.cpp +++ b/tools/viewer/SlideDir.cpp @@ -7,6 +7,8 @@ #include "SlideDir.h" +#ifdef SK_HAS_SKSG + #include "SkAnimTimer.h" #include "SkCanvas.h" #include "SkCubicMap.h" @@ -418,3 +420,5 @@ const SlideDir::Rec* SlideDir::findCell(float x, float y) const { return idx < fRecs.count() ? &fRecs[idx] : nullptr; } + +#endif // SK_HAS_SKSG diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 85a72984a3..2357a18bb5 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -37,11 +37,14 @@ #include "SkTaskGroup.h" #include "SkTestFontMgr.h" #include "SkThreadedBMPDevice.h" -#include "SlideDir.h" #include "SvgSlide.h" #include "ccpr/GrCoverageCountingPathRenderer.h" #include "imgui.h" +#if defined(SK_HAS_SKSG) + #include "SlideDir.h" +#endif + #if defined(SK_ENABLE_SKOTTIE) #include "SkottieSlide.h" #endif @@ -646,13 +649,14 @@ void Viewer::initSlides() { addSlide(name, SkOSPath::Join(flag.c_str(), name.c_str()), info.fFactory); } } - +#if defined(SK_HAS_SKSG) if (!dirSlides.empty()) { fSlides.push_back( sk_make_sp<SlideDir>(SkStringPrintf("%s[%s]", info.fDirName, flag.c_str()), std::move(dirSlides))); dirSlides.reset(); } +#endif } } } |