summaryrefslogtreecommitdiffstats
path: root/basegfx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-01 14:03:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-04 21:04:30 +0200
commitf1e15482bcf6bf65dc611e19cbd2ffff479ef141 (patch)
tree5ba525a2fe55e5d7388b6ce0d66ce8135f194ee2 /basegfx
parentUpdate git submodules (diff)
downloadcore-f1e15482bcf6bf65dc611e19cbd2ffff479ef141.tar.gz
core-f1e15482bcf6bf65dc611e19cbd2ffff479ef141.zip
tdf#137544 reserve space in polypolygon
Change-Id: Ic8dc5b7479c1353487bac883fc0e704356e90798 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136802 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx11
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx1
2 files changed, 12 insertions, 0 deletions
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 4a81a82c4c71..a283828f661c 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -108,6 +108,11 @@ public:
}
}
+ void reserve(sal_uInt32 nCount)
+ {
+ maPolygons.reserve(nCount);
+ }
+
void insert(sal_uInt32 nIndex, const basegfx::B2DPolyPolygon& rPolyPolygon)
{
// add nCount polygons from rPolyPolygon
@@ -288,6 +293,12 @@ public:
mpPolyPolygon->insert(std::as_const(mpPolyPolygon)->count(), rPolygon, nCount);
}
+ void B2DPolyPolygon::reserve(sal_uInt32 nCount)
+ {
+ if(nCount)
+ mpPolyPolygon->reserve(nCount);
+ }
+
B2DPolyPolygon B2DPolyPolygon::getDefaultAdaptiveSubdivision() const
{
B2DPolyPolygon aRetval;
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index b49de907d45c..3f8f51c52404 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -553,6 +553,7 @@ namespace basegfx::utils
const css::drawing::PointSequenceSequence& rPointSequenceSequenceSource)
{
B2DPolyPolygon aRetval;
+ aRetval.reserve(rPointSequenceSequenceSource.getLength());
const css::drawing::PointSequence* pPointSequence = rPointSequenceSequenceSource.getConstArray();
const css::drawing::PointSequence* pPointSeqEnd = pPointSequence + rPointSequenceSequenceSource.getLength();