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 /svgio/inc | |
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 'svgio/inc')
19 files changed, 39 insertions, 39 deletions
diff --git a/svgio/inc/svgio/svgreader/svgcharacternode.hxx b/svgio/inc/svgio/svgreader/svgcharacternode.hxx index e37145e4dddc..45670ee3a668 100644 --- a/svgio/inc/svgio/svgreader/svgcharacternode.hxx +++ b/svgio/inc/svgio/svgreader/svgcharacternode.hxx @@ -143,7 +143,7 @@ namespace svgio SvgTextPosition& rSvgTextPosition, const SvgStyleAttributes& rSvgStyleAttributes) const; void decomposeTextWithStyle( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition, const SvgStyleAttributes& rSvgStyleAttributes) const; @@ -155,7 +155,7 @@ namespace svgio virtual ~SvgCharacterNode(); virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; - void decomposeText(drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const; + void decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const; void whiteSpaceHandling(); void addGap(); void concatenate(const OUString& rText); diff --git a/svgio/inc/svgio/svgreader/svgcirclenode.hxx b/svgio/inc/svgio/svgreader/svgcirclenode.hxx index a997ed9230fe..9acbe907cf38 100644 --- a/svgio/inc/svgio/svgreader/svgcirclenode.hxx +++ b/svgio/inc/svgio/svgreader/svgcirclenode.hxx @@ -47,7 +47,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// Cx content, set if found in current context const SvgNumber& getCx() const { return maCx; } diff --git a/svgio/inc/svgio/svgreader/svgclippathnode.hxx b/svgio/inc/svgio/svgreader/svgclippathnode.hxx index f49eaebac62c..706d4bd84df2 100644 --- a/svgio/inc/svgio/svgreader/svgclippathnode.hxx +++ b/svgio/inc/svgio/svgreader/svgclippathnode.hxx @@ -45,11 +45,11 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// apply contained clipPath to given geometry #i124852# transform may be needed void apply( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DHomMatrix* pTransform) const; /// clipPathUnits content diff --git a/svgio/inc/svgio/svgreader/svgellipsenode.hxx b/svgio/inc/svgio/svgreader/svgellipsenode.hxx index dbb9f95763f3..040235c75af8 100644 --- a/svgio/inc/svgio/svgreader/svgellipsenode.hxx +++ b/svgio/inc/svgio/svgreader/svgellipsenode.hxx @@ -48,7 +48,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// Cx content, set if found in current context const SvgNumber& getCx() const { return maCx; } diff --git a/svgio/inc/svgio/svgreader/svggnode.hxx b/svgio/inc/svgio/svgreader/svggnode.hxx index d010d04c13ed..8d9ad9dec53f 100644 --- a/svgio/inc/svgio/svgreader/svggnode.hxx +++ b/svgio/inc/svgio/svgreader/svggnode.hxx @@ -45,7 +45,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// transform content const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } diff --git a/svgio/inc/svgio/svgreader/svgimagenode.hxx b/svgio/inc/svgio/svgreader/svgimagenode.hxx index 9e7ca50de7eb..c21a9f5eaf3e 100644 --- a/svgio/inc/svgio/svgreader/svgimagenode.hxx +++ b/svgio/inc/svgio/svgreader/svgimagenode.hxx @@ -55,7 +55,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// SvgAspectRatio content const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; } diff --git a/svgio/inc/svgio/svgreader/svglinenode.hxx b/svgio/inc/svgio/svgreader/svglinenode.hxx index bf0e647a4734..23e20bd3088e 100644 --- a/svgio/inc/svgio/svgreader/svglinenode.hxx +++ b/svgio/inc/svgio/svgreader/svglinenode.hxx @@ -48,7 +48,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// X1 content, set if found in current context const SvgNumber& getX1() const { return maX1; } diff --git a/svgio/inc/svgio/svgreader/svgmarkernode.hxx b/svgio/inc/svgio/svgreader/svgmarkernode.hxx index cc60fc800808..ee4698d599b7 100644 --- a/svgio/inc/svgio/svgreader/svgmarkernode.hxx +++ b/svgio/inc/svgio/svgreader/svgmarkernode.hxx @@ -38,7 +38,7 @@ namespace svgio private: /// buffered decomposition - drawinglayer::primitive2d::Primitive2DSequence aPrimitives; + drawinglayer::primitive2d::Primitive2DContainer aPrimitives; /// use styles SvgStyleAttributes maSvgStyleAttributes; @@ -66,7 +66,7 @@ namespace svgio virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; /// get marker primitives buffered, uses decomposeSvgNode internally - const drawinglayer::primitive2d::Primitive2DSequence& getMarkerPrimitives() const; + const drawinglayer::primitive2d::Primitive2DContainer& getMarkerPrimitives() const; /// InfoProvider support for % values virtual const basegfx::B2DRange getCurrentViewPort() const override; diff --git a/svgio/inc/svgio/svgreader/svgmasknode.hxx b/svgio/inc/svgio/svgreader/svgmasknode.hxx index 231aa179aa9f..84c4bb1de38a 100644 --- a/svgio/inc/svgio/svgreader/svgmasknode.hxx +++ b/svgio/inc/svgio/svgreader/svgmasknode.hxx @@ -50,11 +50,11 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// apply contained clipPath to given geometry #i124852# transform may be needed void apply( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DHomMatrix* pTransform) const; /// x content, set if found in current context diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx b/svgio/inc/svgio/svgreader/svgnode.hxx index d951a284b20c..ab7f28a2850d 100644 --- a/svgio/inc/svgio/svgreader/svgnode.hxx +++ b/svgio/inc/svgio/svgreader/svgnode.hxx @@ -144,7 +144,7 @@ namespace svgio void parseAttributes(const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs); virtual const SvgStyleAttributes* getSvgStyleAttributes() const; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent); - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const; /// #i125258# tell if this node is allowed to have a parent style (e.g. defs do not) virtual bool supportsParentStyle() const; diff --git a/svgio/inc/svgio/svgreader/svgpathnode.hxx b/svgio/inc/svgio/svgreader/svgpathnode.hxx index d8645d8e50a3..0c24244455fb 100644 --- a/svgio/inc/svgio/svgreader/svgpathnode.hxx +++ b/svgio/inc/svgio/svgreader/svgpathnode.hxx @@ -48,7 +48,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// path content, set if found in current context const basegfx::B2DPolyPolygon* getPath() const { return mpPolyPolygon; } diff --git a/svgio/inc/svgio/svgreader/svgpatternnode.hxx b/svgio/inc/svgio/svgreader/svgpatternnode.hxx index f526346609ac..a5b6870ba8fe 100644 --- a/svgio/inc/svgio/svgreader/svgpatternnode.hxx +++ b/svgio/inc/svgio/svgreader/svgpatternnode.hxx @@ -31,7 +31,7 @@ namespace svgio { private: /// buffered decomposition - drawinglayer::primitive2d::Primitive2DSequence aPrimitives; + drawinglayer::primitive2d::Primitive2DContainer aPrimitives; /// use styles SvgStyleAttributes maSvgStyleAttributes; @@ -69,7 +69,7 @@ namespace svgio void getValuesRelative(double& rfX, double& rfY, double& rfW, double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode& rUser) const; /// get pattern primitives buffered, uses decomposeSvgNode internally - const drawinglayer::primitive2d::Primitive2DSequence& getPatternPrimitives() const; + const drawinglayer::primitive2d::Primitive2DContainer& getPatternPrimitives() const; /// InfoProvider support for % values virtual const basegfx::B2DRange getCurrentViewPort() const override; diff --git a/svgio/inc/svgio/svgreader/svgpolynode.hxx b/svgio/inc/svgio/svgreader/svgpolynode.hxx index 28b72305771a..0e47c7499c2e 100644 --- a/svgio/inc/svgio/svgreader/svgpolynode.hxx +++ b/svgio/inc/svgio/svgreader/svgpolynode.hxx @@ -50,7 +50,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// type read access bool isPolyline() const { return mbIsPolyline; } diff --git a/svgio/inc/svgio/svgreader/svgrectnode.hxx b/svgio/inc/svgio/svgreader/svgrectnode.hxx index 414091305a88..f103876ab49a 100644 --- a/svgio/inc/svgio/svgreader/svgrectnode.hxx +++ b/svgio/inc/svgio/svgreader/svgrectnode.hxx @@ -50,7 +50,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// x content, set if found in current context const SvgNumber& getX() const { return maX; } diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx index cb1982dd3578..c227986b7d35 100644 --- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx +++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx @@ -232,35 +232,35 @@ namespace svgio /// internal helpers void add_fillGradient( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgGradientNode& rFillGradient, const basegfx::B2DRange& rGeoRange) const; void add_fillPatternTransform( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgPatternNode& rFillGradient, const basegfx::B2DRange& rGeoRange) const; void add_fillPattern( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgPatternNode& rFillGradient, const basegfx::B2DRange& rGeoRange) const; void add_fill( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DRange& rGeoRange) const; void add_stroke( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DRange& rGeoRange) const; bool prepare_singleMarker( - drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives, + drawinglayer::primitive2d::Primitive2DContainer& rMarkerPrimitives, basegfx::B2DHomMatrix& rMarkerTransform, basegfx::B2DRange& rClipRange, const SvgMarkerNode& rMarker) const; void add_markers( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::tools::PointIndexSet* pHelpPointIndices) const; public: @@ -270,15 +270,15 @@ namespace svgio /// helper which does the necessary with a given path void add_text( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - drawinglayer::primitive2d::Primitive2DSequence& rSource) const; + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rSource) const; void add_path( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::tools::PointIndexSet* pHelpPointIndices) const; void add_postProcess( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - const drawinglayer::primitive2d::Primitive2DSequence& rSource, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + const drawinglayer::primitive2d::Primitive2DContainer& rSource, const basegfx::B2DHomMatrix* pTransform) const; /// helper to set mpCssStyleParent temporarily for CSS style hierarchies diff --git a/svgio/inc/svgio/svgreader/svgsvgnode.hxx b/svgio/inc/svgio/svgreader/svgsvgnode.hxx index 158c832ab2f4..15d49505bc4c 100644 --- a/svgio/inc/svgio/svgreader/svgsvgnode.hxx +++ b/svgio/inc/svgio/svgreader/svgsvgnode.hxx @@ -56,7 +56,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// Seeks width and height of viewport, which is current before the new viewport is set. // needed for percentage unit in x, y, width or height diff --git a/svgio/inc/svgio/svgreader/svgtextnode.hxx b/svgio/inc/svgio/svgreader/svgtextnode.hxx index 6d0d5c558d00..7922f133b979 100644 --- a/svgio/inc/svgio/svgreader/svgtextnode.hxx +++ b/svgio/inc/svgio/svgreader/svgtextnode.hxx @@ -41,12 +41,12 @@ namespace svgio /// local helpers void DecomposeChild( const SvgNode& rCandidate, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const; static void addTextPrimitives( const SvgNode& rCandidate, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - drawinglayer::primitive2d::Primitive2DSequence& rSource); + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rSource); public: SvgTextNode( @@ -56,7 +56,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// transform content, set if found in current context const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } diff --git a/svgio/inc/svgio/svgreader/svgtextpathnode.hxx b/svgio/inc/svgio/svgreader/svgtextpathnode.hxx index 93ed9f82825e..c0e4242ed27d 100644 --- a/svgio/inc/svgio/svgreader/svgtextpathnode.hxx +++ b/svgio/inc/svgio/svgreader/svgtextpathnode.hxx @@ -54,8 +54,8 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; void decomposePathNode( - const drawinglayer::primitive2d::Primitive2DSequence& rPathContent, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const drawinglayer::primitive2d::Primitive2DContainer& rPathContent, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DPoint& rTextStart) const; bool isValid() const; diff --git a/svgio/inc/svgio/svgreader/svgusenode.hxx b/svgio/inc/svgio/svgreader/svgusenode.hxx index 4f788db09bdb..d235747e5ff4 100644 --- a/svgio/inc/svgio/svgreader/svgusenode.hxx +++ b/svgio/inc/svgio/svgreader/svgusenode.hxx @@ -52,7 +52,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// transform content const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } |