diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-25 09:54:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-08 10:40:57 +0000 |
commit | f2beebbfe78bfd5dd26318ea269f49aeee6bd642 (patch) | |
tree | afd9820842752f252409590e323f72cdbd0a4c3c /sw/source/uibase | |
parent | ab731b192f40fde71c796ecab563adc8d7258da8 (diff) |
reduce copying when decomposing drawinglayer primitives
instead of returning a Primitive2DContainer from each method which we
are then going to immediately append to another container, pass down a
single container by reference which we can append to
Change-Id: I0f28a499d2ec54f7111a7044c30099767aa079e1
Reviewed-on: https://gerrit.libreoffice.org/30258
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/docvw/AnchorOverlayObject.cxx | 18 | ||||
-rw-r--r-- | sw/source/uibase/docvw/ShadowOverlayObject.cxx | 21 |
2 files changed, 15 insertions, 24 deletions
diff --git a/sw/source/uibase/docvw/AnchorOverlayObject.cxx b/sw/source/uibase/docvw/AnchorOverlayObject.cxx index c3a6ea8a863d..b92574c3036c 100644 --- a/sw/source/uibase/docvw/AnchorOverlayObject.cxx +++ b/sw/source/uibase/docvw/AnchorOverlayObject.cxx @@ -50,7 +50,8 @@ private: bool mbLineSolid : 1; protected: - virtual drawinglayer::primitive2d::Primitive2DContainer create2DDecomposition( + virtual void create2DDecomposition( + drawinglayer::primitive2d::Primitive2DContainer& rContainer, const drawinglayer::geometry::ViewInformation2D& rViewInformation) const override; public: @@ -81,11 +82,10 @@ public: DeclPrimitive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DContainer AnchorPrimitive::create2DDecomposition( +void AnchorPrimitive::create2DDecomposition( + drawinglayer::primitive2d::Primitive2DContainer& rContainer, const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const { - drawinglayer::primitive2d::Primitive2DContainer aRetval; - if ( AS_TRI == maAnchorState || AS_ALL == maAnchorState || AS_START == maAnchorState ) @@ -96,7 +96,7 @@ drawinglayer::primitive2d::Primitive2DContainer AnchorPrimitive::create2DDecompo basegfx::B2DPolyPolygon(maTriangle), getColor())); - aRetval.push_back(aTriangle); + rContainer.push_back(aTriangle); } // prepare view-independent LineWidth and color @@ -115,7 +115,7 @@ drawinglayer::primitive2d::Primitive2DContainer AnchorPrimitive::create2DDecompo getLine(), aLineAttribute)); - aRetval.push_back(aSolidLine); + rContainer.push_back(aSolidLine); } else { @@ -136,7 +136,7 @@ drawinglayer::primitive2d::Primitive2DContainer AnchorPrimitive::create2DDecompo aLineAttribute, aStrokeAttribute)); - aRetval.push_back(aStrokedLine); + rContainer.push_back(aStrokedLine); } } @@ -150,10 +150,8 @@ drawinglayer::primitive2d::Primitive2DContainer AnchorPrimitive::create2DDecompo maLineTop, aLineAttribute)); - aRetval.push_back(aLineTop); + rContainer.push_back(aLineTop); } - - return aRetval; } bool AnchorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.cxx b/sw/source/uibase/docvw/ShadowOverlayObject.cxx index 7bf63c5ca7b0..526a6162aad9 100644 --- a/sw/source/uibase/docvw/ShadowOverlayObject.cxx +++ b/sw/source/uibase/docvw/ShadowOverlayObject.cxx @@ -44,7 +44,8 @@ private: ShadowState maShadowState; protected: - virtual drawinglayer::primitive2d::Primitive2DContainer create2DDecomposition( + virtual void create2DDecomposition( + drawinglayer::primitive2d::Primitive2DContainer& rContainer, const drawinglayer::geometry::ViewInformation2D& rViewInformation) const override; public: @@ -66,11 +67,11 @@ public: DeclPrimitive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DContainer ShadowPrimitive::create2DDecomposition( +void ShadowPrimitive::create2DDecomposition( + drawinglayer::primitive2d::Primitive2DContainer& rContainer, const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const { // get logic sizes in object coordinate system - drawinglayer::primitive2d::Primitive2DContainer xRetval; basegfx::B2DRange aRange(maBasePosition); switch(maShadowState) @@ -88,12 +89,10 @@ drawinglayer::primitive2d::Primitive2DContainer ShadowPrimitive::create2DDecompo basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0), 2); - const drawinglayer::primitive2d::Primitive2DReference xReference( + rContainer.push_back( new drawinglayer::primitive2d::FillGradientPrimitive2D( aRange, aFillGradientAttribute)); - - xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference }; break; } case SS_VIEW: @@ -109,12 +108,10 @@ drawinglayer::primitive2d::Primitive2DContainer ShadowPrimitive::create2DDecompo basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0), 4); - const drawinglayer::primitive2d::Primitive2DReference xReference( + rContainer.push_back( new drawinglayer::primitive2d::FillGradientPrimitive2D( aRange, aFillGradientAttribute)); - - xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference }; break; } case SS_EDIT: @@ -130,12 +127,10 @@ drawinglayer::primitive2d::Primitive2DContainer ShadowPrimitive::create2DDecompo basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0), 4); - const drawinglayer::primitive2d::Primitive2DReference xReference( + rContainer.push_back( new drawinglayer::primitive2d::FillGradientPrimitive2D( aRange, aFillGradientAttribute)); - - xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference }; break; } default: @@ -143,8 +138,6 @@ drawinglayer::primitive2d::Primitive2DContainer ShadowPrimitive::create2DDecompo break; } } - - return xRetval; } bool ShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const |