summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2017-04-09 19:09:35 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2017-04-13 18:30:37 +0200
commit572663345531f8485b783f7d80bf51836550b8c4 (patch)
treef4459d2610741b51527fac4aae787a00a0a3855a /cppcanvas
parentfcb32f1cbc335a953cea62f66b9f50170263fb56 (diff)
tdf#39053 EMF+ Draw an extra line between the last point and the first point.
The EmfPlusDrawlLines record specifies drawing a series of connected lines. Bit 0x2000 indicates whether to draw an extra line between the last point and the first point, to close the shape. In this commit support of additional line which close shape was added. Change-Id: I47ae3d8003cbfdd5b8ff5ba78e1ebe10f97af04b Reviewed-on: https://gerrit.libreoffice.org/36317 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/mtfrenderer/emfplus.cxx4
-rw-r--r--cppcanvas/source/mtfrenderer/emfppath.cxx10
-rw-r--r--cppcanvas/source/mtfrenderer/emfppath.hxx2
3 files changed, 12 insertions, 4 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 97f3a59928f3..924e5a220ff4 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1066,7 +1066,9 @@ namespace cppcanvas
EMFPPath path (points, true);
path.Read (rMF, flags, *this);
- EMFPPlusDrawPolygon (path.GetPolygon (*this), rFactoryParms, rState, rCanvas, flags);
+ // 0x2000 bit indicates whether to draw an extra line between the last point
+ // and the first point, to close the shape.
+ EMFPPlusDrawPolygon (path.GetPolygon (*this, true, (flags & 0x2000)), rFactoryParms, rState, rCanvas, flags);
break;
}
diff --git a/cppcanvas/source/mtfrenderer/emfppath.cxx b/cppcanvas/source/mtfrenderer/emfppath.cxx
index 54de41b06091..0a7231071d85 100644
--- a/cppcanvas/source/mtfrenderer/emfppath.cxx
+++ b/cppcanvas/source/mtfrenderer/emfppath.cxx
@@ -105,7 +105,7 @@ namespace cppcanvas
#endif
}
- ::basegfx::B2DPolyPolygon& EMFPPath::GetPolygon (ImplRenderer& rR, bool bMapIt)
+ ::basegfx::B2DPolyPolygon& EMFPPath::GetPolygon (ImplRenderer& rR, bool bMapIt, bool bAddLineToCloseShape)
{
::basegfx::B2DPolygon polygon;
@@ -157,7 +157,13 @@ namespace cppcanvas
polygon.clear ();
}
}
-
+ // Draw an extra line between the last point and the first point, to close the shape.
+ if (bAddLineToCloseShape) {
+ if (bMapIt)
+ polygon.append (rR.Map (pPoints [0], pPoints [1]) );
+ else
+ polygon.append (::basegfx::B2DPoint (pPoints [0], pPoints [1]) );
+ }
if (polygon.count ()) {
aPolygon.append (polygon);
diff --git a/cppcanvas/source/mtfrenderer/emfppath.hxx b/cppcanvas/source/mtfrenderer/emfppath.hxx
index ace3e83ad04d..f86af4806b04 100644
--- a/cppcanvas/source/mtfrenderer/emfppath.hxx
+++ b/cppcanvas/source/mtfrenderer/emfppath.hxx
@@ -38,7 +38,7 @@ namespace cppcanvas
// TODO: remove rR argument when debug code is not longer needed
void Read(SvStream& s, sal_uInt32 pathFlags, ImplRenderer& rR);
- ::basegfx::B2DPolyPolygon& GetPolygon(ImplRenderer& rR, bool bMapIt = true);
+ ::basegfx::B2DPolyPolygon& GetPolygon(ImplRenderer& rR, bool bMapIt = true, bool bAddLineToCloseShape = false);
};
}
}