From 2d5fb12526e24cd91eedc795393aaf46cb6b59b8 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Wed, 24 Jan 2018 14:30:12 -0500 Subject: [skottie] Clamp keyframe values We can skip interpolation if |t| is out of range or the interval is constant ("hold"). TBR= Change-Id: I0602d36557f46592ab673201ed2b4a96d40dc461 Reviewed-on: https://skia-review.googlesource.com/99420 Reviewed-by: Florin Malita Commit-Queue: Florin Malita --- experimental/skottie/SkottieAnimator.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'experimental/skottie/SkottieAnimator.cpp') diff --git a/experimental/skottie/SkottieAnimator.cpp b/experimental/skottie/SkottieAnimator.cpp index da00beb2fe..13f14dbf75 100644 --- a/experimental/skottie/SkottieAnimator.cpp +++ b/experimental/skottie/SkottieAnimator.cpp @@ -69,19 +69,12 @@ bool KeyframeIntervalBase::parse(const Json::Value& k, KeyframeIntervalBase* pre float KeyframeIntervalBase::localT(float t) const { SkASSERT(this->isValid()); - - // 'hold' pins to v0 - if (fHold) { - return 0; - } + SkASSERT(!this->isHold()); + SkASSERT(t > fT0 && t < fT1); auto lt = (t - fT0) / (fT1 - fT0); - if (fCubicMap) { - lt = fCubicMap->computeYFromX(lt); - } - - return SkTPin(lt, 0, 1); + return fCubicMap ? fCubicMap->computeYFromX(lt) : lt; } template <> -- cgit v1.2.3