diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-09 09:47:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-09 08:54:01 +0000 |
commit | 3a545893029c524afc0d5d6b6b6ca486c5be991c (patch) | |
tree | f286991b7341ca02a50054e059b1a43534c4484b /include | |
parent | 81e3f5f2fdc9c573c83a37009080e4bb974c7955 (diff) |
convert Primitive2DContainer to std::deque
since we only care about appending to this container, and then
traversing it (normally once). So reduce the re-allocations that
std::vector requires
Change-Id: I206a7b82d9eefc1fa3762c4a03e7b5e21136951f
Reviewed-on: https://gerrit.libreoffice.org/30706
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/drawinglayer/primitive2d/baseprimitive2d.hxx | 17 | ||||
-rw-r--r-- | include/drawinglayer/primitive3d/baseprimitive3d.hxx | 15 | ||||
-rw-r--r-- | include/vcl/svgdata.hxx | 7 |
3 files changed, 21 insertions, 18 deletions
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx index fbfafae783ca..66250bb59511 100644 --- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/util/XAccounting.hpp> #include <cppuhelper/basemutex.hxx> #include <basegfx/range/b2drange.hxx> +#include <deque> /** defines for DeclPrimitive2DIDBlock and ImplPrimitive2DIDBlock @@ -58,21 +59,21 @@ namespace drawinglayer { namespace primitive2d { typedef css::uno::Sequence< Primitive2DReference > Primitive2DSequence; - class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive2DContainer : public std::vector< Primitive2DReference > + class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive2DContainer : public std::deque< Primitive2DReference > { public: explicit Primitive2DContainer() {} - explicit Primitive2DContainer( size_type count ) : vector(count) {} - Primitive2DContainer( const Primitive2DContainer& other ) : vector(other) {} - Primitive2DContainer( const Primitive2DContainer&& other ) : vector(other) {} - Primitive2DContainer( const vector< Primitive2DReference >& other ) : vector(other) {} - Primitive2DContainer( std::initializer_list<Primitive2DReference> init ) : vector(init) {} + explicit Primitive2DContainer( size_type count ) : deque(count) {} + Primitive2DContainer( const Primitive2DContainer& other ) : deque(other) {} + Primitive2DContainer( const Primitive2DContainer&& other ) : deque(other) {} + Primitive2DContainer( const std::deque< Primitive2DReference >& other ) : deque(other) {} + Primitive2DContainer( std::initializer_list<Primitive2DReference> init ) : deque(init) {} void append(const Primitive2DContainer& rSource); void append(const Primitive2DSequence& rSource); void append(Primitive2DContainer&& rSource); - Primitive2DContainer& operator=(const Primitive2DContainer& r) { vector::operator=(r); return *this; } - Primitive2DContainer& operator=(const Primitive2DContainer&& r) { vector::operator=(r); return *this; } + Primitive2DContainer& operator=(const Primitive2DContainer& r) { deque::operator=(r); return *this; } + Primitive2DContainer& operator=(const Primitive2DContainer&& r) { deque::operator=(r); return *this; } bool operator==(const Primitive2DContainer& rB) const; bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); } basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const; diff --git a/include/drawinglayer/primitive3d/baseprimitive3d.hxx b/include/drawinglayer/primitive3d/baseprimitive3d.hxx index ef75d4e808e1..61a563485e75 100644 --- a/include/drawinglayer/primitive3d/baseprimitive3d.hxx +++ b/include/drawinglayer/primitive3d/baseprimitive3d.hxx @@ -26,6 +26,7 @@ #include <cppuhelper/basemutex.hxx> #include <com/sun/star/graphic/XPrimitive3D.hpp> #include <basegfx/range/b3drange.hxx> +#include <deque> /** defines for DeclPrimitive3DIDBlock and ImplPrimitive3DIDBlock @@ -53,18 +54,18 @@ namespace drawinglayer { namespace primitive3d { typedef css::uno::Reference< css::graphic::XPrimitive3D > Primitive3DReference; typedef css::uno::Sequence< Primitive3DReference > Primitive3DSequence; - class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive3DContainer : public std::vector< Primitive3DReference > + class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive3DContainer : public std::deque< Primitive3DReference > { public: explicit Primitive3DContainer() {} - explicit Primitive3DContainer( size_type count ) : vector(count) {} - Primitive3DContainer( const Primitive3DContainer& other ) : vector(other) {} - Primitive3DContainer( const Primitive3DContainer&& other ) : vector(other) {} - Primitive3DContainer( std::initializer_list<Primitive3DReference> init ) : vector(init) {} + explicit Primitive3DContainer( size_type count ) : deque(count) {} + Primitive3DContainer( const Primitive3DContainer& other ) : deque(other) {} + Primitive3DContainer( const Primitive3DContainer&& other ) : deque(other) {} + Primitive3DContainer( std::initializer_list<Primitive3DReference> init ) : deque(init) {} void append(const Primitive3DContainer& rSource); - Primitive3DContainer& operator=(const Primitive3DContainer& r) { vector::operator=(r); return *this; } - Primitive3DContainer& operator=(const Primitive3DContainer&& r) { vector::operator=(r); return *this; } + Primitive3DContainer& operator=(const Primitive3DContainer& r) { deque::operator=(r); return *this; } + Primitive3DContainer& operator=(const Primitive3DContainer&& r) { deque::operator=(r); return *this; } bool operator==(const Primitive3DContainer& rB) const; bool operator!=(const Primitive3DContainer& rB) const { return !operator==(rB); } basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& aViewInformation) const; diff --git a/include/vcl/svgdata.hxx b/include/vcl/svgdata.hxx index 740137804d27..7ab2d8ce89c8 100644 --- a/include/vcl/svgdata.hxx +++ b/include/vcl/svgdata.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/graphic/XPrimitive2D.hpp> #include <vcl/bitmapex.hxx> #include <rtl/ustring.hxx> +#include <deque> typedef css::uno::Sequence<sal_Int8> SvgDataArray; @@ -33,7 +34,7 @@ typedef css::uno::Sequence<sal_Int8> SvgDataArray; // using default parameters and graphic::XPrimitive2DRenderer BitmapEx VCL_DLLPUBLIC convertPrimitive2DSequenceToBitmapEx( - const std::vector< css::uno::Reference< css::graphic::XPrimitive2D > >& rSequence, + const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& rSequence, const basegfx::B2DRange& rTargetRange, const sal_uInt32 nMaximumQuadraticPixels = 500000); @@ -49,7 +50,7 @@ private: // on demand created content basegfx::B2DRange maRange; - std::vector< css::uno::Reference< css::graphic::XPrimitive2D > > + std::deque< css::uno::Reference< css::graphic::XPrimitive2D > > maSequence; BitmapEx maReplacement; size_t mNestedBitmapSize; @@ -74,7 +75,7 @@ public: /// data read and evtl. on demand creation const basegfx::B2DRange& getRange() const; - const std::vector< css::uno::Reference< css::graphic::XPrimitive2D > >& getPrimitive2DSequence() const; + const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& getPrimitive2DSequence() const; const BitmapEx& getReplacement() const; }; |