[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - chart2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Aug 22 22:42:21 UTC 2018
chart2/source/view/main/Clipping.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit b707def5e9696c429cfb1dbe8479d5b63046e800
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 22 17:08:23 2018 +0100
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Thu Aug 23 00:41:58 2018 +0200
Resolves: tdf#98558 oom under windows with certain charts
keep the performance fix of i#66963 but clip it to a value
larger than appears in that document, but massively smaller
than what is necessary for this document
Change-Id: I162c03a13ce11e348db8168fed212dfea216c7a4
Reviewed-on: https://gerrit.libreoffice.org/59463
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Jenkins
diff --git a/chart2/source/view/main/Clipping.cxx b/chart2/source/view/main/Clipping.cxx
index 7892815f322b..354871612233 100644
--- a/chart2/source/view/main/Clipping.cxx
+++ b/chart2/source/view/main/Clipping.cxx
@@ -140,6 +140,19 @@ bool lcl_clip2d_(drawing::Position3D& rPoint0, drawing::Position3D& rPoint1, con
return bRet;
}
+unsigned int round_up_nearest_pow2(unsigned int v)
+{
+ // compute the next highest power of 2 of 32-bit v
+ --v;
+ v |= v >> 1;
+ v |= v >> 2;
+ v |= v >> 4;
+ v |= v >> 8;
+ v |= v >> 16;
+ ++v;
+ return v;
+}
+
void lcl_addPointToPoly( drawing::PolyPolygonShape3D& rPoly
, const drawing::Position3D& rPos
, sal_Int32 nPolygonIndex
@@ -170,7 +183,7 @@ void lcl_addPointToPoly( drawing::PolyPolygonShape3D& rPoly
if( nSeqLength <= nNewResultPointCount )
{
- sal_Int32 nReallocLength = nReservePointCount;
+ sal_Int32 nReallocLength = nReservePointCount > SAL_MAX_INT16 ? round_up_nearest_pow2(nNewResultPointCount) * 2 : nReservePointCount;
if( nNewResultPointCount > nReallocLength )
{
nReallocLength = nNewResultPointCount;
More information about the Libreoffice-commits
mailing list