[Libreoffice-commits] core.git: Branch 'libreoffice-5-0-6' - vcl/win

Armin Le Grand Armin.Le.Grand at cib.de
Wed Apr 20 13:34:17 UTC 2016


 vcl/win/source/gdi/gdiimpl.cxx |   44 +++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 12 deletions(-)

New commits:
commit d50411a65fc7a3f02109057d1f92ccc3c97bab84
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Wed Apr 13 16:39:42 2016 +0200

    tdf#40863 only use polygons with area for WinClipRegions
    
    Due to a former fix CustomShapes have extra polygons with a single
    point in the top-left and bottom-right corner of their BoundRect,
    a workaround to allow getting their correct BoundRect in slideshow.
    Unfortunately this makes the win command CreatePolyPolygonRgn fail
    to create the needed ClipRegions so that the geometry is processed
    without clipping. Changed to only use polygons as input that have an
    area.
    
    Change-Id: I0eeda5776402777ed00de92f42a55f206575f58b
    Reviewed-on: https://gerrit.libreoffice.org/24059
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/24112
    (cherry picked from commit a223d0b5006dade7043444ad7db6663d65366748)
    Reviewed-on: https://gerrit.libreoffice.org/24189
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx
index e4823a2..b429086 100644
--- a/vcl/win/source/gdi/gdiimpl.cxx
+++ b/vcl/win/source/gdi/gdiimpl.cxx
@@ -1159,6 +1159,7 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
             aPolyPoints.reserve( 1024 );
             std::vector< INT > aPolyCounts( nCount, 0 );
             basegfx::B2DHomMatrix aExpand;
+            sal_uInt32 nTargetCount(0);
             static bool bExpandByOneInXandY(true);
 
             if(bExpandByOneInXandY)
@@ -1175,26 +1176,45 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
                         aPolyPolygon.getB2DPolygon(a),
                         1));
                 const sal_uInt32 nPoints(aPoly.count());
-                aPolyCounts[a] = nPoints;
 
-                for( sal_uInt32 b = 0; b < nPoints; b++ )
+                // tdf#40863 For CustomShapes there is a hack (see
+                // f64ef72743e55389e446e0d4bc6febd475011023) that adds polygons
+                // with a single point in top-left and bottom-right corner
+                // of the BoundRect to be able to determine the correct BoundRect
+                // in the slideshow. Unfortunately, CreatePolyPolygonRgn below
+                // fails with polygons containing a single pixel, so clipping is
+                // lost. For now, use only polygons with more than two points - the
+                // ones that may have an area.
+                // Note: polygons with one point which are curves may have an area,
+                // but the polygon is already subdivided here, so no need to test
+                // this.
+                if(nPoints > 2)
                 {
-                    basegfx::B2DPoint aPt(aPoly.getB2DPoint(b));
+                    aPolyCounts[nTargetCount] = nPoints;
+                    nTargetCount++;
 
-                    if(bExpandByOneInXandY)
+                    for( sal_uInt32 b = 0; b < nPoints; b++ )
                     {
-                        aPt = aExpand * aPt;
-                    }
+                        basegfx::B2DPoint aPt(aPoly.getB2DPoint(b));
+
+                        if(bExpandByOneInXandY)
+                        {
+                            aPt = aExpand * aPt;
+                        }
 
-                    POINT aPOINT;
-                    // #i122149# do correct rounding
-                    aPOINT.x = basegfx::fround(aPt.getX());
-                    aPOINT.y = basegfx::fround(aPt.getY());
-                    aPolyPoints.push_back( aPOINT );
+                        POINT aPOINT;
+                        // #i122149# do correct rounding
+                        aPOINT.x = basegfx::fround(aPt.getX());
+                        aPOINT.y = basegfx::fround(aPt.getY());
+                        aPolyPoints.push_back( aPOINT );
+                    }
                 }
             }
 
-            mrParent.mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nCount, ALTERNATE );
+            if(nTargetCount)
+            {
+                mrParent.mhRegion = CreatePolyPolygonRgn( &aPolyPoints[0], &aPolyCounts[0], nTargetCount, ALTERNATE );
+            }
         }
     }
     else


More information about the Libreoffice-commits mailing list