diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2016-04-09 23:15:09 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-04-26 16:42:27 +0000 |
commit | 32cec4ca8bf1e09dd33aa461984e8e8ae34f4a7c (patch) | |
tree | 5591a63de12179505a0e7a4870632754585152d3 /drawinglayer | |
parent | early bail out if nGlobalError, tdf#97831 follow-up (diff) | |
download | core-32cec4ca8bf1e09dd33aa461984e8e8ae34f4a7c.tar.gz core-32cec4ca8bf1e09dd33aa461984e8e8ae34f4a7c.zip |
tdf#48066 render stroke-miterlimit correctly in SVG import
The property stroke-miterlimit is transported to the renderers
via a new member mfMiterMinimumAngle in class LineAttribute
Several drawPolyLine methods are adapted. This patch does not
include changes in MetaAction. Presentation mode, printing, and
PDF-export is still wrong.
Corrected LineJoinMiter to LineJoinBevel in canvas, that s closer
to NONE. Removed DrawPolyLine method without MiterMinimumAngle
and adapted calls accordingly.
Change-Id: I6bcd24add5d85c4d9a39e3788e0682091c5fc9c4
Reviewed-on: https://gerrit.libreoffice.org/23946
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'drawinglayer')
4 files changed, 29 insertions, 9 deletions
diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx index 5e720fbd6969..89ce998924fe 100644 --- a/drawinglayer/source/attribute/lineattribute.cxx +++ b/drawinglayer/source/attribute/lineattribute.cxx @@ -34,16 +34,19 @@ namespace drawinglayer double mfWidth; // absolute line width basegfx::B2DLineJoin meLineJoin; // type of LineJoin css::drawing::LineCap meLineCap; // BUTT, ROUND, or SQUARE + double mfMiterMinimumAngle; // as needed for createAreaGeometry ImpLineAttribute( const basegfx::BColor& rColor, double fWidth, basegfx::B2DLineJoin aB2DLineJoin, - css::drawing::LineCap aLineCap) + css::drawing::LineCap aLineCap, + double fMiterMinimumAngle) : maColor(rColor), mfWidth(fWidth), meLineJoin(aB2DLineJoin), - meLineCap(aLineCap) + meLineCap(aLineCap), + mfMiterMinimumAngle(fMiterMinimumAngle) { } @@ -51,7 +54,8 @@ namespace drawinglayer : maColor(basegfx::BColor()), mfWidth(0.0), meLineJoin(basegfx::B2DLineJoin::Round), - meLineCap(css::drawing::LineCap_BUTT) + meLineCap(css::drawing::LineCap_BUTT), + mfMiterMinimumAngle(15.0 * F_PI180) { } @@ -60,13 +64,15 @@ namespace drawinglayer double getWidth() const { return mfWidth; } basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } css::drawing::LineCap getLineCap() const { return meLineCap; } + double getMiterMinimumAngle() const { return mfMiterMinimumAngle; } bool operator==(const ImpLineAttribute& rCandidate) const { return (getColor() == rCandidate.getColor() && getWidth() == rCandidate.getWidth() && getLineJoin() == rCandidate.getLineJoin() - && getLineCap() == rCandidate.getLineCap()); + && getLineCap() == rCandidate.getLineCap() + && getMiterMinimumAngle() == rCandidate.getMiterMinimumAngle()); } }; @@ -80,13 +86,15 @@ namespace drawinglayer const basegfx::BColor& rColor, double fWidth, basegfx::B2DLineJoin aB2DLineJoin, - css::drawing::LineCap aLineCap) + css::drawing::LineCap aLineCap, + double fMiterMinimumAngle) : mpLineAttribute( ImpLineAttribute( rColor, fWidth, aB2DLineJoin, - aLineCap)) + aLineCap, + fMiterMinimumAngle)) { } @@ -144,6 +152,11 @@ namespace drawinglayer return mpLineAttribute->getLineCap(); } + double LineAttribute::getMiterMinimumAngle() const + { + return mpLineAttribute->getMiterMinimumAngle(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index ddc83d02d670..76fc498d34d5 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -252,6 +252,7 @@ namespace drawinglayer const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin()); const css::drawing::LineCap aLineCap(getLineAttribute().getLineCap()); basegfx::B2DPolyPolygon aAreaPolyPolygon; + const double fMiterMinimumAngle(getLineAttribute().getMiterMinimumAngle()); for(sal_uInt32 a(0L); a < nCount; a++) { @@ -260,7 +261,10 @@ namespace drawinglayer aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin, - aLineCap)); + aLineCap, + 12.5 * F_PI180 /* default fMaxAllowedAngle*/ , + 0.4 /* default fMaxPartOfEdge*/ , + fMiterMinimumAngle)); } // prepare return value diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 7b18c5900068..f3b08ec5795b 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -259,7 +259,9 @@ namespace drawinglayer fLineWidth, fTransparency, rSource.getLineAttribute().getLineJoin(), - rSource.getLineAttribute().getLineCap())) + rSource.getLineAttribute().getLineCap(), + rSource.getLineAttribute().getMiterMinimumAngle(), + false /*bBypassAACheck, default*/)) { bTryWorked = true; } diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index e6ce0f59fc43..f5d24cf001cb 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1301,7 +1301,8 @@ namespace drawinglayer aHairlinePolyPolygon.getB2DPolygon(a), fDiscreteLineWidth, rLineAttribute.getLineJoin(), - rLineAttribute.getLineCap()); + rLineAttribute.getLineCap(), + rLineAttribute.getMiterMinimumAngle()); } bDone = true; |