Kaydet (Commit) 9c3d8b1c authored tarafından Caolán McNamara's avatar Caolán McNamara

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/59458
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 5dd58905
...@@ -140,6 +140,19 @@ bool lcl_clip2d_(drawing::Position3D& rPoint0, drawing::Position3D& rPoint1, con ...@@ -140,6 +140,19 @@ bool lcl_clip2d_(drawing::Position3D& rPoint0, drawing::Position3D& rPoint1, con
return bRet; 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 void lcl_addPointToPoly( drawing::PolyPolygonShape3D& rPoly
, const drawing::Position3D& rPos , const drawing::Position3D& rPos
, sal_Int32 nPolygonIndex , sal_Int32 nPolygonIndex
...@@ -170,7 +183,7 @@ void lcl_addPointToPoly( drawing::PolyPolygonShape3D& rPoly ...@@ -170,7 +183,7 @@ void lcl_addPointToPoly( drawing::PolyPolygonShape3D& rPoly
if( nSeqLength <= nNewResultPointCount ) if( nSeqLength <= nNewResultPointCount )
{ {
sal_Int32 nReallocLength = nReservePointCount; sal_Int32 nReallocLength = nReservePointCount > SAL_MAX_INT16 ? round_up_nearest_pow2(nNewResultPointCount) * 2 : nReservePointCount;
if( nNewResultPointCount > nReallocLength ) if( nNewResultPointCount > nReallocLength )
{ {
nReallocLength = nNewResultPointCount; nReallocLength = nNewResultPointCount;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment