diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-07-01 15:50:00 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2016-07-07 22:32:39 +0200 |
commit | 5046ebd813b2c155698f9664b629ca5587b8a28b (patch) | |
tree | 3d02ce162784684465e06c5382143c89e4d9b14c /vcl/win | |
parent | 4609380bb0bde0d4437b72b752c1c24ee2950361 (diff) |
tdf#82214 optimize PatternFillPrimitive and SVG
Use buffering in the drawinglayer, and don't do slow stuff in the
windows gdi renderer.
Conflicts:
svgio/source/svgreader/svgstyleattributes.cxx
Change-Id: Id955ee6a3b03e568c2678f02d77af35d2e5ba1d4
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/gdi/gdiimpl.cxx | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 3728755cb756..09c63f554799 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -1896,10 +1896,9 @@ bool WinSalGraphicsImpl::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt } void impAddB2DPolygonToGDIPlusGraphicsPathReal( - Gdiplus::GpPath *pPath, + Gdiplus::GraphicsPath& rGraphicsPath, const basegfx::B2DPolygon& rPolygon, - bool bNoLineJoin, - const basegfx::B2DVector* pLineWidths) + bool bNoLineJoin) { sal_uInt32 nCount(rPolygon.count()); @@ -1941,43 +1940,17 @@ void impAddB2DPolygonToGDIPlusGraphicsPathReal( aCb = aNext + ((aCa - aNext) * 0.3); } - Gdiplus::DllExports::GdipAddPathBezier( - pPath, - aCurr.getX(), aCurr.getY(), - aCa.getX(), aCa.getY(), - aCb.getX(), aCb.getY(), - aNext.getX(), aNext.getY()); + rGraphicsPath.AddBezier( + static_cast< Gdiplus::REAL >(aCurr.getX()), static_cast< Gdiplus::REAL >(aCurr.getY()), + static_cast< Gdiplus::REAL >(aCa.getX()), static_cast< Gdiplus::REAL >(aCa.getY()), + static_cast< Gdiplus::REAL >(aCb.getX()), static_cast< Gdiplus::REAL >(aCb.getY()), + static_cast< Gdiplus::REAL >(aNext.getX()), static_cast< Gdiplus::REAL >(aNext.getY())); } else { - if(pLineWidths && aCurr.equal(aNext)) - { - // For lines with no length Gdiplus unfortunately paints nothing, - // independent of LineCaps being set. This differs from e.g. SVG - // and other systems. To get geometry created, add some offset, - // based on line width to have something relative to current metrics - if(!basegfx::fTools::equalZero(pLineWidths->getX())) - { - Gdiplus::DllExports::GdipAddPathLine( - pPath, - aCurr.getX(), aCurr.getY(), - aNext.getX() + (pLineWidths->getX() * 0.1), aNext.getY()); - } - else - { - Gdiplus::DllExports::GdipAddPathLine( - pPath, - aCurr.getX(), aCurr.getY(), - aNext.getX(), aNext.getY() + (pLineWidths->getY() * 0.1)); - } - } - else - { - Gdiplus::DllExports::GdipAddPathLine( - pPath, - aCurr.getX(), aCurr.getY(), - aNext.getX(), aNext.getY()); - } + rGraphicsPath.AddLine( + static_cast< Gdiplus::REAL >(aCurr.getX()), static_cast< Gdiplus::REAL >(aCurr.getY()), + static_cast< Gdiplus::REAL >(aNext.getX()), static_cast< Gdiplus::REAL >(aNext.getY())); } if(a + 1 < nEdgeCount) @@ -1986,7 +1959,7 @@ void impAddB2DPolygonToGDIPlusGraphicsPathReal( if(bNoLineJoin) { - Gdiplus::DllExports::GdipStartPathFigure(pPath); + rGraphicsPath.StartFigure(); } } } @@ -2014,8 +1987,9 @@ bool WinSalGraphicsImpl::drawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPo aGraphicsPath.StartFigure(); } - impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolyPolygon.getB2DPolygon(a), false, 0); - Gdiplus::DllExports::GdipClosePathFigure(pPath); + impAddB2DPolygonToGDIPlusGraphicsPathReal(aGraphicsPath, rPolyPolygon.getB2DPolygon(a), false); + + aGraphicsPath.CloseFigure(); } if(mrParent.getAntiAliasB2DDraw()) @@ -2127,7 +2101,7 @@ bool WinSalGraphicsImpl::drawPolyLine( } } - impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolygon, bNoLineJoin, &rLineWidths); + impAddB2DPolygonToGDIPlusGraphicsPathReal(aGraphicsPath, rPolygon, bNoLineJoin); if(rPolygon.isClosed() && !bNoLineJoin) { |