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); } }