From 3b83c6ac804cf7adcea036d1fb7dda113a72f457 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 4 Feb 2024 13:15:01 +0200 Subject: make BufferedDecompositionPrimitive2D store a Primitive2DReference.. .. instead of a Primitive2DContainer. The container very frequently contains only a single item, since the decomposition method often sticks only a single top-level node in there, so it turns out to be a net loss overall, memory consumption-wise. Also, if we return a single Primitive2DReference from a BufferedDecomposition, that maximises the sharing of data between the BufferedDecomposition objects at the bottom of the decomposed tree, and objects higher up. Change-Id: Iaf272e60e2997299cc35a1bd209c51b6b79e9a8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162976 Tested-by: Jenkins Reviewed-by: Noel Grandin --- drawinglayer/qa/unit/border.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drawinglayer/qa') diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx index f6f9feba5427..c69e0e94e7ba 100644 --- a/drawinglayer/qa/unit/border.cxx +++ b/drawinglayer/qa/unit/border.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -72,11 +73,14 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoubleDecompositionSolid) aBorder->get2DDecomposition(aContainer, aView); // Make sure it results in two borders as it's a double one. - CPPUNIT_ASSERT_EQUAL(static_cast(2), aContainer.size()); + CPPUNIT_ASSERT_EQUAL(static_cast(1), aContainer.size()); + auto* pGroupPrimitive + = dynamic_cast(aContainer[0].get()); + CPPUNIT_ASSERT_EQUAL(static_cast(2), pGroupPrimitive->getChildren().size()); // Get the inside line, now a PolygonStrokePrimitive2D auto pInside = dynamic_cast( - aContainer[0].get()); + pGroupPrimitive->getChildren()[0].get()); CPPUNIT_ASSERT(pInside); // Make sure the inside line's height is fLeftWidth. -- cgit