diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-23 15:35:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-24 11:33:32 +0200 |
commit | c8d2fa176a15a7ae76d6a4b76aea5f108313c2ec (patch) | |
tree | 96cee630060986d6d2ab68b1ce2ca09a6a4fe922 /drawinglayer | |
parent | e1600348e49e1538459a0374fd97cd3173d4a4b9 (diff) |
reduce copying in drawinglayer
by passing PrimitiveContainer&& around.
There are lots of place where we were preparing a local variable of type
PrimitiveContainer, and then copying it someplace else, then throwing it
away.
Change-Id: Iacfd983640c9e55da25800ccc01734dfc8b4d64a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122527
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
9 files changed, 15 insertions, 15 deletions
diff --git a/drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx b/drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx index 001ff3159305..cecb1d8f1564 100644 --- a/drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx +++ b/drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx @@ -44,7 +44,7 @@ namespace drawinglayer::primitive2d applied. */ Primitive2DContainer create2DColorModifierEmbeddingsAsNeeded( - const Primitive2DContainer& rChildren, + Primitive2DContainer&& rChildren, GraphicDrawMode aGraphicDrawMode, double fLuminance = 0.0, // [-1.0 .. 1.0] double fContrast = 0.0, // [-1.0 .. 1.0] diff --git a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx index ce62b3110199..c586c6f23509 100644 --- a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx +++ b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx @@ -63,7 +63,7 @@ private: public: /// constructor - TextEffectPrimitive2D(const Primitive2DContainer& rTextContent, + TextEffectPrimitive2D(Primitive2DContainer&& rTextContent, const basegfx::B2DPoint& rRotationCenter, double fDirection, TextEffectStyle2D eTextEffectStyle2D); diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index ac1ba3d5657e..0d57512f2f86 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -114,7 +114,7 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, // embed to needed ModifiedColorPrimitive2D's if necessary. Do this for // adjustments and draw mode specials aRetval = create2DColorModifierEmbeddingsAsNeeded( - aRetval, aSuppressGraphicAttr.GetDrawMode(), + std::move(aRetval), aSuppressGraphicAttr.GetDrawMode(), std::clamp(aSuppressGraphicAttr.GetLuminance() * 0.01, -1.0, 1.0), std::clamp(aSuppressGraphicAttr.GetContrast() * 0.01, -1.0, 1.0), std::clamp(aSuppressGraphicAttr.GetChannelR() * 0.01, -1.0, 1.0), diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 37539685a8cd..c91dd683106b 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -576,7 +576,7 @@ namespace drawinglayer::primitive2d } Primitive2DContainer create2DColorModifierEmbeddingsAsNeeded( - const Primitive2DContainer& rChildren, + Primitive2DContainer&& rChildren, GraphicDrawMode aGraphicDrawMode, double fLuminance, double fContrast, @@ -596,7 +596,7 @@ namespace drawinglayer::primitive2d // set child content as retval; that is what will be used as child content in all // embeddings from here - aRetval = rChildren; + aRetval = std::move(rChildren); if(GraphicDrawMode::Watermark == aGraphicDrawMode) { diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index 83468b36d46e..7aa1a440555e 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -105,9 +105,9 @@ namespace drawinglayer::primitive2d const basegfx::B2DHomMatrix& rTransform, double fContentWidth, double fContentHeight, - const Primitive2DContainer& rPageContent) + Primitive2DContainer&& rPageContent) : mxDrawPage(rxDrawPage), - maPageContent(rPageContent), + maPageContent(std::move(rPageContent)), maTransform(rTransform), mfContentWidth(fContentWidth), mfContentHeight(fContentHeight) diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx index 8add9d587c6d..fc0538564896 100644 --- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx @@ -262,10 +262,10 @@ namespace drawinglayer::primitive2d PatternFillPrimitive2D::PatternFillPrimitive2D( const basegfx::B2DPolyPolygon& rMask, - const Primitive2DContainer& rChildren, + Primitive2DContainer&& rChildren, const basegfx::B2DRange& rReferenceRange) : maMask(rMask), - maChildren(rChildren), + maChildren(std::move(rChildren)), maReferenceRange(rReferenceRange), mnDiscreteWidth(0), mnDiscreteHeight(0) diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 05417f55c505..7c11edfc14dc 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -271,7 +271,7 @@ namespace drawinglayer::primitive2d } Primitive2DReference aNewTextEffect(new TextEffectPrimitive2D( - aRetval, + std::move(aRetval), aDecTrans.getTranslate(), aDecTrans.getRotate(), aTextEffectStyle2D)); @@ -282,7 +282,7 @@ namespace drawinglayer::primitive2d // create outline using an own helper primitive since this will // be view-dependent Primitive2DReference aNewTextEffect(new TextEffectPrimitive2D( - aRetval, + std::move(aRetval), aDecTrans.getTranslate(), aDecTrans.getRotate(), TextEffectStyle2D::Outline)); diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index 5d6425fc77e5..2a3f9e849eca 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -168,11 +168,11 @@ void TextEffectPrimitive2D::create2DDecomposition( } } -TextEffectPrimitive2D::TextEffectPrimitive2D(const Primitive2DContainer& rTextContent, +TextEffectPrimitive2D::TextEffectPrimitive2D(Primitive2DContainer&& rTextContent, const basegfx::B2DPoint& rRotationCenter, double fDirection, TextEffectStyle2D eTextEffectStyle2D) - : maTextContent(rTextContent) + : maTextContent(std::move(rTextContent)) , maRotationCenter(rRotationCenter) , mfDirection(fDirection) , meTextEffectStyle2D(eTextEffectStyle2D) diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 67deaed3649f..15b0868ee3fb 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -189,8 +189,8 @@ void TextSimplePortionPrimitive2D::create2DDecomposition( aPolygonTransform.decompose(aScale, aTranslate, fRotate, fShearX); // create outline text effect with current content and replace - Primitive2DReference aNewTextEffect( - new TextEffectPrimitive2D(aRetval, aTranslate, fRotate, TextEffectStyle2D::Outline)); + Primitive2DReference aNewTextEffect(new TextEffectPrimitive2D( + std::move(aRetval), aTranslate, fRotate, TextEffectStyle2D::Outline)); aRetval = Primitive2DContainer{ aNewTextEffect }; } |