summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-28 09:53:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-05 07:26:33 +0100
commita7205fd02331a8c5710a8ea44ed6157dbb6120cf (patch)
treea9bcb56e81c2f1698b261eca417d4a61360a5fee /svgio
parented50afb3c06cb7eb0df7a4633bbff2498577e7e9 (diff)
loplugin:useuniqueptr in SvgPolyNode
Change-Id: I0227c8a36abbdb88f17cfea186eea28c9f566bd5 Reviewed-on: https://gerrit.libreoffice.org/50656 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svgpolynode.hxx10
-rw-r--r--svgio/source/svgreader/svgpolynode.cxx2
2 files changed, 5 insertions, 7 deletions
diff --git a/svgio/inc/svgpolynode.hxx b/svgio/inc/svgpolynode.hxx
index 5a867fdb5e85..5e3e27d78888 100644
--- a/svgio/inc/svgpolynode.hxx
+++ b/svgio/inc/svgpolynode.hxx
@@ -35,8 +35,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DPolygon* mpPolygon;
- basegfx::B2DHomMatrix* mpaTransform;
+ std::unique_ptr<basegfx::B2DPolygon> mpPolygon;
+ std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
bool mbIsPolyline : 1; // true = polyline, false = polygon
@@ -52,11 +52,11 @@ namespace svgio
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// Polygon content, set if found in current context
- void setPolygon(const basegfx::B2DPolygon* pPolygon) { if(mpPolygon) delete mpPolygon; mpPolygon = nullptr; if(pPolygon) mpPolygon = new basegfx::B2DPolygon(*pPolygon); }
+ void setPolygon(const basegfx::B2DPolygon* pPolygon) { mpPolygon.reset(); if(pPolygon) mpPolygon.reset(new basegfx::B2DPolygon(*pPolygon)); }
/// 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)); }
};
} // end of namespace svgreader
} // end of namespace svgio
diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx
index 5de5fc87cc0d..14792a838678 100644
--- a/svgio/source/svgreader/svgpolynode.cxx
+++ b/svgio/source/svgreader/svgpolynode.cxx
@@ -40,8 +40,6 @@ namespace svgio
SvgPolyNode::~SvgPolyNode()
{
- delete mpaTransform;
- delete mpPolygon;
}
const SvgStyleAttributes* SvgPolyNode::getSvgStyleAttributes() const