diff options
author | 2016-12-01 13:35:11 -0500 | |
---|---|---|
committer | 2016-12-06 16:05:41 +0000 | |
commit | e932d4b3a99905a6272c5574f21ac651632f4e82 (patch) | |
tree | 667289b43423b6183ac76eb657b32aef201b1b13 /experimental/svg/model/SkSVGNode.cpp | |
parent | ebe79ffd8627e3fea945a82895e64cede4ec21bf (diff) |
[SVGDom] Add fill-rule support
There's a bit of friction with this attribute, because per spec it is
an inherited presentation attribute, but in Skia it is part of the
actual SkPath state.
So we must add some plumbing to SkSVGShape & friends to allow overriding
the fill type at render-time.
R=robertphillips@google.com,stephana@google.com
Change-Id: I9c926d653c6211beb3914bffac50d4349dbdd2c0
Reviewed-on: https://skia-review.googlesource.com/5415
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental/svg/model/SkSVGNode.cpp')
-rw-r--r-- | experimental/svg/model/SkSVGNode.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/experimental/svg/model/SkSVGNode.cpp b/experimental/svg/model/SkSVGNode.cpp index f40ee5dadb..a5c8147554 100644 --- a/experimental/svg/model/SkSVGNode.cpp +++ b/experimental/svg/model/SkSVGNode.cpp @@ -49,6 +49,10 @@ void SkSVGNode::setFillOpacity(const SkSVGNumberType& opacity) { SkSVGNumberType(SkTPin<SkScalar>(opacity.value(), 0, 1))); } +void SkSVGNode::setFillRule(const SkSVGFillRule& fillRule) { + fPresentationAttributes.fFillRule.set(fillRule); +} + void SkSVGNode::setOpacity(const SkSVGNumberType& opacity) { fPresentationAttributes.fOpacity.set( SkSVGNumberType(SkTPin<SkScalar>(opacity.value(), 0, 1))); @@ -79,6 +83,11 @@ void SkSVGNode::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) { this->setFillOpacity(*opacity); } break; + case SkSVGAttribute::kFillRule: + if (const SkSVGFillRuleValue* fillRule = v.as<SkSVGFillRuleValue>()) { + this->setFillRule(*fillRule); + } + break; case SkSVGAttribute::kOpacity: if (const SkSVGNumberValue* opacity = v.as<SkSVGNumberValue>()) { this->setOpacity(*opacity); |