diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-05-29 12:24:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-29 19:15:03 +0200 |
commit | d286a820fac4dbac993e13afda52dde79b310af4 (patch) | |
tree | e7299ea3108c20a75155189fc6ada73446457ee3 /drawinglayer/source/primitive2d | |
parent | 1959d451da06f501dd3446ebfe9c631b5400af26 (diff) |
we can std::move the data out of TextBreakupHelper
and save some copying
Change-Id: I34cbc2edfd53fcc440d1765dba471fcbb05b2b7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135088
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer/source/primitive2d')
-rw-r--r-- | drawinglayer/source/primitive2d/textbreakuphelper.cxx | 6 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx b/drawinglayer/source/primitive2d/textbreakuphelper.cxx index 9c4424b8d01e..5ca10ce633b6 100644 --- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx +++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx @@ -261,14 +261,14 @@ namespace drawinglayer::primitive2d mxResult = aTempResult; } - const Primitive2DContainer& TextBreakupHelper::getResult(BreakupUnit aBreakupUnit) const + Primitive2DContainer TextBreakupHelper::extractResult(BreakupUnit aBreakupUnit) { if(mxResult.empty()) { - const_cast< TextBreakupHelper* >(this)->breakup(aBreakupUnit); + breakup(aBreakupUnit); } - return mxResult; + return std::move(mxResult); } } // end of namespace diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 10cf07b4a8c0..25c5fd7b4ffa 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -155,13 +155,13 @@ namespace drawinglayer::primitive2d { // support for single word mode; split to single word primitives // using TextBreakupHelper - const TextBreakupHelper aTextBreakupHelper(*this); - const Primitive2DContainer& aBroken(aTextBreakupHelper.getResult(BreakupUnit::Word)); + TextBreakupHelper aTextBreakupHelper(*this); + Primitive2DContainer aBroken(aTextBreakupHelper.extractResult(BreakupUnit::Word)); if(!aBroken.empty()) { // was indeed split to several words, use as result - rContainer.insert(rContainer.end(), aBroken.begin(), aBroken.end()); + rContainer.append(std::move(aBroken)); return; } else |