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>
This commit is contained in:
parent
1959d451da
commit
d286a820fa
5 changed files with 14 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace drawinglayer::primitive2d
|
|||
virtual ~TextBreakupHelper();
|
||||
|
||||
/// get result
|
||||
const Primitive2DContainer& getResult(BreakupUnit aBreakupUnit = BreakupUnit::Character) const;
|
||||
Primitive2DContainer extractResult(BreakupUnit aBreakupUnit = BreakupUnit::Character);
|
||||
};
|
||||
|
||||
} // end of namespace drawinglayer::primitive2d
|
||||
|
|
|
@ -515,13 +515,12 @@ namespace svgio::svgreader
|
|||
|
||||
if(pCandidate)
|
||||
{
|
||||
const localTextBreakupHelper alocalTextBreakupHelper(*pCandidate, rSvgTextPosition);
|
||||
const Primitive2DContainer& aResult(
|
||||
alocalTextBreakupHelper.getResult());
|
||||
localTextBreakupHelper alocalTextBreakupHelper(*pCandidate, rSvgTextPosition);
|
||||
Primitive2DContainer aResult = alocalTextBreakupHelper.extractResult();
|
||||
|
||||
if(!aResult.empty())
|
||||
{
|
||||
rTarget.append(aResult);
|
||||
rTarget.append(std::move(aResult));
|
||||
}
|
||||
|
||||
// also consume for the implied single space
|
||||
|
|
|
@ -412,19 +412,19 @@ namespace svgio::svgreader
|
|||
|
||||
if(pCandidate)
|
||||
{
|
||||
const pathTextBreakupHelper aPathTextBreakupHelper(
|
||||
pathTextBreakupHelper aPathTextBreakupHelper(
|
||||
*pCandidate,
|
||||
aPolygon,
|
||||
fBasegfxPathLength,
|
||||
fPosition,
|
||||
rTextStart);
|
||||
|
||||
const drawinglayer::primitive2d::Primitive2DContainer& aResult(
|
||||
aPathTextBreakupHelper.getResult());
|
||||
drawinglayer::primitive2d::Primitive2DContainer aResult =
|
||||
aPathTextBreakupHelper.extractResult();
|
||||
|
||||
if(!aResult.empty())
|
||||
{
|
||||
rTarget.append(aResult);
|
||||
rTarget.append(std::move(aResult));
|
||||
}
|
||||
|
||||
// advance position to consumed
|
||||
|
|
Loading…
Reference in a new issue