summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-09-09 13:00:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-09 15:22:52 +0200
commit8104d771b10a5c8b15eae4b67aa112ae2ef77b5b (patch)
tree095a091a90104689a1d6d53ed7060feb0973c1ea /svx/source/svdraw
parentca512f301faf42b7d23675ca251b20e0ad67db1b (diff)
tdf#144052 reduce Primitive2D copying
when creating charts, by using a Primitive2DContainer&& parameter in the GroupPrimitive2D constructor, which forces the call sites to pass a temporary, and at most call sites, we can std::move in an existing local variable. Change-Id: I531970918800c6832ab606b5a4ff5fd2d47ccf5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121844 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svddrgmt.cxx4
-rw-r--r--svx/source/svdraw/svdhdl.cxx2
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx22
-rw-r--r--svx/source/svdraw/svdotextpathdecomposition.cxx2
4 files changed, 14 insertions, 16 deletions
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 92958e1b7750..17376206f8a7 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -194,7 +194,7 @@ drawinglayer::primitive2d::Primitive2DContainer SdrDragEntryPrimitive2DSequence:
drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D(
new drawinglayer::primitive2d::TransformPrimitive2D(
rDragMethod.getCurrentTransformation(),
- maPrimitive2DSequence));
+ drawinglayer::primitive2d::Primitive2DContainer(maPrimitive2DSequence)));
return drawinglayer::primitive2d::Primitive2DContainer { aTransformPrimitive2D };
}
@@ -788,7 +788,7 @@ void SdrDragMethod::CreateOverlayGeometry(
if(!aResultTransparent.empty())
{
- drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5));
+ drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(std::move(aResultTransparent), 0.5));
aResultTransparent = drawinglayer::primitive2d::Primitive2DContainer { aUnifiedTransparencePrimitive2D };
std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 249557f35e26..85d46f99a00e 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2636,7 +2636,7 @@ void SdrCropViewHdl::CreateB2dIAObject()
const drawinglayer::primitive2d::Primitive2DReference aMaskedGraphic(
new drawinglayer::primitive2d::MaskPrimitive2D(
aCropPolyPolygon,
- aCombination));
+ std::move(aCombination)));
// embed to UnifiedTransparencePrimitive2D
const drawinglayer::primitive2d::Primitive2DReference aTransparenceMaskedGraphic(
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 962636ac6a8d..a27db44eca73 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -362,9 +362,9 @@ namespace
if(rInfo.mbEndOfBullet)
{
// embed in TextHierarchyBulletPrimitive2D
- const drawinglayer::primitive2d::Primitive2DReference aNewReference(pNewPrimitive);
- const drawinglayer::primitive2d::Primitive2DContainer aNewSequence { aNewReference } ;
- pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
+ drawinglayer::primitive2d::Primitive2DReference aNewReference(pNewPrimitive);
+ drawinglayer::primitive2d::Primitive2DContainer aNewSequence { aNewReference } ;
+ pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(std::move(aNewSequence));
}
if(rInfo.mpFieldData)
@@ -465,15 +465,15 @@ namespace
meValues.emplace_back("Representation", pURLField->GetRepresentation());
meValues.emplace_back("TargetFrame", pURLField->GetTargetFrame());
meValues.emplace_back("SvxURLFormat", OUString::number(static_cast<sal_uInt16>(pURLField->GetFormat())));
- xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_URL, &meValues);
+ xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(std::move(aSequence), drawinglayer::primitive2d::FIELD_TYPE_URL, &meValues);
}
else if(pPageField)
{
- xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_PAGE);
+ xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(std::move(aSequence), drawinglayer::primitive2d::FIELD_TYPE_PAGE);
}
else
{
- xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_COMMON);
+ xRet = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(std::move(aSequence), drawinglayer::primitive2d::FIELD_TYPE_COMMON);
}
}
@@ -486,8 +486,7 @@ namespace
// empty line primitives (contrary to paragraphs, see below).
if(!maTextPortionPrimitives.empty())
{
- maLinePrimitives.push_back(new drawinglayer::primitive2d::TextHierarchyLinePrimitive2D(maTextPortionPrimitives));
- maTextPortionPrimitives.clear();
+ maLinePrimitives.push_back(new drawinglayer::primitive2d::TextHierarchyLinePrimitive2D(std::move(maTextPortionPrimitives)));
}
}
@@ -504,9 +503,8 @@ namespace
// have an empty sub-PrimitiveSequence.
maParagraphPrimitives.push_back(
new drawinglayer::primitive2d::TextHierarchyParagraphPrimitive2D(
- maLinePrimitives,
+ std::move(maLinePrimitives),
nOutlineLevel));
- maLinePrimitives.clear();
}
void impTextBreakupHandler::impHandleDrawPortionInfo(const DrawPortionInfo& rInfo)
@@ -550,8 +548,8 @@ namespace
aGraphicAttr));
// embed in TextHierarchyBulletPrimitive2D
- const drawinglayer::primitive2d::Primitive2DContainer aNewSequence { aNewReference };
- rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
+ drawinglayer::primitive2d::Primitive2DContainer aNewSequence { aNewReference };
+ rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(std::move(aNewSequence));
// add to output
maTextPortionPrimitives.push_back(pNewPrimitive);
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
index 292ad9c2b7b4..66476eecbc75 100644
--- a/svx/source/svdraw/svdotextpathdecomposition.cxx
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -610,7 +610,7 @@ namespace
aNewPrimitives.push_back(
new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
- aStrokePrimitiveSequence,
+ std::move(aStrokePrimitiveSequence),
static_cast<double>(rOutlineAttribute.getTransparence()) / 100.0) );
}
else