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

Unified Diff: experimental/svg/model/SkSVGNode.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.h ('k') | experimental/svg/model/SkSVGRenderContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGNode.cpp
diff --git a/experimental/svg/model/SkSVGNode.cpp b/experimental/svg/model/SkSVGNode.cpp
index a039b59ff16865a5df70c8c30e2bdac3f9f69262..5a73ace548cfd71b1d2879bca7538a2e94616e6f 100644
--- a/experimental/svg/model/SkSVGNode.cpp
+++ b/experimental/svg/model/SkSVGNode.cpp
@@ -42,6 +42,11 @@ void SkSVGNode::setFillOpacity(const SkSVGNumberType& opacity) {
SkSVGNumberType(SkTPin<SkScalar>(opacity.value(), 0, 1)));
}
+void SkSVGNode::setOpacity(const SkSVGNumberType& opacity) {
+ fPresentationAttributes.fOpacity.set(
+ SkSVGNumberType(SkTPin<SkScalar>(opacity.value(), 0, 1)));
+}
+
void SkSVGNode::setStroke(const SkSVGPaint& svgPaint) {
fPresentationAttributes.fStroke.set(svgPaint);
}
@@ -67,6 +72,11 @@ void SkSVGNode::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
this->setFillOpacity(*opacity);
}
break;
+ case SkSVGAttribute::kOpacity:
+ if (const SkSVGNumberValue* opacity = v.as<SkSVGNumberValue>()) {
+ this->setOpacity(*opacity);
+ }
+ break;
case SkSVGAttribute::kStroke:
if (const SkSVGPaintValue* paint = v.as<SkSVGPaintValue>()) {
this->setStroke(*paint);
« no previous file with comments | « experimental/svg/model/SkSVGNode.h ('k') | experimental/svg/model/SkSVGRenderContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698