From 3d856bdeee7fae2ff36cdb6a9807c588fc030eb1 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Sat, 26 May 2018 09:49:28 -0400 Subject: [PATCH] [skottie] Relocate to modules/skottie TBR= Change-Id: I218d251ca56578a3a7fd4fb86cba9abdc10fb3bd Reviewed-on: https://skia-review.googlesource.com/130322 Reviewed-by: Florin Malita Commit-Queue: Florin Malita --- BUILD.gn | 39 ++------------- modules/skottie/BUILD.gn | 49 +++++++++++++++++++ .../skottie/fuzz}/FuzzSkottieJSON.cpp | 0 .../skottie/include}/Skottie.h | 0 .../skottie/src}/Skottie.cpp | 0 .../skottie/src}/SkottieAdapter.cpp | 0 .../skottie/src}/SkottieAdapter.h | 0 .../skottie/src}/SkottieAnimator.cpp | 0 .../skottie/src}/SkottieAnimator.h | 0 .../skottie/src}/SkottieJson.cpp | 0 .../skottie/src}/SkottieJson.h | 0 .../skottie/src}/SkottieValue.cpp | 0 .../skottie/src}/SkottieValue.h | 0 third_party/rapidjson/BUILD.gn | 1 - tools/viewer/SkottieSlide.cpp | 4 ++ tools/viewer/SkottieSlide.h | 4 ++ 16 files changed, 62 insertions(+), 35 deletions(-) create mode 100644 modules/skottie/BUILD.gn rename {fuzz/oss_fuzz => modules/skottie/fuzz}/FuzzSkottieJSON.cpp (100%) rename {experimental/skottie => modules/skottie/include}/Skottie.h (100%) rename {experimental/skottie => modules/skottie/src}/Skottie.cpp (100%) rename {experimental/skottie => modules/skottie/src}/SkottieAdapter.cpp (100%) rename {experimental/skottie => modules/skottie/src}/SkottieAdapter.h (100%) rename {experimental/skottie => modules/skottie/src}/SkottieAnimator.cpp (100%) rename {experimental/skottie => modules/skottie/src}/SkottieAnimator.h (100%) rename {experimental/skottie => modules/skottie/src}/SkottieJson.cpp (100%) rename {experimental/skottie => modules/skottie/src}/SkottieJson.h (100%) rename {experimental/skottie => modules/skottie/src}/SkottieValue.cpp (100%) rename {experimental/skottie => modules/skottie/src}/SkottieValue.h (100%) diff --git a/BUILD.gn b/BUILD.gn index 7ae0f6d600..d0c6755555 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -39,7 +39,6 @@ declare_args() { skia_enable_fontmgr_empty = false skia_enable_gpu = true skia_enable_pdf = true - skia_enable_skottie = true skia_enable_spirv_validation = is_skia_dev_build && is_debug skia_enable_tools = is_skia_dev_build skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug @@ -1013,8 +1012,7 @@ if (skia_enable_tools) { public_configs = [ ":skia.h_config" ] skia_h = "$target_gen_dir/skia.h" script = "gn/find_headers.py" - args = [ rebase_path("//bin/gn") ] + - [ rebase_path("//") ] + + args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] + [ rebase_path(skia_h, root_build_dir) ] + rebase_path(skia_public_includes) depfile = "$skia_h.deps" @@ -1420,26 +1418,6 @@ if (skia_enable_tools) { ] } - test_lib("experimental_skottie") { - public_include_dirs = [] - if (skia_enable_skottie) { - public_include_dirs += [ "experimental/skottie" ] - public_defines = [ "SK_ENABLE_SKOTTIE" ] - sources = [ - "experimental/skottie/Skottie.cpp", - "experimental/skottie/SkottieAdapter.cpp", - "experimental/skottie/SkottieAnimator.cpp", - "experimental/skottie/SkottieJson.cpp", - "experimental/skottie/SkottieValue.cpp", - ] - deps = [ - ":skia", - "modules/sksg", - "//third_party/rapidjson", - ] - } - } - test_lib("experimental_svg_model") { public_include_dirs = [] if (skia_use_expat) { @@ -1582,7 +1560,6 @@ if (skia_enable_tools) { include_dirs = [ "tests" ] deps = [ ":common_flags", - ":experimental_skottie", ":experimental_svg_model", ":flags", ":gm", @@ -1591,6 +1568,7 @@ if (skia_enable_tools) { ":tests", ":third_party_skcms", ":tool_utils", + "modules/skottie", "modules/sksg", "//third_party/jsoncpp", "//third_party/libpng", @@ -1790,17 +1768,13 @@ if (skia_enable_tools) { "tools/picture_utils.cpp", ] deps = [ - ":experimental_skottie", ":flags", ":gpu_tool_utils", ":skia", + "modules/skottie:fuzz", "//third_party/jsoncpp", "//third_party/libpng", ] - - if (skia_enable_skottie) { - sources += [ "fuzz/oss_fuzz/FuzzSkottieJSON.cpp" ] - } } test_app("pathops_unittest") { @@ -2023,6 +1997,7 @@ if (skia_enable_tools) { "tools/viewer/ImageSlide.cpp", "tools/viewer/SKPSlide.cpp", "tools/viewer/SampleSlide.cpp", + "tools/viewer/SkottieSlide.cpp", "tools/viewer/SlideDir.cpp", "tools/viewer/StatsLayer.cpp", "tools/viewer/SvgSlide.cpp", @@ -2041,15 +2016,11 @@ if (skia_enable_tools) { ":skia", ":tool_utils", ":views", + "modules/skottie", "modules/sksg", "//third_party/imgui", "//third_party/jsoncpp", ] - - if (skia_enable_skottie) { - sources += [ "tools/viewer/SkottieSlide.cpp" ] - deps += [ ":experimental_skottie" ] - } } } diff --git a/modules/skottie/BUILD.gn b/modules/skottie/BUILD.gn new file mode 100644 index 0000000000..b3c532c00c --- /dev/null +++ b/modules/skottie/BUILD.gn @@ -0,0 +1,49 @@ +# 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_skottie = true +} + +config("public_config") { + if (skia_enable_skottie) { + defines = [ "SK_ENABLE_SKOTTIE" ] + include_dirs = [ "include" ] + } +} + +source_set("skottie") { + if (skia_enable_skottie) { + public_configs = [ ":public_config" ] + sources = [ + "src/Skottie.cpp", + "src/SkottieAdapter.cpp", + "src/SkottieAnimator.cpp", + "src/SkottieJson.cpp", + "src/SkottieValue.cpp", + ] + configs += [ "../../:skia_private" ] + deps = [ + "../..:skia", + "../../third_party/rapidjson", + "../sksg:sksg", + ] + } +} + +source_set("fuzz") { + if (skia_enable_skottie) { + testonly = true + + configs += [ "../..:skia_private" ] + sources = [ + "fuzz/FuzzSkottieJSON.cpp", + ] + deps = [ + ":skottie", + "../..:skia", # TODO: refactor to make this nicer + ] + } +} diff --git a/fuzz/oss_fuzz/FuzzSkottieJSON.cpp b/modules/skottie/fuzz/FuzzSkottieJSON.cpp similarity index 100% rename from fuzz/oss_fuzz/FuzzSkottieJSON.cpp rename to modules/skottie/fuzz/FuzzSkottieJSON.cpp diff --git a/experimental/skottie/Skottie.h b/modules/skottie/include/Skottie.h similarity index 100% rename from experimental/skottie/Skottie.h rename to modules/skottie/include/Skottie.h diff --git a/experimental/skottie/Skottie.cpp b/modules/skottie/src/Skottie.cpp similarity index 100% rename from experimental/skottie/Skottie.cpp rename to modules/skottie/src/Skottie.cpp diff --git a/experimental/skottie/SkottieAdapter.cpp b/modules/skottie/src/SkottieAdapter.cpp similarity index 100% rename from experimental/skottie/SkottieAdapter.cpp rename to modules/skottie/src/SkottieAdapter.cpp diff --git a/experimental/skottie/SkottieAdapter.h b/modules/skottie/src/SkottieAdapter.h similarity index 100% rename from experimental/skottie/SkottieAdapter.h rename to modules/skottie/src/SkottieAdapter.h diff --git a/experimental/skottie/SkottieAnimator.cpp b/modules/skottie/src/SkottieAnimator.cpp similarity index 100% rename from experimental/skottie/SkottieAnimator.cpp rename to modules/skottie/src/SkottieAnimator.cpp diff --git a/experimental/skottie/SkottieAnimator.h b/modules/skottie/src/SkottieAnimator.h similarity index 100% rename from experimental/skottie/SkottieAnimator.h rename to modules/skottie/src/SkottieAnimator.h diff --git a/experimental/skottie/SkottieJson.cpp b/modules/skottie/src/SkottieJson.cpp similarity index 100% rename from experimental/skottie/SkottieJson.cpp rename to modules/skottie/src/SkottieJson.cpp diff --git a/experimental/skottie/SkottieJson.h b/modules/skottie/src/SkottieJson.h similarity index 100% rename from experimental/skottie/SkottieJson.h rename to modules/skottie/src/SkottieJson.h diff --git a/experimental/skottie/SkottieValue.cpp b/modules/skottie/src/SkottieValue.cpp similarity index 100% rename from experimental/skottie/SkottieValue.cpp rename to modules/skottie/src/SkottieValue.cpp diff --git a/experimental/skottie/SkottieValue.h b/modules/skottie/src/SkottieValue.h similarity index 100% rename from experimental/skottie/SkottieValue.h rename to modules/skottie/src/SkottieValue.h diff --git a/third_party/rapidjson/BUILD.gn b/third_party/rapidjson/BUILD.gn index c506f038fb..f9e50b2686 100644 --- a/third_party/rapidjson/BUILD.gn +++ b/third_party/rapidjson/BUILD.gn @@ -9,5 +9,4 @@ third_party("rapidjson") { public_include_dirs = [ "../externals/rapidjson/include" ] defines = [ "RAPIDJSON_HAS_CXX11_RVALUE_REFS=1" ] sources = [] - testonly = true } diff --git a/tools/viewer/SkottieSlide.cpp b/tools/viewer/SkottieSlide.cpp index 78cda5cbda..f009066182 100644 --- a/tools/viewer/SkottieSlide.cpp +++ b/tools/viewer/SkottieSlide.cpp @@ -7,6 +7,8 @@ #include "SkottieSlide.h" +#if defined(SK_ENABLE_SKOTTIE) + #include "SkAnimTimer.h" #include "SkCanvas.h" #include "Skottie.h" @@ -130,3 +132,5 @@ bool SkottieSlide::onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState st return false; } + +#endif // SK_ENABLE_SKOTTIE diff --git a/tools/viewer/SkottieSlide.h b/tools/viewer/SkottieSlide.h index 0bfe66eef4..9ed4d78c8b 100644 --- a/tools/viewer/SkottieSlide.h +++ b/tools/viewer/SkottieSlide.h @@ -9,6 +9,8 @@ #define SkottieSlide_DEFINED #include "Slide.h" + +#if defined(SK_ENABLE_SKOTTIE) #include "Skottie.h" namespace sksg { class Scene; } @@ -41,4 +43,6 @@ private: typedef Slide INHERITED; }; +#endif // SK_ENABLE_SKOTTIE + #endif // SkottieSlide_DEFINED