[Libreoffice-commits] core.git: basegfx/source
Jochen Nitschke (via logerrit)
logerrit at kemper.freedesktop.org
Sun Dec 27 06:53:16 UTC 2020
basegfx/source/polygon/b2dtrapezoid.cxx | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
New commits:
commit 8a545ef39f6177f5da536186a4e3b41f9eaae75d
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
AuthorDate: Sat Dec 26 11:13:02 2020 +0100
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Dec 27 07:52:35 2020 +0100
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 at collabora.co.uk>
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())
More information about the Libreoffice-commits
mailing list