diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 16:01:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-13 07:10:55 +0100 |
commit | d7d9edb27e0e512fac6b5618bfd369cafc6edc1e (patch) | |
tree | 3c7f348d9614a9a961fe9524fdf103468b225976 /tools/inc | |
parent | dacb12d219fd060504553bf29e8536bdb747c930 (diff) |
loplugin:useuniqueptr in PolyPolygon
Also
- convert to o3tl::cow_wrapper
- drop the second param to the constructor and just
let vector use it's own resize logic
- bump MAX_POLYGONS from 0x3FF0 to 0xffff so that the
ios2met filter can load it's files properly.
Change-Id: I9db19e4f7b4f946e801ea07c31d2d0ded7837a0e
Reviewed-on: https://gerrit.libreoffice.org/47789
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools/inc')
-rw-r--r-- | tools/inc/poly.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/tools/inc/poly.h b/tools/inc/poly.h index e59123f06473..88da80ca1615 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -53,27 +53,37 @@ public: bool ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon const * pInitPoly = nullptr ); }; -#define MAX_POLYGONS ((sal_uInt16)0x3FF0) +#define MAX_POLYGONS SAL_MAX_UINT16 namespace tools { class Polygon; } -class SAL_WARN_UNUSED ImplPolyPolygon +struct ImplPolyPolygon { -public: - tools::Polygon** mpPolyAry; - sal_uInt32 mnRefCount; - sal_uInt16 mnCount; - sal_uInt16 mnSize; - sal_uInt16 mnResize; + std::vector<tools::Polygon> mvPolyAry; + + ImplPolyPolygon( sal_uInt16 nInitSize ) + { + if ( !nInitSize ) + nInitSize = 1; + mvPolyAry.reserve(nInitSize); + } + + ImplPolyPolygon( const tools::Polygon& rPoly ) + { + if ( rPoly.GetSize() ) + mvPolyAry.push_back(rPoly); + else + mvPolyAry.reserve(16); + } + + ImplPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon); - ImplPolyPolygon( sal_uInt16 nInitSize, sal_uInt16 nResize ) - { mpPolyAry = nullptr; mnCount = 0; mnRefCount = 1; - mnSize = nInitSize; mnResize = nResize; } - ImplPolyPolygon( sal_uInt16 nInitSize ); - ImplPolyPolygon( const ImplPolyPolygon& rImplPolyPoly ); - ~ImplPolyPolygon(); + bool operator==(ImplPolyPolygon const & other) const + { + return mvPolyAry == other.mvPolyAry; + } }; #endif |