summaryrefslogtreecommitdiff
path: root/drawinglayer/qa
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-02-04 13:15:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-02-12 11:36:05 +0100
commit3b83c6ac804cf7adcea036d1fb7dda113a72f457 (patch)
tree8f1af5f06f236a1dcb9ca313f3dedd3aa8c16390 /drawinglayer/qa
parent582ef812702413dbe7fb0f132bca3e3e4c2e1d40 (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer/qa')
-rw-r--r--drawinglayer/qa/unit/border.cxx8
1 files changed, 6 insertions, 2 deletions
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 <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <rtl/ref.hxx>
@@ -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<std::size_t>(2), aContainer.size());
+ CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), aContainer.size());
+ auto* pGroupPrimitive
+ = dynamic_cast<const drawinglayer::primitive2d::GroupPrimitive2D*>(aContainer[0].get());
+ CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(2), pGroupPrimitive->getChildren().size());
// Get the inside line, now a PolygonStrokePrimitive2D
auto pInside = dynamic_cast<const drawinglayer::primitive2d::PolygonStrokePrimitive2D*>(
- aContainer[0].get());
+ pGroupPrimitive->getChildren()[0].get());
CPPUNIT_ASSERT(pInside);
// Make sure the inside line's height is fLeftWidth.