diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-04-11 13:27:39 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-26 23:02:57 +0000 |
commit | 141a31fa26d398491194249789bb35f0d52801d9 (patch) | |
tree | dbdd881507cfd2deecb1a36dd5d0f41d1e44ec9d | |
parent | 4f3e79a0493bf297fe165e974f4f9f044f5c7ed3 (diff) |
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@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 17c61cc64278c006b06f8b152d79073c0ef16993)
Reviewed-on: https://gerrit.libreoffice.org/24418
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index f09a78d9c6bd..c49af111d55d 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) |