diff options
-rw-r--r-- | experimental/svg/model/SkSVGAttribute.cpp | 1 | ||||
-rw-r--r-- | experimental/svg/model/SkSVGAttribute.h | 2 | ||||
-rw-r--r-- | experimental/svg/model/SkSVGDOM.cpp | 1 | ||||
-rw-r--r-- | experimental/svg/model/SkSVGNode.cpp | 5 | ||||
-rw-r--r-- | experimental/svg/model/SkSVGRenderContext.cpp | 9 |
5 files changed, 18 insertions, 0 deletions
diff --git a/experimental/svg/model/SkSVGAttribute.cpp b/experimental/svg/model/SkSVGAttribute.cpp index 4935d6afcf..6d318ca2f2 100644 --- a/experimental/svg/model/SkSVGAttribute.cpp +++ b/experimental/svg/model/SkSVGAttribute.cpp @@ -17,6 +17,7 @@ SkSVGPresentationAttributes SkSVGPresentationAttributes::MakeInitial() { result.fStroke.set(SkSVGPaint(SkSVGPaint::Type::kNone)); result.fStrokeLineCap.set(SkSVGLineCap(SkSVGLineCap::Type::kButt)); result.fStrokeLineJoin.set(SkSVGLineJoin(SkSVGLineJoin::Type::kMiter)); + result.fStrokeMiterLimit.set(SkSVGNumberType(4)); result.fStrokeOpacity.set(SkSVGNumberType(1)); result.fStrokeWidth.set(SkSVGLength(1)); diff --git a/experimental/svg/model/SkSVGAttribute.h b/experimental/svg/model/SkSVGAttribute.h index 084fcc0290..6c88326420 100644 --- a/experimental/svg/model/SkSVGAttribute.h +++ b/experimental/svg/model/SkSVGAttribute.h @@ -39,6 +39,7 @@ enum class SkSVGAttribute { kStrokeOpacity, kStrokeLineCap, kStrokeLineJoin, + kStrokeMiterLimit, kStrokeWidth, kTransform, kViewBox, @@ -65,6 +66,7 @@ struct SkSVGPresentationAttributes { SkTLazy<SkSVGPaint> fStroke; SkTLazy<SkSVGLineCap> fStrokeLineCap; SkTLazy<SkSVGLineJoin> fStrokeLineJoin; + SkTLazy<SkSVGNumberType> fStrokeMiterLimit; SkTLazy<SkSVGNumberType> fStrokeOpacity; SkTLazy<SkSVGLength> fStrokeWidth; diff --git a/experimental/svg/model/SkSVGDOM.cpp b/experimental/svg/model/SkSVGDOM.cpp index c2f8fc5116..70db9330a4 100644 --- a/experimental/svg/model/SkSVGDOM.cpp +++ b/experimental/svg/model/SkSVGDOM.cpp @@ -302,6 +302,7 @@ SortedDictionaryEntry<AttrParseInfo> gAttributeParseInfo[] = { { "stroke" , { SkSVGAttribute::kStroke , SetPaintAttribute }}, { "stroke-linecap" , { SkSVGAttribute::kStrokeLineCap , SetLineCapAttribute }}, { "stroke-linejoin" , { SkSVGAttribute::kStrokeLineJoin , SetLineJoinAttribute }}, + { "stroke-miterlimit", { SkSVGAttribute::kStrokeMiterLimit , SetNumberAttribute }}, { "stroke-opacity" , { SkSVGAttribute::kStrokeOpacity , SetNumberAttribute }}, { "stroke-width" , { SkSVGAttribute::kStrokeWidth , SetLengthAttribute }}, { "style" , { SkSVGAttribute::kUnknown , SetStyleAttributes }}, diff --git a/experimental/svg/model/SkSVGNode.cpp b/experimental/svg/model/SkSVGNode.cpp index 0f3743ffd2..46d6423af2 100644 --- a/experimental/svg/model/SkSVGNode.cpp +++ b/experimental/svg/model/SkSVGNode.cpp @@ -139,6 +139,11 @@ void SkSVGNode::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) { fPresentationAttributes.fStrokeLineJoin.set(*lineJoin); } break; + case SkSVGAttribute::kStrokeMiterLimit: + if (const SkSVGNumberValue* miterLimit = v.as<SkSVGNumberValue>()) { + fPresentationAttributes.fStrokeMiterLimit.set(*miterLimit); + } + break; case SkSVGAttribute::kStrokeWidth: if (const SkSVGLengthValue* strokeWidth = v.as<SkSVGLengthValue>()) { this->setStrokeWidth(*strokeWidth); diff --git a/experimental/svg/model/SkSVGRenderContext.cpp b/experimental/svg/model/SkSVGRenderContext.cpp index 9de605a034..f071d9696f 100644 --- a/experimental/svg/model/SkSVGRenderContext.cpp +++ b/experimental/svg/model/SkSVGRenderContext.cpp @@ -174,6 +174,13 @@ void commitToPaint<SkSVGAttribute::kStrokeLineJoin>(const SkSVGPresentationAttri } template <> +void commitToPaint<SkSVGAttribute::kStrokeMiterLimit>(const SkSVGPresentationAttributes& attrs, + const SkSVGRenderContext&, + SkSVGPresentationContext* pctx) { + pctx->fStrokePaint.setStrokeMiter(*attrs.fStrokeMiterLimit.get()); +} + +template <> void commitToPaint<SkSVGAttribute::kStrokeOpacity>(const SkSVGPresentationAttributes& attrs, const SkSVGRenderContext&, SkSVGPresentationContext* pctx) { @@ -218,6 +225,7 @@ SkSVGPresentationContext::SkSVGPresentationContext() commitToPaint<SkSVGAttribute::kStroke>(fInherited, dummy, this); commitToPaint<SkSVGAttribute::kStrokeLineCap>(fInherited, dummy, this); commitToPaint<SkSVGAttribute::kStrokeLineJoin>(fInherited, dummy, this); + commitToPaint<SkSVGAttribute::kStrokeMiterLimit>(fInherited, dummy, this); commitToPaint<SkSVGAttribute::kStrokeOpacity>(fInherited, dummy, this); commitToPaint<SkSVGAttribute::kStrokeWidth>(fInherited, dummy, this); } @@ -270,6 +278,7 @@ void SkSVGRenderContext::applyPresentationAttributes(const SkSVGPresentationAttr ApplyLazyInheritedAttribute(Stroke); ApplyLazyInheritedAttribute(StrokeLineCap); ApplyLazyInheritedAttribute(StrokeLineJoin); + ApplyLazyInheritedAttribute(StrokeMiterLimit); ApplyLazyInheritedAttribute(StrokeOpacity); ApplyLazyInheritedAttribute(StrokeWidth); |