[skottie] Fix precomp time remapping vs time start/stretch interaction
In the presence of time remapping, time start/stretch values appear to
be ignored.
TBR=
Change-Id: I6a4dcc107f2d0fc6361f91ba4f4643e33da37d93
Reviewed-on: https://skia-review.googlesource.com/149701
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/modules/skottie/src/SkottiePrecompLayer.cpp b/modules/skottie/src/SkottiePrecompLayer.cpp
index 8fc4167..01dafd9 100644
--- a/modules/skottie/src/SkottiePrecompLayer.cpp
+++ b/modules/skottie/src/SkottiePrecompLayer.cpp
@@ -21,8 +21,9 @@
sk_sp<sksg::RenderNode> AnimationBuilder::attachPrecompLayer(const skjson::ObjectValue& jlayer,
AnimatorScope* ascope) const {
const skjson::ObjectValue* time_remap = jlayer["tm"];
- const auto start_time = ParseDefault<float>(jlayer["st"], 0.0f),
- stretch_time = ParseDefault<float>(jlayer["sr"], 1.0f);
+ // Empirically, a time mapper supersedes start/stretch.
+ const auto start_time = time_remap ? 0.0f : ParseDefault<float>(jlayer["st"], 0.0f),
+ stretch_time = time_remap ? 1.0f : ParseDefault<float>(jlayer["sr"], 1.0f);
const auto requires_time_mapping = !SkScalarNearlyEqual(start_time , 0) ||
!SkScalarNearlyEqual(stretch_time, 1) ||
time_remap;