diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-05-29 20:43:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-30 10:07:12 +0200 |
commit | 30400ebae2a46524558925424d41e612f1c1dc17 (patch) | |
tree | 8e7406573ac758dd9765c89804ad41f9e72f35fa /svx | |
parent | f0c82758f814c58f65e8cfb54bf01a97b1d73261 (diff) |
use Primitive2DContainer in impPolygonParagraphHandler
which lets me move data around instead of copying
Change-Id: Ibc7d8c2b5e0244537aa66561132facd93b424d61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135101
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdotextpathdecomposition.cxx | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 3755da168c18..14bbd73ca4a6 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -193,8 +193,8 @@ namespace class impPolygonParagraphHandler { const drawinglayer::attribute::SdrFormTextAttribute maSdrFormTextAttribute; // FormText parameters - std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list - std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow + drawinglayer::primitive2d::Primitive2DContainer& mrDecomposition; // destination primitive list + drawinglayer::primitive2d::Primitive2DContainer& mrShadowDecomposition; // destination primitive list for shadow Reference < css::i18n::XBreakIterator > mxBreak; // break iterator static double getParagraphTextLength(const ::std::vector< const impPathTextPortion* >& rTextPortions) @@ -231,8 +231,8 @@ namespace public: impPolygonParagraphHandler( const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, - std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition, - std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition) + drawinglayer::primitive2d::Primitive2DContainer& rDecomposition, + drawinglayer::primitive2d::Primitive2DContainer& rShadowDecomposition) : maSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) @@ -566,14 +566,14 @@ namespace } drawinglayer::primitive2d::Primitive2DContainer impAddPathTextOutlines( - const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rSource, + const drawinglayer::primitive2d::Primitive2DContainer& rSource, const drawinglayer::attribute::SdrFormTextOutlineAttribute& rOutlineAttribute) { drawinglayer::primitive2d::Primitive2DContainer aNewPrimitives; - for(drawinglayer::primitive2d::BasePrimitive2D* a : rSource) + for(const drawinglayer::primitive2d::Primitive2DReference& a : rSource) { - const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pTextCandidate = dynamic_cast< const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* >(a); + const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pTextCandidate = dynamic_cast< const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* >(a.get()); if(pTextCandidate) { @@ -661,8 +661,8 @@ void SdrTextObj::impDecomposePathTextPrimitive( if(nLoopCount) { // prepare common decomposition stuff - std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition; - std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition; + drawinglayer::primitive2d::Primitive2DContainer aRegularDecomposition; + drawinglayer::primitive2d::Primitive2DContainer aShadowDecomposition; impPolygonParagraphHandler aPolygonParagraphHandler( rFormTextAttribute, aRegularDecomposition, @@ -695,17 +695,12 @@ void SdrTextObj::impDecomposePathTextPrimitive( if(nShadowCount) { // add shadow primitives to decomposition - aRetvalA.resize(nShadowCount); - - for(a = 0; a < nShadowCount; a++) - { - aRetvalA[a] = drawinglayer::primitive2d::Primitive2DReference(aShadowDecomposition[a]); - } // if necessary, add shadow outlines if(rFormTextAttribute.getFormTextOutline() && !rFormTextAttribute.getShadowOutline().isDefault()) { + aRetvalA = aShadowDecomposition; const drawinglayer::primitive2d::Primitive2DContainer aOutlines( impAddPathTextOutlines( aShadowDecomposition, @@ -713,22 +708,19 @@ void SdrTextObj::impDecomposePathTextPrimitive( aRetvalA.append(aOutlines); } + else + aRetvalA = std::move(aShadowDecomposition); } if(nRegularCount) { // add normal primitives to decomposition - aRetvalB.resize(nRegularCount); - - for(a = 0; a < nRegularCount; a++) - { - aRetvalB[a] = drawinglayer::primitive2d::Primitive2DReference(aRegularDecomposition[a]); - } // if necessary, add outlines if(rFormTextAttribute.getFormTextOutline() && !rFormTextAttribute.getOutline().isDefault()) { + aRetvalB = aRegularDecomposition; const drawinglayer::primitive2d::Primitive2DContainer aOutlines( impAddPathTextOutlines( aRegularDecomposition, @@ -736,6 +728,8 @@ void SdrTextObj::impDecomposePathTextPrimitive( aRetvalB.append(aOutlines); } + else + aRetvalB = std::move(aRegularDecomposition); } } } @@ -746,8 +740,8 @@ void SdrTextObj::impDecomposePathTextPrimitive( rOutliner.setVisualizedPage(nullptr); // concatenate all results - rTarget.append(aRetvalA); - rTarget.append(aRetvalB); + rTarget.append(std::move(aRetvalA)); + rTarget.append(std::move(aRetvalB)); } |