summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2020-12-26 11:13:02 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-27 07:52:35 +0100
commit8a545ef39f6177f5da536186a4e3b41f9eaae75d (patch)
tree0032caee34204e4618580edfe857680933f68243 /basegfx
parent4be5308c05d8078b20fc9b14d961c53b0ede193a (diff)
std::list::size() has constant complexity since C++11
Change-Id: I18cfbf84e1ca2cc6d3a7e7f01e943ef8afb23362 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108334 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dtrapezoid.cxx12
1 files changed, 3 insertions, 9 deletions
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index 5648aa3be81c..f30001f52d2a 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -252,7 +252,6 @@ namespace basegfx::trapezoidhelper
{
private:
// local data
- sal_uInt32 mnInitialEdgeEntryCount;
TrDeEdgeEntries maTrDeEdgeEntries;
std::vector< B2DPoint > maPoints;
/// new points allocated for cuts
@@ -483,8 +482,7 @@ namespace basegfx::trapezoidhelper
public:
explicit TrapezoidSubdivider(
const B2DPolyPolygon& rSourcePolyPolygon)
- : mnInitialEdgeEntryCount(0),
- maTrDeEdgeEntries(),
+ : maTrDeEdgeEntries(),
maPoints(),
maNewPoints()
{
@@ -567,7 +565,6 @@ namespace basegfx::trapezoidhelper
// vertical edge. Positive Y-direction is guaranteed by the
// TrDeEdgeEntry constructor
maTrDeEdgeEntries.emplace_back(pPrev, pCurr, 0);
- mnInitialEdgeEntryCount++;
}
// prepare next step
@@ -617,11 +614,8 @@ namespace basegfx::trapezoidhelper
if(!maTrDeEdgeEntries.empty())
{
// measuring shows that the relation between edges and created trapezoids is
- // mostly in the 1:1 range, thus reserve as much trapezoids as edges exist. Do
- // not use maTrDeEdgeEntries.size() since that may be a non-constant time
- // operation for Lists. Instead, use mnInitialEdgeEntryCount which will contain
- // the roughly counted adds to the List
- ro_Result.reserve(ro_Result.size() + mnInitialEdgeEntryCount);
+ // mostly in the 1:1 range, thus reserve as much trapezoids as edges exist.
+ ro_Result.reserve(ro_Result.size() + maTrDeEdgeEntries.size());
}
while(!maTrDeEdgeEntries.empty())