aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/skotty/Skotty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/skotty/Skotty.cpp')
-rw-r--r--experimental/skotty/Skotty.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/experimental/skotty/Skotty.cpp b/experimental/skotty/Skotty.cpp
index a13a04c03c..84cc08051f 100644
--- a/experimental/skotty/Skotty.cpp
+++ b/experimental/skotty/Skotty.cpp
@@ -752,7 +752,7 @@ Animation::Animation(SkString version, const SkSize& size, SkScalar fps, const J
Animation::~Animation() = default;
-void Animation::render(SkCanvas* canvas) const {
+void Animation::render(SkCanvas* canvas, const SkRect* dstR) const {
if (!fDom)
return;
@@ -760,6 +760,12 @@ void Animation::render(SkCanvas* canvas) const {
fDom->revalidate(&ic, SkMatrix::I());
// TODO: proper inval
+ SkAutoCanvasRestore restore(canvas, true);
+ const SkRect srcR = SkRect::MakeSize(this->size());
+ if (dstR) {
+ canvas->concat(SkMatrix::MakeRectToRect(srcR, *dstR, SkMatrix::kCenter_ScaleToFit));
+ }
+ canvas->clipRect(srcR);
fDom->render(canvas);
if (!fShowInval)