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 --- svx/inc/sdr/overlay/overlaytools.hxx | 12 ++++++------ svx/inc/sdr/primitive2d/sdrcaptionprimitive2d.hxx | 2 +- svx/inc/sdr/primitive2d/sdrcellprimitive.hxx | 5 ++--- svx/inc/sdr/primitive2d/sdrconnectorprimitive2d.hxx | 2 +- svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 2 +- svx/inc/sdr/primitive2d/sdrellipseprimitive2d.hxx | 4 ++-- svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx | 5 ++--- svx/inc/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 2 +- svx/inc/sdr/primitive2d/sdrolecontentprimitive2d.hxx | 2 +- svx/inc/sdr/primitive2d/sdrpathprimitive2d.hxx | 2 +- svx/inc/sdr/primitive2d/sdrrectangleprimitive2d.hxx | 2 +- svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx | 14 +++++++------- 12 files changed, 26 insertions(+), 28 deletions(-) (limited to 'svx/inc/sdr') diff --git a/svx/inc/sdr/overlay/overlaytools.hxx b/svx/inc/sdr/overlay/overlaytools.hxx index 3b0e1be43809..853bb7607114 100644 --- a/svx/inc/sdr/overlay/overlaytools.hxx +++ b/svx/inc/sdr/overlay/overlaytools.hxx @@ -40,7 +40,7 @@ private: // the rotation of the primitive itself double mfRotation; - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; public: OverlayStaticRectanglePrimitive( @@ -83,7 +83,7 @@ namespace drawinglayer::primitive2d double mfShearX; double mfRotation; - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; public: OverlayBitmapExPrimitive( @@ -124,7 +124,7 @@ namespace drawinglayer::primitive2d basegfx::BColor maRGBColorB; double mfDiscreteDashLength; - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; public: OverlayCrosshairPrimitive( @@ -168,7 +168,7 @@ namespace drawinglayer::primitive2d // the rotation of the primitive itself double mfRotation; - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; public: OverlayRectanglePrimitive( @@ -220,7 +220,7 @@ namespace drawinglayer::primitive2d basegfx::BColor maRGBColorB; double mfDiscreteDashLength; - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; public: OverlayHelplineStripedPrimitive( @@ -261,7 +261,7 @@ namespace drawinglayer::primitive2d basegfx::BColor maRGBColorB; double mfDiscreteDashLength; - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; public: OverlayRollingRectanglePrimitive( diff --git a/svx/inc/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrcaptionprimitive2d.hxx index eaa6665647f0..beddbd75a0d6 100644 --- a/svx/inc/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -41,7 +41,7 @@ namespace drawinglayer::primitive2d double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrCaptionPrimitive2D( diff --git a/svx/inc/sdr/primitive2d/sdrcellprimitive.hxx b/svx/inc/sdr/primitive2d/sdrcellprimitive.hxx index 17088b84b17c..2b4b45f58dec 100644 --- a/svx/inc/sdr/primitive2d/sdrcellprimitive.hxx +++ b/svx/inc/sdr/primitive2d/sdrcellprimitive.hxx @@ -35,9 +35,8 @@ private: protected: // local decomposition. - virtual void - create2DDecomposition(Primitive2DContainer& rContainer, - const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference + create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrCellPrimitive2D(basegfx::B2DHomMatrix aTransform, diff --git a/svx/inc/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrconnectorprimitive2d.hxx index 9b7d6648d0bc..ab5227923260 100644 --- a/svx/inc/sdr/primitive2d/sdrconnectorprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -37,7 +37,7 @@ namespace drawinglayer::primitive2d ::basegfx::B2DPolygon maUnitPolygon; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrConnectorPrimitive2D( diff --git a/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index cef7f29f59e2..b0509c2fac29 100644 --- a/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer::primitive2d basegfx::B2DHomMatrix maTransform; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrCustomShapePrimitive2D( diff --git a/svx/inc/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrellipseprimitive2d.hxx index 3eacda3eee05..be86eef56c41 100644 --- a/svx/inc/sdr/primitive2d/sdrellipseprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -37,7 +37,7 @@ namespace drawinglayer::primitive2d attribute::SdrLineFillEffectsTextAttribute maSdrLFSTAttribute; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrEllipsePrimitive2D( @@ -69,7 +69,7 @@ namespace drawinglayer::primitive2d bool mbCloseUsingCenter : 1; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrEllipseSegmentPrimitive2D( diff --git a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx index 16f84c86bc1d..91f1d9d2d4d8 100644 --- a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -35,9 +35,8 @@ private: GraphicAttr maGraphicAttr; // local decomposition. - virtual void - create2DDecomposition(Primitive2DContainer& rContainer, - const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference + create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrGrafPrimitive2D(::basegfx::B2DHomMatrix aTransform, diff --git a/svx/inc/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 4bc8de10b589..2fb380b34906 100644 --- a/svx/inc/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -71,7 +71,7 @@ namespace drawinglayer::primitive2d bool bRightActive) const; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrMeasurePrimitive2D( diff --git a/svx/inc/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrolecontentprimitive2d.hxx index 20d694399705..d778f531a34b 100644 --- a/svx/inc/sdr/primitive2d/sdrolecontentprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -44,7 +44,7 @@ namespace drawinglayer::primitive2d sal_uInt32 mnGraphicVersion; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrOleContentPrimitive2D( diff --git a/svx/inc/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrpathprimitive2d.hxx index 68abc8067df6..24097280cb63 100644 --- a/svx/inc/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -50,7 +50,7 @@ namespace drawinglayer::primitive2d basegfx::B2DPolyPolygon maUnitDefinitionPolyPolygon; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: // OperationSmiley: Extended to UnitDefinitionPolyPolygon, but when needed diff --git a/svx/inc/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrrectangleprimitive2d.hxx index f306e5642ca4..05dff761b0ad 100644 --- a/svx/inc/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -42,7 +42,7 @@ namespace drawinglayer::primitive2d bool mbForceFillForHitTest : 1; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrRectanglePrimitive2D( diff --git a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx index e2bfcecf9c29..adfcd193b65a 100644 --- a/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx +++ b/svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -75,7 +75,7 @@ namespace drawinglayer::primitive2d protected: // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments - static void encapsulateWithTextHierarchyBlockPrimitive2D(Primitive2DContainer& rContainer, Primitive2DContainer&& aCandidate); + static Primitive2DReference encapsulateWithTextHierarchyBlockPrimitive2D(Primitive2DContainer&& aCandidate); public: SdrTextPrimitive2D( @@ -111,7 +111,7 @@ namespace drawinglayer::primitive2d basegfx::B2DHomMatrix maObjectTransform; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrContourTextPrimitive2D( @@ -148,7 +148,7 @@ namespace drawinglayer::primitive2d attribute::SdrFormTextAttribute maSdrFormTextAttribute; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrPathTextPrimitive2D( @@ -191,7 +191,7 @@ namespace drawinglayer::primitive2d bool mbWordWrap : 1; // for CustomShapes text layout // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrBlockTextPrimitive2D( @@ -237,7 +237,7 @@ namespace drawinglayer::primitive2d bool mbFixedCellHeight : 1; // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrStretchTextPrimitive2D( @@ -272,7 +272,7 @@ namespace drawinglayer::primitive2d bool mbWordWrap : 1; // for CustomShapes text layout // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrAutoFitTextPrimitive2D( @@ -306,7 +306,7 @@ namespace drawinglayer::primitive2d ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range // local decomposition. - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override; + virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const override; public: SdrChainedTextPrimitive2D( -- cgit