svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 48 ++++++++++----------- 1 file changed, 25 insertions(+), 23 deletions(-)
New commits: commit 5b3b213ba00481375dcbeb0708066f625667e2ce Author: Caolán McNamara <caol...@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/23993 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 481ab67..557b097 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)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits