[Libreoffice-commits] core.git: basegfx/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 17 20:40:43 UTC 2021


 basegfx/source/matrix/b2dhommatrix.cxx    |    4 +++-
 basegfx/source/polygon/b2dpolypolygon.cxx |    5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 889df64fbb9534491b76140d63b4340091c763e4
Author:     Noel Grandin <noel at peralex.com>
AuthorDate: Tue Aug 17 13:39:03 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 17 22:40:07 2021 +0200

    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 at collabora.co.uk>

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;
 


More information about the Libreoffice-commits mailing list