[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - svx/source

Caolán McNamara caolanm at redhat.com
Mon Jan 16 16:06:09 UTC 2017


 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx |   39 +++++++++++----------
 1 file changed, 22 insertions(+), 17 deletions(-)

New commits:
commit 0c39bdd960aaa363fd1fcf6608809d3a6068a3d4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 12 16:42:05 2017 +0000

    Resolves: tdf#101187 colossal page width wraps around if doubled
    
    when trying to generate a reasonable upper bound clipping region
    
    Change-Id: I53f8ea1bd6c52c88284e1f41369f83492d078b5d
    (cherry picked from commit 2fd88ab1cbb4690a770ca2ca5d66157ec4906a2e)
    Reviewed-on: https://gerrit.libreoffice.org/33008
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 2b0e78a..78455f4 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -99,23 +99,28 @@ namespace sdr
                 sal_Int32 nPageWidth = pPage ? pPage->GetWdt() : 0;
                 sal_Int32 nPageHeight = pPage ? pPage->GetHgt() : 0;
 
-                //But, see tdf#97276 and tdf#98366. Don't clip too much if the
-                //underlying page dimension is unknown or a paste document
-                //where the page sizes use the odd default of 10x10
-                nPageWidth = std::max<sal_Int32>(21000, nPageWidth);
-                nPageHeight = std::max<sal_Int32>(29700, nPageHeight);
-                basegfx::B2DRange aClipRange(-nPageWidth, -nPageHeight,
-                                             nPageWidth*2, nPageHeight*2);
-
-                aUnitPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(aUnitPolyPolygon,
-                                                                   aClipRange, true, true);
-                nPolyCount = ensureGeometry(aUnitPolyPolygon);
-
-                // re-check that we have't been clipped out to oblivion
-                bIsLine =
-                    !aUnitPolyPolygon.areControlPointsUsed()
-                    && 1 == nPolyCount
-                    && 2 == aUnitPolyPolygon.getB2DPolygon(0).count();
+                //But, see tdf#101187, only do this if our generous clip region
+                //would not over flow into a tiny clip region
+                if (nPageWidth < SAL_MAX_INT32/2 && nPageHeight < SAL_MAX_INT32/2)
+                {
+                    //But, see tdf#97276 and tdf#98366. Don't clip too much if the
+                    //underlying page dimension is unknown or a paste document
+                    //where the page sizes use the odd default of 10x10
+                    nPageWidth = std::max<sal_Int32>(21000, nPageWidth);
+                    nPageHeight = std::max<sal_Int32>(29700, nPageHeight);
+                    basegfx::B2DRange aClipRange(-nPageWidth, -nPageHeight,
+                                                 nPageWidth*2, nPageHeight*2);
+
+                    aUnitPolyPolygon = basegfx::tools::clipPolyPolygonOnRange(aUnitPolyPolygon,
+                                                                       aClipRange, true, true);
+                    nPolyCount = ensureGeometry(aUnitPolyPolygon);
+
+                    // re-check that we have't been clipped out to oblivion
+                    bIsLine =
+                        !aUnitPolyPolygon.areControlPointsUsed()
+                        && 1 == nPolyCount
+                        && 2 == aUnitPolyPolygon.getB2DPolygon(0).count();
+                }
             }
 
             if(bIsLine)


More information about the Libreoffice-commits mailing list