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 /svgio | |
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 'svgio')
-rw-r--r-- | svgio/inc/svgstyleattributes.hxx | 4 | ||||
-rw-r--r-- | svgio/inc/svgtextnode.hxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svganode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgcirclenode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgellipsenode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svggnode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgimagenode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svglinenode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgpathnode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgpolynode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgrectnode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 10 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtextnode.cxx | 16 |
13 files changed, 25 insertions, 25 deletions
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx index 05f3ef085fd3..3fbb7a2ff324 100644 --- a/svgio/inc/svgstyleattributes.hxx +++ b/svgio/inc/svgstyleattributes.hxx @@ -282,14 +282,14 @@ namespace svgio::svgreader /// helper which does the necessary with a given path void add_text( drawinglayer::primitive2d::Primitive2DContainer& rTarget, - drawinglayer::primitive2d::Primitive2DContainer const & rSource) const; + drawinglayer::primitive2d::Primitive2DContainer&& rSource) const; void add_path( const basegfx::B2DPolyPolygon& rPath, drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::utils::PointIndexSet* pHelpPointIndices) const; void add_postProcess( drawinglayer::primitive2d::Primitive2DContainer& rTarget, - const drawinglayer::primitive2d::Primitive2DContainer& rSource, + drawinglayer::primitive2d::Primitive2DContainer&& rSource, const std::optional<basegfx::B2DHomMatrix>& pTransform) const; /// helper to set mpCssStyleParent temporarily for CSS style hierarchies diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx index 9ff73d66d104..b72d1043b8c0 100644 --- a/svgio/inc/svgtextnode.hxx +++ b/svgio/inc/svgtextnode.hxx @@ -46,7 +46,7 @@ namespace svgio::svgreader static void addTextPrimitives( const SvgNode& rCandidate, drawinglayer::primitive2d::Primitive2DContainer& rTarget, - drawinglayer::primitive2d::Primitive2DContainer const & rSource); + drawinglayer::primitive2d::Primitive2DContainer&& rSource); public: SvgTextNode( diff --git a/svgio/source/svgreader/svganode.cxx b/svgio/source/svgreader/svganode.cxx index 358282d143e9..aa473eb9187f 100644 --- a/svgio/source/svgreader/svganode.cxx +++ b/svgio/source/svgreader/svganode.cxx @@ -93,7 +93,7 @@ namespace svgio::svgreader if(!aContent.empty()) { - pStyle->add_postProcess(rTarget, aContent, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aContent), getTransform()); } } } diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx index 8577ba2726f6..a9f8fa75941e 100644 --- a/svgio/source/svgreader/svgcirclenode.cxx +++ b/svgio/source/svgreader/svgcirclenode.cxx @@ -135,7 +135,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } } // end of namespace svgio::svgreader diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx index b1646b30d929..2317648ef808 100644 --- a/svgio/source/svgreader/svgellipsenode.cxx +++ b/svgio/source/svgreader/svgellipsenode.cxx @@ -150,7 +150,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } } // end of namespace svgio::svgreader diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx index 8e2c1a2486da..02341d459147 100644 --- a/svgio/source/svgreader/svggnode.cxx +++ b/svgio/source/svgreader/svggnode.cxx @@ -108,7 +108,7 @@ namespace svgio::svgreader if(!aContent.empty()) { - pStyle->add_postProcess(rTarget, aContent, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aContent), getTransform()); } } } diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx index 15d48916eae5..2390f74dac03 100644 --- a/svgio/source/svgreader/svgimagenode.cxx +++ b/svgio/source/svgreader/svgimagenode.cxx @@ -346,7 +346,7 @@ namespace svgio::svgreader } // embed and add to rTarget, take local extra-transform into account - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx index 4259c4b1ca95..d593155fa38c 100644 --- a/svgio/source/svgreader/svglinenode.cxx +++ b/svgio/source/svgreader/svglinenode.cxx @@ -145,7 +145,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } } // end of namespace svgio::svgreader diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx index f3637bcf410f..1a5f931dea64 100644 --- a/svgio/source/svgreader/svgpathnode.cxx +++ b/svgio/source/svgreader/svgpathnode.cxx @@ -108,7 +108,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } } diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx index 0956dcd2dad5..64d1949d7d63 100644 --- a/svgio/source/svgreader/svgpolynode.cxx +++ b/svgio/source/svgreader/svgpolynode.cxx @@ -106,7 +106,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } } diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx index 27c1042edcfc..2bb1f166f595 100644 --- a/svgio/source/svgreader/svgrectnode.cxx +++ b/svgio/source/svgreader/svgrectnode.cxx @@ -207,7 +207,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } } // end of namespace svgio::svgreader diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 4d2b155f3ff8..3ad148c4624c 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -258,7 +258,7 @@ namespace svgio::svgreader void SvgStyleAttributes::add_text( drawinglayer::primitive2d::Primitive2DContainer& rTarget, - drawinglayer::primitive2d::Primitive2DContainer const & rSource) const + drawinglayer::primitive2d::Primitive2DContainer&& rSource) const { if(rSource.empty()) return; @@ -321,7 +321,7 @@ namespace svgio::svgreader else if(pFill) { // add the already prepared primitives for single color fill - rTarget.append(rSource); + rTarget.append(std::move(rSource)); } // add stroke @@ -588,7 +588,7 @@ namespace svgio::svgreader rTarget.push_back( new drawinglayer::primitive2d::PatternFillPrimitive2D( rPath, - aPrimitives, + std::move(aPrimitives), aReferenceRange)); } @@ -1148,7 +1148,7 @@ namespace svgio::svgreader void SvgStyleAttributes::add_postProcess( drawinglayer::primitive2d::Primitive2DContainer& rTarget, - const drawinglayer::primitive2d::Primitive2DContainer& rSource, + drawinglayer::primitive2d::Primitive2DContainer&& rSource, const std::optional<basegfx::B2DHomMatrix>& pTransform) const { if(rSource.empty()) @@ -1161,7 +1161,7 @@ namespace svgio::svgreader return; } - drawinglayer::primitive2d::Primitive2DContainer aSource(rSource); + drawinglayer::primitive2d::Primitive2DContainer aSource(std::move(rSource)); if(basegfx::fTools::less(fOpacity, 1.0)) { diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx index bda316cae4a4..25ad066e9bbc 100644 --- a/svgio/source/svgreader/svgtextnode.cxx +++ b/svgio/source/svgreader/svgtextnode.cxx @@ -83,7 +83,7 @@ namespace svgio::svgreader void SvgTextNode::addTextPrimitives( const SvgNode& rCandidate, drawinglayer::primitive2d::Primitive2DContainer& rTarget, - drawinglayer::primitive2d::Primitive2DContainer const & rSource) + drawinglayer::primitive2d::Primitive2DContainer&& rSource) { if(rSource.empty()) return; @@ -93,13 +93,13 @@ namespace svgio::svgreader if(pAttributes) { // add text with taking all Fill/Stroke attributes into account - pAttributes->add_text(rTarget, rSource); + pAttributes->add_text(rTarget, std::move(rSource)); } else { // should not happen, every subnode from SvgTextNode will at least // return the attributes from SvgTextNode. Nonetheless, add text - rTarget.append(rSource); + rTarget.append(std::move(rSource)); } } @@ -144,7 +144,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - addTextPrimitives(rCandidate, rTarget, aNewTarget); + addTextPrimitives(rCandidate, rTarget, std::move(aNewTarget)); } } @@ -171,7 +171,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - addTextPrimitives(rCandidate, rTarget, aNewTarget); + addTextPrimitives(rCandidate, rTarget, std::move(aNewTarget)); } } break; @@ -200,7 +200,7 @@ namespace svgio::svgreader if(!aNewTarget.empty()) { - addTextPrimitives(rCandidate, rTarget, aNewTarget); + addTextPrimitives(rCandidate, rTarget, std::move(aNewTarget)); } } } @@ -245,13 +245,13 @@ namespace svgio::svgreader { drawinglayer::primitive2d::Primitive2DContainer aNewTarget2; - addTextPrimitives(*this, aNewTarget2, aNewTarget); + addTextPrimitives(*this, aNewTarget2, std::move(aNewTarget)); aNewTarget = aNewTarget2; } if(!aNewTarget.empty()) { - pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); + pStyle->add_postProcess(rTarget, std::move(aNewTarget), getTransform()); } } |