[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - drawinglayer/source

Bartosz Kosiorek gang65 at poczta.onet.pl
Thu Apr 19 11:22:18 UTC 2018


 drawinglayer/source/tools/emfphelperdata.cxx |   12 ++++++------
 drawinglayer/source/tools/emfppath.cxx       |    5 +----
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 5024688f5e2d99b704fff05d2dddf12c397a4aa9
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Fri Apr 13 16:56:29 2018 +0200

    tdf#55058 EMF+ Properly close shapes with "setClosed" method.
    
    With previous implementation of closing shapes, we are adding
    new line between last and first point.
    It was causing wrong border shape during displaying.
    With this patch proper method was used to fix that.
    
    Change-Id: If0a084700401edd9d3b8a57cb27154079828e6ed
    Reviewed-on: https://gerrit.libreoffice.org/52857
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Patrick Jaap <patrick.jaap at tu-dresden.de>
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 8991b2f381b9..2b123372b908 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1020,7 +1020,7 @@ namespace emfplushelper
                         // Silent MSVC warning C4701: potentially uninitialized local variable 'brushIndexOrColor' used
                         sal_uInt32 brushIndexOrColor = 999;
                         sal_Int32 rectangles;
-                        bool isColor = (flags & 0x8000);
+                        const bool isColor = (flags & 0x8000);
                         ::basegfx::B2DPolygon polygon;
 
                         if (EmfPlusRecordTypeFillRects == type)
@@ -1040,14 +1040,14 @@ namespace emfplushelper
                         {
                             float x, y, width, height;
                             ReadRectangle(rMS, x, y, width, height, bool(flags & 0x4000));
-
+                            polygon.clear();
                             polygon.append(Map(x, y));
                             polygon.append(Map(x + width, y));
                             polygon.append(Map(x + width, y + height));
                             polygon.append(Map(x, y + height));
-                            polygon.append(Map(x, y));
+                            polygon.setClosed(true);
 
-                            SAL_INFO("drawinglayer", "EMF+\trectangle: " << x << ", " << width << "x" << height);
+                            SAL_INFO("drawinglayer", "EMF+\t rectangle: " << x << ", "<< y << " " << width << "x" << height);
 
                             ::basegfx::B2DPolyPolygon polyPolygon(polygon);
                             if (type == EmfPlusRecordTypeFillRects)
@@ -1059,13 +1059,13 @@ namespace emfplushelper
                     }
                     case EmfPlusRecordTypeFillPolygon:
                     {
-                        sal_uInt8 index = flags & 0xff;
+                        const sal_uInt8 index = flags & 0xff;
                         sal_uInt32 brushIndexOrColor;
                         sal_Int32 points;
 
                         rMS.ReadUInt32(brushIndexOrColor);
                         rMS.ReadInt32(points);
-                        SAL_INFO("drawinglayer", "EMF+ FillPolygon in slot: " << +index << " points: " << points);
+                        SAL_INFO("drawinglayer", "EMF+ FillPolygon in slot: " << index << " points: " << points);
                         SAL_INFO("drawinglayer", "EMF+\t: " << ((flags & 0x8000) ? "color" : "brush index") << " 0x" << std::hex << brushIndexOrColor << std::dec);
 
                         EMFPPath path(points, true);
diff --git a/drawinglayer/source/tools/emfppath.cxx b/drawinglayer/source/tools/emfppath.cxx
index 8e0d2b159a20..5ba8048d0bd4 100644
--- a/drawinglayer/source/tools/emfppath.cxx
+++ b/drawinglayer/source/tools/emfppath.cxx
@@ -156,10 +156,7 @@ namespace emfplushelper
         // 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]) );
+            polygon.setClosed (true);
         }
 
         if (polygon.count ())


More information about the Libreoffice-commits mailing list