[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>
This commit is contained in:
Florin Malita 2020-07-20 22:09:41 -04:00 committed by Skia Commit-Bot
parent c1eb58de32
commit a09b05c27a
2 changed files with 8 additions and 2 deletions

View File

@ -160,7 +160,11 @@ public:
// 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;

View File

@ -473,7 +473,9 @@ void Animation::render(SkCanvas* canvas, const SkRect* dstR, RenderFlags renderF
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)) {