aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGNode.cpp
diff options
context:
space:
mode:
authorGravatar fmalita <fmalita@chromium.org>2016-08-15 12:45:11 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-15 12:45:11 -0700
commit6fb0648c35aead138e65133c031d2b4fe5c8f0c7 (patch)
tree20dc5450da40f37e1e68e1ade072ee81c456939a /experimental/svg/model/SkSVGNode.cpp
parentd39430d0574513438b5831947052353290204a06 (diff)
[SVGDom] Add opacity support
Group opacity support. Unlike the other presentation attributes we support thus far, group opacity is not inherited. R=robertphillips@google.com,stephana@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2246943002 Review-Url: https://codereview.chromium.org/2246943002
Diffstat (limited to 'experimental/svg/model/SkSVGNode.cpp')
-rw-r--r--experimental/svg/model/SkSVGNode.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/experimental/svg/model/SkSVGNode.cpp b/experimental/svg/model/SkSVGNode.cpp
index a039b59ff1..5a73ace548 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);