add skotty-dir slide
Shows a directory of skotties in a grid
Bug: skia:
Change-Id: I96b0700d8809c94a394cf517222123967afb20dc
Reviewed-on: https://skia-review.googlesource.com/91407
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/experimental/skotty/Skotty.cpp b/experimental/skotty/Skotty.cpp
index a13a04c..84cc080 100644
--- a/experimental/skotty/Skotty.cpp
+++ b/experimental/skotty/Skotty.cpp
@@ -752,7 +752,7 @@
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 @@
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)