diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-28 09:49:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-05 07:26:08 +0100 |
commit | 8a9f8d35b000e37f08d391958eca0d51269a23dd (patch) | |
tree | 5c51c37eb15a1fb5a060be675cdb7eb7741fc972 /svgio | |
parent | b687cebfb1488341853824de1a15c06175c94258 (diff) |
loplugin:useuniqueptr in SvgPathNode
Change-Id: I8e4485a308edecf05a2bc70d5c067af3b0eef5d1
Reviewed-on: https://gerrit.libreoffice.org/50654
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgpathnode.hxx | 12 | ||||
-rw-r--r-- | svgio/source/svgreader/svgpathnode.cxx | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/svgio/inc/svgpathnode.hxx b/svgio/inc/svgpathnode.hxx index 3cd23232a8ee..a96910560b2e 100644 --- a/svgio/inc/svgpathnode.hxx +++ b/svgio/inc/svgpathnode.hxx @@ -35,8 +35,8 @@ namespace svgio SvgStyleAttributes maSvgStyleAttributes; /// variable scan values, dependent of given XAttributeList - basegfx::B2DPolyPolygon* mpPolyPolygon; - basegfx::B2DHomMatrix* mpaTransform; + std::unique_ptr<basegfx::B2DPolyPolygon> mpPolyPolygon; + std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform; SvgNumber maPathLength; basegfx::utils::PointIndexSet maHelpPointIndices; @@ -51,12 +51,12 @@ namespace svgio 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; } - void setPath(const basegfx::B2DPolyPolygon* pPath) { if(mpPolyPolygon) delete mpPolyPolygon; mpPolyPolygon = nullptr; if(pPath) mpPolyPolygon = new basegfx::B2DPolyPolygon(*pPath); } + const basegfx::B2DPolyPolygon* getPath() const { return mpPolyPolygon.get(); } + void setPath(const basegfx::B2DPolyPolygon* pPath) { mpPolyPolygon.reset(); if(pPath) mpPolyPolygon.reset(new basegfx::B2DPolyPolygon(*pPath)); } /// transform content, set if found in current context - const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } - void setTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); } + const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); } + void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset(new basegfx::B2DHomMatrix(*pMatrix)); } /// PathLength content const SvgNumber& getPathLength() const { return maPathLength; } diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx index 50fe2e52151e..051f4fb9972b 100644 --- a/svgio/source/svgreader/svgpathnode.cxx +++ b/svgio/source/svgreader/svgpathnode.cxx @@ -37,8 +37,6 @@ namespace svgio SvgPathNode::~SvgPathNode() { - delete mpPolyPolygon; - delete mpaTransform; } const SvgStyleAttributes* SvgPathNode::getSvgStyleAttributes() const |