[Libreoffice-commits] core.git: cppcanvas/source

Bartosz Kosiorek gang65 at poczta.onet.pl
Thu Apr 13 16:31:10 UTC 2017


 cppcanvas/source/mtfrenderer/emfplus.cxx  |    4 +++-
 cppcanvas/source/mtfrenderer/emfppath.cxx |   10 ++++++++--
 cppcanvas/source/mtfrenderer/emfppath.hxx |    2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 572663345531f8485b783f7d80bf51836550b8c4
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Sun Apr 9 19:09:35 2017 +0200

    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 at libreoffice.org>
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

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);
         };
     }
 }


More information about the Libreoffice-commits mailing list