diff options
author | Noel Grandin <noel@peralex.com> | 2015-12-10 12:27:50 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-12-11 10:11:23 +0200 |
commit | 58d8d8ac67aa9b907f1304a48efa0f7a473d9de4 (patch) | |
tree | a0d88f3c8a57ce9d08d97c803ea0ec83a3dd8b62 /svx/source/sdr/contact/viewcontactofgraphic.cxx | |
parent | 44ad6aca0dee29841ec7cd15c6d0ad9b3dcaedbe (diff) |
tdf#69977: uno::Sequence is expensive
when used as a mutable data-structure. Plain std::vector halves the time
taken to display the chart dialog
Create a class to represent the std::vector we are going to be passing
around, and move some of the utility methods into it to make the code
prettier.
Also create an optimised append(&&) method for the common case of
appending small temporaries.
Change-Id: I7f5b43fb4a8a84e40e6a52fcb7e9f974091b4485
Diffstat (limited to 'svx/source/sdr/contact/viewcontactofgraphic.cxx')
-rw-r--r-- | svx/source/sdr/contact/viewcontactofgraphic.cxx | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index cf1d95d6fe14..862b118d0a81 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -81,11 +81,11 @@ namespace sdr flushViewIndependentPrimitive2DSequence(); } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForPresObj( + drawinglayer::primitive2d::Primitive2DContainer ViewContactOfGraphic::createVIP2DSForPresObj( const basegfx::B2DHomMatrix& rObjectMatrix, const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + drawinglayer::primitive2d::Primitive2DContainer xRetval; GraphicObject aEmptyGraphicObject; GraphicAttr aEmptyGraphicAttr; @@ -95,7 +95,7 @@ namespace sdr rAttribute, aEmptyGraphicObject, aEmptyGraphicAttr)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); + xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReferenceA }; // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and // without attributes @@ -139,17 +139,17 @@ namespace sdr rGraphicObject, aLocalGrafInfo)); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB); + xRetval.push_back(xReferenceB); } return xRetval; } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForDraft( + drawinglayer::primitive2d::Primitive2DContainer ViewContactOfGraphic::createVIP2DSForDraft( const basegfx::B2DHomMatrix& rObjectMatrix, const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + drawinglayer::primitive2d::Primitive2DContainer xRetval; GraphicObject aEmptyGraphicObject; GraphicAttr aEmptyGraphicAttr; @@ -159,7 +159,7 @@ namespace sdr rAttribute, aEmptyGraphicObject, aEmptyGraphicAttr)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); + xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReferenceA }; if(rAttribute.getLine().isDefault()) { @@ -169,7 +169,7 @@ namespace sdr basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rObjectMatrix); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + xRetval.push_back( drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( aOutline, @@ -219,7 +219,7 @@ namespace sdr const basegfx::B2DHomMatrix aBitmapMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( fWidth, fHeight, fShearX, fRotate, aTranslate.getX(), aTranslate.getY())); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + xRetval.push_back( drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::BitmapPrimitive2D( BitmapEx(aDraftBitmap), @@ -284,18 +284,17 @@ namespace sdr // layout the text to more simple TextPrimitives from drawinglayer const drawinglayer::geometry::ViewInformation2D aViewInformation2D; - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( - xRetval, - xBlockTextPrimitive->get2DDecomposition(aViewInformation2D)); + drawinglayer::primitive2d::Primitive2DContainer aDecomposition(xBlockTextPrimitive->get2DDecomposition(aViewInformation2D)); + xRetval.insert(xRetval.end(), aDecomposition.begin(), aDecomposition.end()); } } return xRetval; } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const + drawinglayer::primitive2d::Primitive2DContainer ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + drawinglayer::primitive2d::Primitive2DContainer xRetval; const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); // create and fill GraphicAttr @@ -397,11 +396,11 @@ namespace sdr rGraphicObject, aLocalGrafInfo)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference }; } // always append an invisible outline for the cases where no visible content exists - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + xRetval.push_back( drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( false, aObjectMatrix)); |