aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGRenderContext.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-10-13 18:18:32 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-13 22:53:32 +0000
commite1dadd74f8a554ead3975431d6c09eb25749c904 (patch)
tree4ef0718d6809b4217d41423dc93d3832cbc5c0f0 /experimental/svg/model/SkSVGRenderContext.cpp
parent7a0ebfc033463907e2088401972d14ea8589cdb5 (diff)
[SVGDom] Add 'stroke-dashoffset' support
https://www.w3.org/TR/SVG/painting.html#StrokeDashoffsetProperty Change-Id: Ia25d0048a56ac3835cabcb4e1794d91667367d7c Reviewed-on: https://skia-review.googlesource.com/59820 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental/svg/model/SkSVGRenderContext.cpp')
-rw-r--r--experimental/svg/model/SkSVGRenderContext.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/experimental/svg/model/SkSVGRenderContext.cpp b/experimental/svg/model/SkSVGRenderContext.cpp
index 61551c4858..2b7ba2cf2c 100644
--- a/experimental/svg/model/SkSVGRenderContext.cpp
+++ b/experimental/svg/model/SkSVGRenderContext.cpp
@@ -179,14 +179,21 @@ void commitToPaint<SkSVGAttribute::kStrokeDashArray>(const SkSVGPresentationAttr
SkASSERT((intervals.count() & 1) == 0);
- // TODO: phase support
- const SkScalar phase = 0;
+ const SkScalar phase = ctx.lengthContext().resolve(*pctx->fInherited.fStrokeDashOffset.get(),
+ SkSVGLengthContext::LengthType::kOther);
pctx->fStrokePaint.setPathEffect(SkDashPathEffect::Make(intervals.begin(),
intervals.count(),
phase));
}
template <>
+void commitToPaint<SkSVGAttribute::kStrokeDashOffset>(const SkSVGPresentationAttributes&,
+ const SkSVGRenderContext&,
+ SkSVGPresentationContext*) {
+ // Applied via kStrokeDashArray.
+}
+
+template <>
void commitToPaint<SkSVGAttribute::kStrokeLineCap>(const SkSVGPresentationAttributes& attrs,
const SkSVGRenderContext&,
SkSVGPresentationContext* pctx) {
@@ -330,6 +337,7 @@ void SkSVGRenderContext::applyPresentationAttributes(const SkSVGPresentationAttr
ApplyLazyInheritedAttribute(FillRule);
ApplyLazyInheritedAttribute(ClipRule);
ApplyLazyInheritedAttribute(Stroke);
+ ApplyLazyInheritedAttribute(StrokeDashOffset);
ApplyLazyInheritedAttribute(StrokeDashArray);
ApplyLazyInheritedAttribute(StrokeLineCap);
ApplyLazyInheritedAttribute(StrokeLineJoin);