[skottie] Optimize opacity layerization
- plumb a RenderContext RenderNode::render() argument to track pending
opacity
- defer opacity application until we can determine whether a layer is
required (group with multiple children) or the opacity can be pushed
onto the draw paint (for single/atomic draws)
Bug: skia:
Change-Id: I962ba08bad780395d5d738307bde986e9efa502b
Reviewed-on: https://skia-review.googlesource.com/146445
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/modules/sksg/src/SkSGImage.cpp b/modules/sksg/src/SkSGImage.cpp
index d06f6be..87c686d 100644
--- a/modules/sksg/src/SkSGImage.cpp
+++ b/modules/sksg/src/SkSGImage.cpp
@@ -14,11 +14,15 @@
Image::Image(sk_sp<SkImage> image) : fImage(std::move(image)) {}
-void Image::onRender(SkCanvas* canvas) const {
+void Image::onRender(SkCanvas* canvas, const RenderContext* ctx) const {
SkPaint paint;
paint.setAntiAlias(fAntiAlias);
paint.setFilterQuality(fQuality);
+ if (ctx) {
+ ctx->modulatePaint(&paint);
+ }
+
canvas->drawImage(fImage, 0, 0, &paint);
}