[skottie] Add RenderFlag::kDisableTopLevelClipping
TBR=
Change-Id: If63d27eb13176697665f0d081542eae0f7afea9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304476
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/modules/skottie/include/Skottie.h b/modules/skottie/include/Skottie.h
index c519068..2af144c 100644
--- a/modules/skottie/include/Skottie.h
+++ b/modules/skottie/include/Skottie.h
@@ -160,7 +160,11 @@
// When rendering into a known transparent buffer, clients can pass
// this flag to avoid some unnecessary compositing overhead for
// animations using layer blend modes.
- kSkipTopLevelIsolation = 0x01,
+ kSkipTopLevelIsolation = 0x01,
+ // By default, content is clipped to the intrinsic animation
+ // bounds (as determined by its size). If this flag is set,
+ // then the animation can draw outside of the bounds.
+ kDisableTopLevelClipping = 0x02,
};
using RenderFlags = uint32_t;
diff --git a/modules/skottie/src/Skottie.cpp b/modules/skottie/src/Skottie.cpp
index e3b9c78..9f6471c 100644
--- a/modules/skottie/src/Skottie.cpp
+++ b/modules/skottie/src/Skottie.cpp
@@ -473,7 +473,9 @@
canvas->concat(SkMatrix::MakeRectToRect(srcR, *dstR, SkMatrix::kCenter_ScaleToFit));
}
- canvas->clipRect(srcR);
+ if (!(renderFlags & RenderFlag::kDisableTopLevelClipping)) {
+ canvas->clipRect(srcR);
+ }
if ((fFlags & Flags::kRequiresTopLevelIsolation) &&
!(renderFlags & RenderFlag::kSkipTopLevelIsolation)) {