From a7e78ee1d461b91132f01d6b8b0b16bc31063a04 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Tue, 10 Jul 2018 11:13:06 -0400 Subject: [skottie] Misc cleanup * pass inline defaults * log expressions TBR= Change-Id: I5e3ab038d612c738abb1bcf35b4cc492b9aaa6c1 Reviewed-on: https://skia-review.googlesource.com/140240 Reviewed-by: Florin Malita Commit-Queue: Florin Malita --- modules/skottie/src/Skottie.cpp | 8 +++----- modules/skottie/src/SkottieAnimator.cpp | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/skottie/src/Skottie.cpp b/modules/skottie/src/Skottie.cpp index 5cd1f4e6fa..571cbd1d9d 100644 --- a/modules/skottie/src/Skottie.cpp +++ b/modules/skottie/src/Skottie.cpp @@ -123,14 +123,13 @@ sk_sp AttachOpacity(const skjson::ObjectValue& jtransform, Att if (!childNode) return nullptr; - static constexpr ScalarValue kNoopOpacity = 100; auto opacityNode = sksg::OpacityEffect::Make(childNode); if (!BindProperty(jtransform["o"], &ctx->fAnimators, [opacityNode](const ScalarValue& o) { // BM opacity is [0..100] opacityNode->setOpacity(o * 0.01f); - }, &kNoopOpacity)) { + }, 100.0f)) { // We can ignore static full opacity. return childNode; } @@ -164,7 +163,7 @@ sk_sp AttachRRectGeometry(const skjson::ObjectValue& jrect, auto p_attached = BindProperty(jrect["p"], &ctx->fAnimators, [adapter](const VectorValue& p) { - adapter->setPosition(ValueTraits::As(p)); + adapter->setPosition(ValueTraits::As(p)); }); auto s_attached = BindProperty(jrect["s"], &ctx->fAnimators, [adapter](const VectorValue& s) { @@ -1021,7 +1020,6 @@ sk_sp AttachMask(const skjson::ArrayValue* jmask, SkSTArray<4, MaskRecord, true> mask_stack; - const SkScalar full_opacity = 100; bool has_opacity = false; for (const skjson::ObjectValue* m : *jmask) { @@ -1065,7 +1063,7 @@ sk_sp AttachMask(const skjson::ArrayValue* jmask, has_opacity |= BindProperty((*m)["o"], &ctx->fAnimators, [mask_paint](const ScalarValue& o) { mask_paint->setOpacity(o * 0.01f); - }, &full_opacity); + }, 100.0f); mask_stack.push_back({mask_path, mask_paint, mask_info->fMergeMode}); } diff --git a/modules/skottie/src/SkottieAnimator.cpp b/modules/skottie/src/SkottieAnimator.cpp index b2ec87254b..7ce1b7f6ba 100644 --- a/modules/skottie/src/SkottieAnimator.cpp +++ b/modules/skottie/src/SkottieAnimator.cpp @@ -245,6 +245,10 @@ static inline bool BindPropertyImpl(const skjson::ObjectValue* jprop, const auto& jpropA = (*jprop)["a"]; const auto& jpropK = (*jprop)["k"]; + if (!(*jprop)["x"].is()) { + LOG("?? Unsupported expression.\n"); + } + // Older Json versions don't have an "a" animation marker. // For those, we attempt to parse both ways. if (!ParseDefault(jpropA, false)) { -- cgit v1.2.3