aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGRenderContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/svg/model/SkSVGRenderContext.cpp')
-rw-r--r--experimental/svg/model/SkSVGRenderContext.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/experimental/svg/model/SkSVGRenderContext.cpp b/experimental/svg/model/SkSVGRenderContext.cpp
index ee92c47d54..8ad881429a 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 {