summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-28 09:52:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-05 07:26:20 +0100
commited50afb3c06cb7eb0df7a4633bbff2498577e7e9 (patch)
treec329ddc6ad8126286d34f35e31c6647a20ca7182 /svgio
parent8a9f8d35b000e37f08d391958eca0d51269a23dd (diff)
loplugin:useuniqueptr in SvgPatternNode
Change-Id: Icf0390d3667c3d55db2266285cacea36e2171e0a Reviewed-on: https://gerrit.libreoffice.org/50655 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svgpatternnode.hxx10
-rw-r--r--svgio/source/svgreader/svgpatternnode.cxx6
2 files changed, 8 insertions, 8 deletions
diff --git a/svgio/inc/svgpatternnode.hxx b/svgio/inc/svgpatternnode.hxx
index d0b2ca02cc93..5aa93b373217 100644
--- a/svgio/inc/svgpatternnode.hxx
+++ b/svgio/inc/svgpatternnode.hxx
@@ -38,7 +38,8 @@ namespace svgio
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- basegfx::B2DRange* mpViewBox;
+ std::unique_ptr<basegfx::B2DRange>
+ mpViewBox;
SvgAspectRatio maSvgAspectRatio;
SvgNumber maX;
SvgNumber maY;
@@ -48,7 +49,8 @@ namespace svgio
mpPatternUnits;
std::unique_ptr<SvgUnits>
mpPatternContentUnits;
- basegfx::B2DHomMatrix* mpaPatternTransform;
+ std::unique_ptr<basegfx::B2DHomMatrix>
+ mpaPatternTransform;
/// link to another pattern used as style. If maXLink
/// is set, the node can be fetched on demand by using
@@ -79,7 +81,7 @@ namespace svgio
/// viewBox content
const basegfx::B2DRange* getViewBox() const;
- void setViewBox(const basegfx::B2DRange* pViewBox) { if(mpViewBox) delete mpViewBox; mpViewBox = nullptr; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+ void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset(new basegfx::B2DRange(*pViewBox)); }
/// SvgAspectRatio content
const SvgAspectRatio& getSvgAspectRatio() const;
@@ -106,7 +108,7 @@ namespace svgio
/// PatternTransform content
const basegfx::B2DHomMatrix* getPatternTransform() const;
- void setPatternTransform(const basegfx::B2DHomMatrix* pMatrix) { if(mpaPatternTransform) delete mpaPatternTransform; mpaPatternTransform = nullptr; if(pMatrix) mpaPatternTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ void setPatternTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaPatternTransform.reset(); if(pMatrix) mpaPatternTransform.reset(new basegfx::B2DHomMatrix(*pMatrix)); }
};
} // end of namespace svgreader
diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx
index 50e2a38b6fe8..758a6022f841 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -54,8 +54,6 @@ namespace svgio
SvgPatternNode::~SvgPatternNode()
{
- delete mpViewBox;
- delete mpaPatternTransform;
}
const SvgStyleAttributes* SvgPatternNode::getSvgStyleAttributes() const
@@ -298,7 +296,7 @@ namespace svgio
{
if(mpViewBox)
{
- return mpViewBox;
+ return mpViewBox.get();
}
const_cast< SvgPatternNode* >(this)->tryToFindLink();
@@ -434,7 +432,7 @@ namespace svgio
{
if(mpaPatternTransform)
{
- return mpaPatternTransform;
+ return mpaPatternTransform.get();
}
const_cast< SvgPatternNode* >(this)->tryToFindLink();