From a33447dab9b9ebdc0bd636b6ec7721557d21feac Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Tue, 29 May 2018 13:46:54 -0400 Subject: [skottie] Animation::animationTick() -> Animation::seek() Replace poorly defined animationTick() with a normalized seek() method. TBR= Change-Id: Id2ea17bb426fe86fede0d6c8a3d93236902f10af Reviewed-on: https://skia-review.googlesource.com/130508 Reviewed-by: Florin Malita Commit-Queue: Florin Malita --- dm/DMSrcSink.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'dm') diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 6378fabd3a..9def615f2b 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1234,9 +1234,7 @@ Error SkottieSrc::draw(SkCanvas* canvas) const { canvas->drawColor(SK_ColorWHITE); - const auto ip = fAnimation->inPoint() * 1000 / fAnimation->frameRate(), - op = fAnimation->outPoint() * 1000 / fAnimation->frameRate(), - fr = (op - ip) / (kTileCount * kTileCount - 1); + const auto t_rate = 1.0f / (kTileCount * kTileCount - 1); // Shuffled order to exercise non-linear frame progression. static constexpr int frames[] = { 4, 0, 3, 1, 2 }; @@ -1249,7 +1247,7 @@ Error SkottieSrc::draw(SkCanvas* canvas) const { const SkScalar x = frames[j] * fTileSize.width(); SkRect dest = SkRect::MakeXYWH(x, y, fTileSize.width(), fTileSize.height()); - const auto t = fr * (frames[i] * kTileCount + frames[j]); + const auto t = t_rate * (frames[i] * kTileCount + frames[j]); { SkAutoCanvasRestore acr(canvas, true); canvas->clipRect(dest, true); @@ -1257,7 +1255,7 @@ Error SkottieSrc::draw(SkCanvas* canvas) const { dest, SkMatrix::kCenter_ScaleToFit)); - fAnimation->animationTick(t); + fAnimation->seek(t); fAnimation->render(canvas); } } -- cgit v1.2.3