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

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: pic/serialize blacklist 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') | infra/bots/recipes/swarm_test.py » ('j') | 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..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 {
« no previous file with comments | « experimental/svg/model/SkSVGNode.cpp ('k') | infra/bots/recipes/swarm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698