diff options
author | Florin Malita <fmalita@chromium.org> | 2018-01-02 14:37:37 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-02 21:25:16 +0000 |
commit | aa4dc621397d5745e33509fb1ae9076e73c864c7 (patch) | |
tree | 3f0d446b3954d82291592c5c8fa67972360d2c00 /tools/viewer | |
parent | 20aaaeebc10ce7f6b6114dd7a9420dfdb8dab8f9 (diff) |
[skotty] Clip/scale/center animations in Viewer
Animations have explicit bounds. Updated Viewer to map the animation
to its full viewport.
TBR=
Change-Id: I5a016cace8ae97e9b4f0b93261fcfb4993ea2307
Reviewed-on: https://skia-review.googlesource.com/90263
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tools/viewer')
-rw-r--r-- | tools/viewer/SkottySlide.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/viewer/SkottySlide.cpp b/tools/viewer/SkottySlide.cpp index d65b7ecbc1..432b307a5e 100644 --- a/tools/viewer/SkottySlide.cpp +++ b/tools/viewer/SkottySlide.cpp @@ -8,6 +8,7 @@ #include "SkottySlide.h" #include "SkAnimTimer.h" +#include "SkCanvas.h" #include "Skotty.h" #include "SkStream.h" @@ -42,6 +43,12 @@ SkISize SkottySlide::getDimensions() const { void SkottySlide::draw(SkCanvas* canvas) { if (fAnimation) { + SkAutoCanvasRestore acr(canvas, true); + const auto animationBounds = SkRect::Make(fAnimation->size().toCeil()); + canvas->concat(SkMatrix::MakeRectToRect(animationBounds, + SkRect::Make(canvas->imageInfo().bounds()), + SkMatrix::kCenter_ScaleToFit)); + canvas->clipRect(animationBounds); fAnimation->render(canvas); } } |