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 /canvas | |
parent | 4905c8bf7834b1ca79139c62f4e8b0672e9ddc13 (diff) |
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 'canvas')
-rw-r--r-- | canvas/source/directx/dx_canvashelper.cxx | 9 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper.cxx | 16 |
2 files changed, 19 insertions, 6 deletions
diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index be53b374f291..8ca63ecc4238 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -75,10 +75,13 @@ namespace dxcanvas switch( nJoinType ) { case rendering::PathJoinType::NONE: - SAL_WARN( "canvas.directx", "gdiJoinFromJoin(): Join NONE not possible, mapping to MITER" ); - // FALLTHROUGH intended + SAL_WARN( "canvas.directx", "gdiJoinFromJoin(): Join NONE not possible, mapping to BEVEL (closest to NONE)" ); + return Gdiplus::LineJoinBevel; + case rendering::PathJoinType::MITER: - return Gdiplus::LineJoinMiter; + // in GDI+ fallback to Bevel, if miter limit is exceeded, is not done + // by Gdiplus::LineJoinMiter but by Gdiplus::LineJoinMiterClipped + return Gdiplus::LineJoinMiterClipped; case rendering::PathJoinType::ROUND: return Gdiplus::LineJoinRound; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 82ee7704da22..b294b73503f3 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -390,8 +390,15 @@ namespace vclcanvas for( sal_uInt32 i=0; i<aPolyPoly.count(); ++i ) { - // TODO(F2): Use MiterLimit from StrokeAttributes, - // need to convert it here to angle. + double fMiterMinimumAngle; + if (strokeAttributes.MiterLimit <= 1.0) + { + fMiterMinimumAngle = F_PI2; + } + else + { + fMiterMinimumAngle = 2.0 * asin(1.0/strokeAttributes.MiterLimit); + } // TODO(F2): Also use Cap settings from // StrokeAttributes, the @@ -403,7 +410,10 @@ namespace vclcanvas aPolyPoly.getB2DPolygon(i), strokeAttributes.StrokeWidth*0.5, b2DJoineFromJoin(strokeAttributes.JoinType), - unoCapeFromCap(strokeAttributes.StartCapType) + unoCapeFromCap(strokeAttributes.StartCapType), + 12.5 * F_PI180 /* default fMaxAllowedAngle*/ , + 0.4 /* default fMaxPartOfEdge*/ , + fMiterMinimumAngle )); //aStrokedPolyPoly.append( // ::basegfx::tools::createAreaGeometryForPolygon( aPolyPoly.getB2DPolygon(i), |