diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-08 11:54:40 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-08 13:33:45 +0200 |
commit | 6dd0074e5e42467a7f82e363f67ca95d04466fa9 (patch) | |
tree | 1d49fbcd2db125036c6b422ffbad4c6acb5916fe /svgio/source | |
parent | a4acae686c2c55b18b5c27e832827d3c2d8e0f63 (diff) |
tdf#149913: add support for auto-start-reverse
See https://svgwg.org/svg2-draft/painting.html#OrientAttribute
Change-Id: Iedcca7bc79a54333c0f80927364caec82ce61167
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136894
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/svgmarkernode.cxx | 8 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 13 |
2 files changed, 16 insertions, 5 deletions
diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx index 0c2ea6a7a50e..21223c918032 100644 --- a/svgio/source/svgreader/svgmarkernode.cxx +++ b/svgio/source/svgreader/svgmarkernode.cxx @@ -33,7 +33,7 @@ namespace svgio::svgreader maMarkerWidth(3), maMarkerHeight(3), mfAngle(0.0), - mbOrientAuto(false) + maMarkerOrient(MarkerOrient::notset) { } @@ -146,7 +146,11 @@ namespace svgio::svgreader { if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"auto")) { - mbOrientAuto = true; + setMarkerOrient(MarkerOrient::auto_start); + } + if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"auto-start-reverse")) + { + setMarkerOrient(MarkerOrient::auto_start_reverse); } else { diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 9e0e24b0e1a0..70b019594248 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -998,7 +998,8 @@ namespace svgio::svgreader basegfx::B2DHomMatrix aCombinedTransform(aPreparedMarkerTransform); // get rotation - if(pPrepared->getOrientAuto()) + if(pPrepared->getMarkerOrient() == SvgMarkerNode::MarkerOrient::auto_start || + pPrepared->getMarkerOrient() == SvgMarkerNode::MarkerOrient::auto_start_reverse) { const sal_uInt32 nPointIndex(b % nSubPolygonPointCount); @@ -1027,12 +1028,18 @@ namespace svgio::svgreader if(bEntering) { - aSum += aEntering.normalize(); + if(bIsFirstMarker && pPrepared->getMarkerOrient() == SvgMarkerNode::MarkerOrient::auto_start_reverse) + aSum -= aEntering.normalize(); + else + aSum += aEntering.normalize(); } if(bLeaving) { - aSum += aLeaving.normalize(); + if(bIsFirstMarker && pPrepared->getMarkerOrient() == SvgMarkerNode::MarkerOrient::auto_start_reverse) + aSum -= aLeaving.normalize(); + else + aSum += aLeaving.normalize(); } if(!aSum.equalZero()) |