From c8d2fa176a15a7ae76d6a4b76aea5f108313c2ec Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 23 Sep 2021 15:35:34 +0200 Subject: reduce copying in drawinglayer by passing PrimitiveContainer&& around. There are lots of place where we were preparing a local variable of type PrimitiveContainer, and then copying it someplace else, then throwing it away. Change-Id: Iacfd983640c9e55da25800ccc01734dfc8b4d64a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122527 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/core/layout/paintfrm.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sw') diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 1ff9e4eda7db..a16051590406 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -226,7 +226,7 @@ class BorderLines { drawinglayer::primitive2d::Primitive2DContainer m_Lines; public: - void AddBorderLines(const drawinglayer::primitive2d::Primitive2DContainer& rContainer); + void AddBorderLines(drawinglayer::primitive2d::Primitive2DContainer&& rContainer); drawinglayer::primitive2d::Primitive2DContainer GetBorderLines_Clear() { drawinglayer::primitive2d::Primitive2DContainer lines; @@ -504,11 +504,11 @@ SwSavePaintStatics::~SwSavePaintStatics() gProp.aSScaleY = aSScaleY; } -void BorderLines::AddBorderLines(const drawinglayer::primitive2d::Primitive2DContainer& rContainer) +void BorderLines::AddBorderLines(drawinglayer::primitive2d::Primitive2DContainer&& rContainer) { if(!rContainer.empty()) { - m_Lines.append(rContainer); + m_Lines.append(std::move(rContainer)); } } @@ -4938,7 +4938,7 @@ void PaintCharacterBorder( aStyleRight, aStyleBottom, aStyleLeft))); - gProp.pBLines->AddBorderLines(aBorderLineTarget); + gProp.pBLines->AddBorderLines(std::move(aBorderLineTarget)); } /// #i15844# @@ -5323,7 +5323,7 @@ void SwFrame::PaintSwFrameShadowAndBorder( aStyleRight, aStyleBottom, aStyleLeft))); - gProp.pBLines->AddBorderLines(aBorderLineTarget); + gProp.pBLines->AddBorderLines(std::move(aBorderLineTarget)); } } -- cgit