aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGNode.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-10-13 14:07:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-13 19:14:39 +0000
commitf543a60ef06a6b0ccb5a0a85ca5415021c81c9ee (patch)
treef2a3d3dd48e360e045e01385d86fa7833de20d3b /experimental/svg/model/SkSVGNode.cpp
parent770db22a553e87d6f3e40db72c5871b1d8a9ec91 (diff)
[SVGDom] Add 'stroke-dasharray' support
https://www.w3.org/TR/SVG/painting.html#StrokeDasharrayProperty Change-Id: I9a63ebbd958d661c865ed405570b86cca68f63bf Reviewed-on: https://skia-review.googlesource.com/59700 Commit-Queue: Florin Malita <fmalita@chromium.org> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'experimental/svg/model/SkSVGNode.cpp')
-rw-r--r--experimental/svg/model/SkSVGNode.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/experimental/svg/model/SkSVGNode.cpp b/experimental/svg/model/SkSVGNode.cpp
index ddde838f8e..07dc59c645 100644
--- a/experimental/svg/model/SkSVGNode.cpp
+++ b/experimental/svg/model/SkSVGNode.cpp
@@ -90,6 +90,10 @@ void SkSVGNode::setStroke(const SkSVGPaint& svgPaint) {
fPresentationAttributes.fStroke.set(svgPaint);
}
+void SkSVGNode::setStrokeDashArray(const SkSVGDashArray& dashArray) {
+ fPresentationAttributes.fStrokeDashArray.set(dashArray);
+}
+
void SkSVGNode::setStrokeOpacity(const SkSVGNumberType& opacity) {
fPresentationAttributes.fStrokeOpacity.set(
SkSVGNumberType(SkTPin<SkScalar>(opacity.value(), 0, 1)));
@@ -140,6 +144,11 @@ void SkSVGNode::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
this->setStroke(*paint);
}
break;
+ case SkSVGAttribute::kStrokeDashArray:
+ if (const SkSVGDashArrayValue* dashArray = v.as<SkSVGDashArrayValue>()) {
+ this->setStrokeDashArray(*dashArray);
+ }
+ break;
case SkSVGAttribute::kStrokeOpacity:
if (const SkSVGNumberValue* opacity = v.as<SkSVGNumberValue>()) {
this->setStrokeOpacity(*opacity);