aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/skottie/SkottieAnimator.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-01-24 14:30:12 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-24 19:52:49 +0000
commit2d5fb12526e24cd91eedc795393aaf46cb6b59b8 (patch)
tree697d4a1158f9bf66a6ced63349f5ee3ef27920cc /experimental/skottie/SkottieAnimator.cpp
parent04f8b79acbec4a03fbac199d4bb2b561046e2268 (diff)
[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 <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental/skottie/SkottieAnimator.cpp')
-rw-r--r--experimental/skottie/SkottieAnimator.cpp13
1 files changed, 3 insertions, 10 deletions
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<float>(lt, 0, 1);
+ return fCubicMap ? fCubicMap->computeYFromX(lt) : lt;
}
template <>