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 /drawinglayer/source/primitive2d/polypolygonprimitive2d.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 'drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx')
-rw-r--r-- | drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index ec18be6997b0..adaf4ddec411 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -42,14 +42,14 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DSequence aRetval(nCount); + Primitive2DContainer aRetval(nCount); for(sal_uInt32 a(0L); a < nCount; a++) { @@ -60,7 +60,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -102,14 +102,14 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DSequence aRetval(nCount); + Primitive2DContainer aRetval(nCount); for(sal_uInt32 a(0L); a < nCount; a++) { @@ -125,7 +125,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -175,14 +175,14 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DSequence aRetval(nCount); + Primitive2DContainer aRetval(nCount); for(sal_uInt32 a(0L); a < nCount; a++) { @@ -195,7 +195,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -300,7 +300,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGradient().isDefault()) { @@ -311,17 +311,17 @@ namespace drawinglayer getDefinitionRange(), getFillGradient()); const Primitive2DReference xSubRef(pNewGradient); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); + const Primitive2DContainer aSubSequence { xSubRef }; // create mask primitive MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1); + return Primitive2DContainer { xRef }; } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -372,7 +372,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillHatch().isDefault()) { @@ -384,17 +384,17 @@ namespace drawinglayer getBackgroundColor(), getFillHatch()); const Primitive2DReference xSubRef(pNewHatch); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); + const Primitive2DContainer aSubSequence { xSubRef }; // create mask primitive MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1); + return Primitive2DContainer { xRef }; } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -450,7 +450,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGraphic().isDefault()) { @@ -521,14 +521,14 @@ namespace drawinglayer const Primitive2DReference xRef( new MaskPrimitive2D( getB2DPolyPolygon(), - Primitive2DSequence(&xSubRef, 1))); + Primitive2DContainer { xSubRef })); - return Primitive2DSequence(&xRef, 1); + return Primitive2DContainer { xRef }; } } } - return Primitive2DSequence(); + return Primitive2DContainer(); } PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( @@ -578,9 +578,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(getTransparence() < 1.0 && getB2DPolyPolygon().count()) { @@ -592,7 +592,7 @@ namespace drawinglayer getB2DPolyPolygon(), getColor())); - aRetval = Primitive2DSequence(&aFill, 1); + aRetval = Primitive2DContainer { aFill }; } if(getDiscreteGrow() > 0.0) @@ -605,18 +605,18 @@ namespace drawinglayer getB2DPolyPolygon(), aLineAttribute)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFatLine); + aRetval.push_back(aFatLine); } // embed filled to transparency (if used) - if(aRetval.getLength() && getTransparence() > 0.0) + if(!aRetval.empty() && getTransparence() > 0.0) { const Primitive2DReference aTrans( new UnifiedTransparencePrimitive2D( aRetval, getTransparence())); - aRetval = Primitive2DSequence(&aTrans, 1); + aRetval = Primitive2DContainer { aTrans }; } } |