[skottie] Fix NaN |t| in CompTimeMapper::onTick
Catch infinite time scale values at construction time.
Bug: skia:8381
Change-Id: I538c5bd0a75b080856ec39b3e94e2a303bb9a289
Reviewed-on: https://skia-review.googlesource.com/155167
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/modules/skottie/src/SkottiePrecompLayer.cpp b/modules/skottie/src/SkottiePrecompLayer.cpp
index 01dafd9..f229795 100644
--- a/modules/skottie/src/SkottiePrecompLayer.cpp
+++ b/modules/skottie/src/SkottiePrecompLayer.cpp
@@ -63,8 +63,9 @@
if (requires_time_mapping) {
const auto t_bias = -start_time,
t_scale = sk_ieee_float_divide(1, stretch_time);
- auto time_mapper = skstd::make_unique<CompTimeMapper>(std::move(local_animators),
- t_bias, t_scale);
+ auto time_mapper =
+ skstd::make_unique<CompTimeMapper>(std::move(local_animators), t_bias,
+ sk_float_isfinite(t_scale) ? t_scale : 0);
if (time_remap) {
// The lambda below captures a raw pointer to the mapper object. That should be safe,
// because both the lambda and the mapper are scoped/owned by ctx->fAnimators.