basegfx/source/polygon/b2dpolypolygon.cxx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
New commits: commit 4e738b824d825717b7c6b895d816dcac1adf08e1 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Sep 21 15:28:12 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Sep 21 17:06:05 2022 +0200 basegfx: remove global ImplB2DPolyPolygon Similar to commit 7e911e9cd469d30369c213aa529675b3f7c4f0e8 Author Michael Stahl <mst...@redhat.com> Date Fri Aug 25 20:51:22 2017 +0200 basegfx: remove global ImplB2DPolygon There shouldn't be allocations of the objects just to destroy them without populating with data (it there are, they should be optimized away); and for any reasonable use, defaulting to a shared instance means that there is an unnecessary refcount increase and decrease aside from inevitable allocation of the unique instance. Change-Id: Ia92c229165c0836e56778d9274f0728181048e8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140341 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index 1889ddae4220..547634dc4dad 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -211,10 +211,7 @@ public: } }; - static o3tl::cow_wrapper<ImplB2DPolyPolygon, o3tl::ThreadSafeRefCountingPolicy> DEFAULT; - - B2DPolyPolygon::B2DPolyPolygon() : - mpPolyPolygon(DEFAULT) {} + B2DPolyPolygon::B2DPolyPolygon() = default; B2DPolyPolygon::B2DPolyPolygon(const B2DPolyPolygon&) = default; @@ -301,9 +298,7 @@ public: B2DPolyPolygon aRetval; if (count()) { - // Avoid CoW overhead for the local variable - // But detach from shared static DEFAULT - ImplB2DPolyPolygon& dest = aRetval.mpPolyPolygon.make_unique(); + ImplB2DPolyPolygon& dest = *aRetval.mpPolyPolygon; dest.reserve(count()); for (sal_uInt32 a(0); a < count(); a++)