Index: experimental/svg/model/SkSVGRenderContext.cpp |
diff --git a/experimental/svg/model/SkSVGRenderContext.cpp b/experimental/svg/model/SkSVGRenderContext.cpp |
index ee92c47d542ea39744f4487e4007f8a5ed916a7c..8ad881429a21b906a3041a06753bb5b045c61757 100644 |
--- a/experimental/svg/model/SkSVGRenderContext.cpp |
+++ b/experimental/svg/model/SkSVGRenderContext.cpp |
@@ -224,6 +224,15 @@ void SkSVGRenderContext::applyPresentationAttributes(const SkSVGPresentationAttr |
ApplyLazyInheritedAttribute(StrokeWidth); |
#undef ApplyLazyInheritedAttribute |
+ |
+ // Uninherited attributes. Only apply to the current context. |
+ |
+ if (auto* opacity = attrs.fOpacity.getMaybeNull()) { |
+ SkPaint opacityPaint; |
+ opacityPaint.setAlpha(static_cast<uint8_t>(opacity->value() * 255)); |
+ // Balanced in the destructor, via restoreToCount(). |
+ fCanvas->saveLayer(nullptr, &opacityPaint); |
+ } |
} |
const SkPaint* SkSVGRenderContext::fillPaint() const { |