diff options
author | Noel Grandin <noel@peralex.com> | 2021-08-17 13:39:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-17 22:40:07 +0200 |
commit | 889df64fbb9534491b76140d63b4340091c763e4 (patch) | |
tree | da3fa3b93e5b0a462cf90a10e793b85b2078588c /basegfx | |
parent | 3d45088a4885671a12dfa48e6c650cb896f7078e (diff) |
reduce alloc costs for some basegfx objects (tdf#105575)
we can use a default object for the default constructo case, and
remove one malloc for each default constructed object
Change-Id: I0bec37ef9161a210973abb25669a9f16a5e0ea75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120603
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/matrix/b2dhommatrix.cxx | 4 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolypolygon.cxx | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 89088e8ebdbf..badda594c9de 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -31,7 +31,9 @@ namespace basegfx { }; - B2DHomMatrix::B2DHomMatrix() = default; + static o3tl::cow_wrapper<Impl2DHomMatrix> DEFAULT; + + B2DHomMatrix::B2DHomMatrix() : mpImpl(DEFAULT) {} B2DHomMatrix::B2DHomMatrix(const B2DHomMatrix&) = default; diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index dcd6133abc4a..36c221eeb106 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -200,7 +200,10 @@ public: namespace basegfx { - B2DPolyPolygon::B2DPolyPolygon() = default; + static o3tl::cow_wrapper<ImplB2DPolyPolygon> DEFAULT; + + B2DPolyPolygon::B2DPolyPolygon() : + mpPolyPolygon(DEFAULT) {} B2DPolyPolygon::B2DPolyPolygon(const B2DPolyPolygon&) = default; |