[skottie] Fix wipe effects for images
Two issues:
1) mask shaders are ignored of drawImage; force application via a layer
2) visibility control clashes with layer controller; force a
transparent shader for now
TBR=
Change-Id: Ic9a86c87db043745fa9f829ef36706525570a3be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299874
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
diff --git a/modules/skottie/src/effects/LinearWipeEffect.cpp b/modules/skottie/src/effects/LinearWipeEffect.cpp
index abf4668..713f97e 100644
--- a/modules/skottie/src/effects/LinearWipeEffect.cpp
+++ b/modules/skottie/src/effects/LinearWipeEffect.cpp
@@ -54,7 +54,8 @@
MaskInfo onMakeMask() const override {
if (fCompletion >= 100) {
// The layer is fully disabled.
- return { nullptr, false };
+ // TODO: fix layer controller visibility clash and pass a null shader instead.
+ return { SkShaders::Color(SK_ColorTRANSPARENT), false };
}
if (fCompletion <= 0) {
diff --git a/modules/skottie/src/effects/VenetianBlindsEffect.cpp b/modules/skottie/src/effects/VenetianBlindsEffect.cpp
index f761ec2..f21271b 100644
--- a/modules/skottie/src/effects/VenetianBlindsEffect.cpp
+++ b/modules/skottie/src/effects/VenetianBlindsEffect.cpp
@@ -52,7 +52,8 @@
MaskInfo onMakeMask() const override {
if (fCompletion >= 100) {
// The layer is fully disabled.
- return { nullptr, false };
+ // TODO: fix layer controller visibility clash and pass a null shader instead.
+ return { SkShaders::Color(SK_ColorTRANSPARENT), false };
}
if (fCompletion <= 0) {
diff --git a/modules/sksg/src/SkSGImage.cpp b/modules/sksg/src/SkSGImage.cpp
index 0b5e86b..5cd00aa 100644
--- a/modules/sksg/src/SkSGImage.cpp
+++ b/modules/sksg/src/SkSGImage.cpp
@@ -23,8 +23,14 @@
paint.setAntiAlias(fAntiAlias);
paint.setFilterQuality(fQuality);
+ sksg::RenderNode::ScopedRenderContext local_ctx(canvas, ctx);
if (ctx) {
- ctx->modulatePaint(canvas->getTotalMatrix(), &paint);
+ if (ctx->fMaskShader) {
+ // Mask shaders cannot be applied via drawImage - we need layer isolation.
+ // TODO: remove after clipShader conversion.
+ local_ctx.setIsolation(this->bounds(), canvas->getTotalMatrix(), true);
+ }
+ local_ctx->modulatePaint(canvas->getTotalMatrix(), &paint);
}
canvas->drawImage(fImage, 0, 0, &paint);