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

Caolán McNamara caolanm at redhat.com
Tue Apr 26 23:03:22 UTC 2016


 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx |   48 ++++++++++-----------
 1 file changed, 25 insertions(+), 23 deletions(-)

New commits:
commit 141a31fa26d398491194249789bb35f0d52801d9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 11 13:27:39 2016 +0100

    Resolves: tdf#98366 paste document has 10x10 sized SdPages...
    
    so long lines in them are clipped out in the preview.
    
    Change-Id: I355986ff4a9c9e53f8e8f5d41b63f74c633f41ee
    (cherry picked from commit 93efd7ebbad293d3729b8ea4b9726aff498f607f)
    Reviewed-on: https://gerrit.libreoffice.org/23994
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 17c61cc64278c006b06f8b152d79073c0ef16993)
    Reviewed-on: https://gerrit.libreoffice.org/24418
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index f09a78d..c49af11 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -90,30 +90,32 @@ namespace sdr
 
             if(bIsLine)
             {
+                //tdf#63955 if we have an extremely long line then clip it to a
+                //very generous range of -1 page width/height vs +1 page
+                //width/height to avoid oom and massive churn generating a huge
+                //polygon chain to cover the length in applyLineDashing if this
+                //line is dashed
                 const SdrPage* pPage = GetPathObj().GetPage();
-                double fPageWidth = pPage ? pPage->GetWdt() : 0.0;
-                double fPageHeight = pPage ? pPage->GetHgt() : 0.0;
-                if (fPageWidth && fPageHeight)
-                {
-                    //tdf#63955 if we have an extremely long line then clip it
-                    //to a very generous range of -1 page width/height vs +1
-                    //page width/height to avoid oom and massive churn
-                    //generating a huge polygon chain to cover the length in
-                    //applyLineDashing if this line is dashed
-                    //tdf#97276 don't clip if the underlying page dimension
-                    //is unknown
-                    basegfx::B2DRange aClipRange(-fPageWidth, -fPageHeight,
-                                                 fPageWidth*2, fPageHeight*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();
-                }
+                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();
             }
 
             if(bIsLine)


More information about the Libreoffice-commits mailing list