diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-11 14:29:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-11 21:43:49 +0200 |
commit | 05f47e6d9f0c442e481b2435cc5c2ef615ab347a (patch) | |
tree | bfa2c4c29007a63d42a227456f2fc6717e79ccb3 /sw | |
parent | f9b104abc1185d4f9f3af66f49ec9e39f85a1c36 (diff) |
replace 'resize(size+1)' with emplace_back
which is considerably faster if we're dealing with a std::list, and just
easier on the eyes if we're dealing with a std::vector
Change-Id: I373689205ebc048689f29ab80a7ee8551b20cc96
Reviewed-on: https://gerrit.libreoffice.org/39816
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/access/accpara.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/docvw/HeaderFooterWin.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PageBreakWin.cxx | 4 |
5 files changed, 9 insertions, 11 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 75604978ceb4..7f258ab1baf7 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -622,7 +622,7 @@ protected: void setTestInteractionHandler(const char* pPassword, std::vector<beans::PropertyValue>& rFilterOptions) { OUString sPassword = OUString::createFromAscii(pPassword); - rFilterOptions.resize(rFilterOptions.size() + 1); + rFilterOptions.emplace_back(); xInteractionHandler = rtl::Reference<TestInteractionHandler>(new TestInteractionHandler(sPassword)); uno::Reference<task::XInteractionHandler2> const xInteraction(xInteractionHandler.get()); rFilterOptions[0].Name = "InteractionHandler"; diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 3721a83df8a3..3bba2d24c3a6 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1628,13 +1628,13 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes( _correctValues( nIndex, aValues ); - aValues.resize( aValues.size() + 1 ); + aValues.emplace_back(); OUString strTypeName = GetFieldTypeNameAtIndex(nIndex); if (!strTypeName.isEmpty()) { - aValues.resize( aValues.size() + 1 ); - PropertyValue& rValueFT = aValues[aValues.size() - 1]; + aValues.emplace_back(); + PropertyValue& rValueFT = aValues.back(); rValueFT.Name = "FieldType"; rValueFT.Value <<= strTypeName.toAsciiLowerCase(); rValueFT.Handle = -1; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 7d9e1d4c8df8..c0ddb50d4ad1 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3832,7 +3832,6 @@ void SwColumnFrame::PaintBreak( ) const drawinglayer::primitive2d::Primitive2DContainer aSeq = lcl_CreateDashedIndicatorPrimitive( aStart, aEnd, aLineColor ); - aSeq.resize( aSeq.size( ) + 1 ); // Add the text above OUString aBreakText = SwResId(STR_COLUMN_BREAK); @@ -3867,7 +3866,7 @@ void SwColumnFrame::PaintBreak( ) const aFontAttr, lang::Locale(), aLineColor ); - aSeq[ aSeq.size() - 1 ] = drawinglayer::primitive2d::Primitive2DReference( pText ); + aSeq.push_back( drawinglayer::primitive2d::Primitive2DReference( pText ) ); ProcessPrimitives( aSeq ); } diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index ca5c7857d96c..9d567d207236 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -351,10 +351,9 @@ void SwHeaderFooterWin::Paint(vcl::RenderContext& rRenderContext, const ::tools: if (Application::GetSettings().GetStyleSettings().GetHighContrastMode()) aSignColor = Color(COL_WHITE).getBColor(); - aSeq.resize(aSeq.size() + 1); - aSeq[aSeq.size() - 1] = drawinglayer::primitive2d::Primitive2DReference( + aSeq.push_back( drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - B2DPolyPolygon(aSign), aSignColor)); + B2DPolyPolygon(aSign), aSignColor)) ); // Create the processor and process the primitives const drawinglayer::geometry::ViewInformation2D aNewViewInfos; diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 5615b3f8cd9f..fa1c78afe3af 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -196,8 +196,8 @@ void SwPageBreakWin::Paint(vcl::RenderContext& rRenderContext, const ::tools::Re if (Application::GetSettings().GetStyleSettings().GetHighContrastMode()) aTriangleColor = Color(COL_WHITE).getBColor(); - aSeq.resize(aSeq.size() + 1); - aSeq[aSeq.size() - 1].set( new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + aSeq.emplace_back(); + aSeq.back().set( new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( B2DPolyPolygon(aTriangle), aTriangleColor)); drawinglayer::primitive2d::Primitive2DContainer aGhostedSeq(1); |