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>
This commit is contained in:
Noel Grandin
2022-07-04 21:04:30 +02:00
parent 567529002c
commit f1e15482bc
3 changed files with 13 additions and 0 deletions
+11
View File
@@ -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;
@@ -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();
@@ -68,6 +68,7 @@ namespace basegfx
// insert/append single polygon
void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
void append(const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
void reserve(sal_uInt32 nCount);
/** Default adaptive subdivision access