Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: experimental/svg/model/SkSVGRenderContext.cpp

Issue 2246943002: [SVGDom] Add opacity support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/svg/model/SkSVGNode.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGRenderContext.cpp
diff --git a/experimental/svg/model/SkSVGRenderContext.cpp b/experimental/svg/model/SkSVGRenderContext.cpp
index ee92c47d542ea39744f4487e4007f8a5ed916a7c..82ee2c78a5be7d5f98a3d3690a153fbbc0753d27 100644
--- a/experimental/svg/model/SkSVGRenderContext.cpp
+++ b/experimental/svg/model/SkSVGRenderContext.cpp
@@ -224,6 +224,14 @@ 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));
+ fCanvas->saveLayer(nullptr, &opacityPaint);
robertphillips 2016/08/15 17:31:27 Where is the matching restore ?
f(malita) 2016/08/15 17:33:58 SkSVGRenderContext is node-scoped and always resto
robertphillips 2016/08/15 17:37:54 Ah - okay. Can you add that as a comment? It wasn'
f(malita) 2016/08/15 17:41:22 Done.
+ }
}
const SkPaint* SkSVGRenderContext::fillPaint() const {
« no previous file with comments | « experimental/svg/model/SkSVGNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698