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 /vcl/opengl | |
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 'vcl/opengl')
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index b8d6fb6d9c73..8bb2c1dbe978 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -684,8 +684,6 @@ inline glm::vec2 normalize(const glm::vec2& vector) return vector; } -SAL_CONSTEXPR float constMiterMinimumAngle = 15.0f; - } // end anonymous namespace void OpenGLSalGraphicsImpl::DrawLineCap(float x1, float y1, float x2, float y2, css::drawing::LineCap eLineCap, float fLineWidth) @@ -769,7 +767,7 @@ void OpenGLSalGraphicsImpl::DrawLineSegment(float x1, float y1, float x2, float * - http://artgrammer.blogspot.si/2011/07/drawing-polylines-by-tessellation.html * */ -void OpenGLSalGraphicsImpl::DrawPolyLine(const basegfx::B2DPolygon& rPolygon, float fLineWidth, basegfx::B2DLineJoin eLineJoin, css::drawing::LineCap eLineCap) +void OpenGLSalGraphicsImpl::DrawPolyLine(const basegfx::B2DPolygon& rPolygon, float fLineWidth, basegfx::B2DLineJoin eLineJoin, css::drawing::LineCap eLineCap, float fMiterMinimumAngle) { sal_uInt32 nPoints = rPolygon.count(); bool bClosed = rPolygon.isClosed(); @@ -871,9 +869,9 @@ void OpenGLSalGraphicsImpl::DrawPolyLine(const basegfx::B2DPolygon& rPolygon, fl float angle = std::atan2(previousLineVector.x * nextLineVector.y - previousLineVector.y * nextLineVector.x, previousLineVector.x * nextLineVector.x + previousLineVector.y * nextLineVector.y); - angle = (F_PI - std::fabs(angle)) / F_PI180; + angle = F_PI - std::fabs(angle); - if (angle < constMiterMinimumAngle) + if (angle < fMiterMinimumAngle) eLineJoin = basegfx::B2DLineJoin::Bevel; } @@ -2060,7 +2058,8 @@ bool OpenGLSalGraphicsImpl::drawPolyLine( double fTransparency, const basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin, - css::drawing::LineCap eLineCap) + css::drawing::LineCap eLineCap, + double fMiterMinimumAngle) { VCL_GL_INFO( "::drawPolyLine trans " << fTransparency ); if( mnLineColor == SALCOLOR_NONE ) @@ -2080,7 +2079,7 @@ bool OpenGLSalGraphicsImpl::drawPolyLine( else aPolygon.removeDoublePoints(); - DrawPolyLine(aPolygon, fLineWidth, eLineJoin, eLineCap); + DrawPolyLine(aPolygon, fLineWidth, eLineJoin, eLineCap, fMiterMinimumAngle); } PostDraw(); |