[Libreoffice-commits] core.git: include/svx sd/source svx/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 4 08:16:57 UTC 2019
include/svx/sdr/contact/viewcontact.hxx | 8 +++++---
include/svx/sdr/contact/viewcontactofsdrobj.hxx | 2 +-
sd/source/core/CustomAnimationEffect.cxx | 2 +-
svx/source/engine3d/view3d.cxx | 2 +-
svx/source/sdr/contact/viewcontact.cxx | 8 ++++----
svx/source/sdr/contact/viewcontactofsdrobj.cxx | 8 ++++----
svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 2 +-
svx/source/sdr/contact/viewcontactofvirtobj.cxx | 2 +-
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 2 +-
svx/source/svdraw/svdobj.cxx | 4 ++--
svx/source/svdraw/svdotxtr.cxx | 2 +-
11 files changed, 22 insertions(+), 20 deletions(-)
New commits:
commit 2340c2ffe46271c5a14e8831b8a8f5b56ed2da8c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 4 09:17:42 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 4 10:16:20 2019 +0200
reduce Primitive2DContainer copying
Change-Id: I418b17034c1949ddda1de7025821ca51f4cdb018
Reviewed-on: https://gerrit.libreoffice.org/78579
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svx/sdr/contact/viewcontact.hxx b/include/svx/sdr/contact/viewcontact.hxx
index edc70af19b54..d3455ac77cd0 100644
--- a/include/svx/sdr/contact/viewcontact.hxx
+++ b/include/svx/sdr/contact/viewcontact.hxx
@@ -124,10 +124,12 @@ public:
// add Gluepoints (if available)
virtual drawinglayer::primitive2d::Primitive2DContainer createGluePointPrimitive2DSequence() const;
- // allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This
+ // Allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This
// is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception
- // for 3D scenes
- virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(const drawinglayer::primitive2d::Primitive2DContainer& rSource) const;
+ // for 3D scenes.
+ // We take the param by value, since, for the common case, we can just std::move into the param, and
+ // std::move the result out, avoiding copying.
+ virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer rSource) const;
virtual basegfx::B2DRange getRange( const drawinglayer::geometry::ViewInformation2D& rViewInfo2D ) const;
diff --git a/include/svx/sdr/contact/viewcontactofsdrobj.hxx b/include/svx/sdr/contact/viewcontactofsdrobj.hxx
index df2840476bcd..2508316a7c9f 100644
--- a/include/svx/sdr/contact/viewcontactofsdrobj.hxx
+++ b/include/svx/sdr/contact/viewcontactofsdrobj.hxx
@@ -77,7 +77,7 @@ public:
// allow embedding if needed (e.g. for SdrObjects, evtl. Name, Title and description get added). This
// is a helper normally used from getViewIndependentPrimitive2DContainer(), but there is one exception
// for 3D scenes
- virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(const drawinglayer::primitive2d::Primitive2DContainer& rSource) const override;
+ virtual drawinglayer::primitive2d::Primitive2DContainer embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer aSource) const override;
};
}}
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 102df7fb1f2f..1a08b9b4d7de 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1563,7 +1563,7 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj
{
::tools::Rectangle aBoundRect(0,0,0,0);
- const drawinglayer::primitive2d::Primitive2DContainer xPrimitives(pObj->GetViewContact().getViewIndependentPrimitive2DContainer());
+ const drawinglayer::primitive2d::Primitive2DContainer& xPrimitives(pObj->GetViewContact().getViewIndependentPrimitive2DContainer());
const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
const basegfx::B2DRange aRange(xPrimitives.getB2DRange(aViewInformation2D));
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index b6d170554f64..67b974b26cb0 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -124,7 +124,7 @@ Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView)
{
// use the view-independent primitive representation (without
// evtl. GridOffset, that may be applied to the DragEntry individually)
- const drawinglayer::primitive2d::Primitive2DContainer aNewSequence(
+ const drawinglayer::primitive2d::Primitive2DContainer& aNewSequence(
pObject->GetViewContact().getViewIndependentPrimitive2DContainer());
maFullOverlay.append(aNewSequence);
}
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx
index 2a6da14f0b6f..c591e6ca9df9 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -235,13 +235,13 @@ drawinglayer::primitive2d::Primitive2DContainer const & ViewContact::getViewInde
if(!xNew.empty())
{
// allow evtl. embedding in object-specific infos, e.g. Name, Title, Description
- xNew = embedToObjectSpecificInformation(xNew);
+ xNew = embedToObjectSpecificInformation(std::move(xNew));
}
if(mxViewIndependentPrimitive2DSequence != xNew)
{
// has changed, copy content
- const_cast< ViewContact* >(this)->mxViewIndependentPrimitive2DSequence = xNew;
+ const_cast< ViewContact* >(this)->mxViewIndependentPrimitive2DSequence = std::move(xNew);
}
// return current Primitive2DContainer
@@ -255,10 +255,10 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContact::createGluePointPrim
return drawinglayer::primitive2d::Primitive2DContainer();
}
-drawinglayer::primitive2d::Primitive2DContainer ViewContact::embedToObjectSpecificInformation(const drawinglayer::primitive2d::Primitive2DContainer& rSource) const
+drawinglayer::primitive2d::Primitive2DContainer ViewContact::embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer aSource) const
{
// nothing to do for default
- return rSource;
+ return aSource;
}
basegfx::B2DRange ViewContact::getRange( const drawinglayer::geometry::ViewInformation2D& /*rViewInfo2D*/ ) const
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index a679d26474fc..91e09e73e7c0 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -174,16 +174,16 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrObj::createGlueP
return xRetval;
}
-drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrObj::embedToObjectSpecificInformation(const drawinglayer::primitive2d::Primitive2DContainer& rSource) const
+drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrObj::embedToObjectSpecificInformation(drawinglayer::primitive2d::Primitive2DContainer aSource) const
{
- if(!rSource.empty() &&
+ if(!aSource.empty() &&
(!GetSdrObject().GetName().isEmpty() ||
!GetSdrObject().GetTitle().isEmpty() ||
!GetSdrObject().GetDescription().isEmpty()))
{
const drawinglayer::primitive2d::Primitive2DReference xRef(
new drawinglayer::primitive2d::ObjectInfoPrimitive2D(
- rSource,
+ aSource,
GetSdrObject().GetName(),
GetSdrObject().GetTitle(),
GetSdrObject().GetDescription()));
@@ -191,7 +191,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrObj::embedToObje
return drawinglayer::primitive2d::Primitive2DContainer { xRef };
}
- return rSource;
+ return aSource;
}
}}
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 8a1029138751..c88644acb6e1 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -135,7 +135,7 @@ namespace sdr
// only visible when transparency involved, but runtime-expensive).
// Thus: Just do not iterate, will check behaviour deeply.
b3DShape = (nullptr != dynamic_cast< const E3dObject* >(pSdrObjRepresentation));
- const drawinglayer::primitive2d::Primitive2DContainer xNew(
+ const drawinglayer::primitive2d::Primitive2DContainer& xNew(
pSdrObjRepresentation->GetViewContact().getViewIndependentPrimitive2DContainer());
xGroup.insert(xGroup.end(), xNew.begin(), xNew.end());
}
diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
index de4a2de1f44a..c78670aa03fb 100644
--- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
@@ -72,7 +72,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfVirtObj::createView
}
// use method from referenced object to get the Primitive2DContainer
- const drawinglayer::primitive2d::Primitive2DContainer xSequenceVirtual(
+ const drawinglayer::primitive2d::Primitive2DContainer& xSequenceVirtual(
GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DContainer());
if(!xSequenceVirtual.empty())
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 37d230372e96..35e5f8f7dcdd 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -1543,7 +1543,7 @@ namespace sdr { namespace contact {
// use the default mechanism. This will create a ControlPrimitive2D without
// handing over a XControl. If not even a XControlModel exists, it will
// create the SdrObject fallback visualisation
- drawinglayer::primitive2d::Primitive2DContainer aTmp = rViewContactOfUnoControl.getViewIndependentPrimitive2DContainer();
+ const drawinglayer::primitive2d::Primitive2DContainer& aTmp = rViewContactOfUnoControl.getViewIndependentPrimitive2DContainer();
rContainer.insert(rContainer.end(), aTmp.begin(), aTmp.end());
return;
}
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index d35bdf8745e5..c08bd1406986 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -906,7 +906,7 @@ void SdrObject::RecalcBoundRect()
{
// Use view-independent data - we do not want any connections
// to e.g. GridOffset in SdrObject-level
- const drawinglayer::primitive2d::Primitive2DContainer xPrimitives(GetViewContact().getViewIndependentPrimitive2DContainer());
+ const drawinglayer::primitive2d::Primitive2DContainer& xPrimitives(GetViewContact().getViewIndependentPrimitive2DContainer());
if(!xPrimitives.empty())
{
@@ -2328,7 +2328,7 @@ SdrObject* SdrObject::ImpConvertToContourObj(bool bForceLineDash)
{
basegfx::B2DPolyPolygon aMergedLineFillPolyPolygon;
basegfx::B2DPolyPolygon aMergedHairlinePolyPolygon;
- const drawinglayer::primitive2d::Primitive2DContainer xSequence(GetViewContact().getViewIndependentPrimitive2DContainer());
+ const drawinglayer::primitive2d::Primitive2DContainer & xSequence(GetViewContact().getViewIndependentPrimitive2DContainer());
if(!xSequence.empty())
{
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 0fbbb20d8bd0..9bc1b66dc654 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -298,7 +298,7 @@ SdrObject* SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const
}
// get primitives
- const drawinglayer::primitive2d::Primitive2DContainer xSequence(GetViewContact().getViewIndependentPrimitive2DContainer());
+ const drawinglayer::primitive2d::Primitive2DContainer & xSequence(GetViewContact().getViewIndependentPrimitive2DContainer());
if(!xSequence.empty())
{
More information about the Libreoffice-commits
mailing list