summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-08-21 20:14:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-22 16:24:05 +0200
commit008f28c9e01114e731f785e9e238236a1ed069d2 (patch)
treeee8ee5df51471cb87a663048835800b24fb8b341 /svgio
parent0944ef734571ae34cbecc53812e576a39b3722f0 (diff)
no need to use unique_ptr for B2DHomMatrix
it is already a COW type Change-Id: Ide1dedfb8be7593bf45b0e78899450f04291f09e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120828 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svganode.hxx6
-rw-r--r--svgio/inc/svgcirclenode.hxx6
-rw-r--r--svgio/inc/svgclippathnode.hxx8
-rw-r--r--svgio/inc/svgellipsenode.hxx6
-rw-r--r--svgio/inc/svggnode.hxx6
-rw-r--r--svgio/inc/svggradientnode.hxx6
-rw-r--r--svgio/inc/svgimagenode.hxx6
-rw-r--r--svgio/inc/svglinenode.hxx6
-rw-r--r--svgio/inc/svgmasknode.hxx8
-rw-r--r--svgio/inc/svgpathnode.hxx6
-rw-r--r--svgio/inc/svgpatternnode.hxx6
-rw-r--r--svgio/inc/svgpolynode.hxx6
-rw-r--r--svgio/inc/svgrectnode.hxx6
-rw-r--r--svgio/inc/svgstyleattributes.hxx2
-rw-r--r--svgio/inc/svgtextnode.hxx6
-rw-r--r--svgio/inc/svgusenode.hxx7
-rw-r--r--svgio/source/svgreader/svganode.cxx2
-rw-r--r--svgio/source/svgreader/svgcirclenode.cxx2
-rw-r--r--svgio/source/svgreader/svgclippathnode.cxx4
-rw-r--r--svgio/source/svgreader/svgellipsenode.cxx2
-rw-r--r--svgio/source/svgreader/svggnode.cxx2
-rw-r--r--svgio/source/svgreader/svggradientnode.cxx18
-rw-r--r--svgio/source/svgreader/svgimagenode.cxx2
-rw-r--r--svgio/source/svgreader/svglinenode.cxx2
-rw-r--r--svgio/source/svgreader/svgmasknode.cxx4
-rw-r--r--svgio/source/svgreader/svgpathnode.cxx2
-rw-r--r--svgio/source/svgreader/svgpatternnode.cxx8
-rw-r--r--svgio/source/svgreader/svgpolynode.cxx2
-rw-r--r--svgio/source/svgreader/svgrectnode.cxx2
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx2
-rw-r--r--svgio/source/svgreader/svgtextnode.cxx2
-rw-r--r--svgio/source/svgreader/svgusenode.cxx2
-rw-r--r--svgio/source/svgreader/svgvisitor.cxx2
33 files changed, 74 insertions, 83 deletions
diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index ac47da7d5cc7..3fa49442b35e 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -33,7 +33,7 @@ namespace svgio::svgreader
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgANode(
@@ -46,8 +46,8 @@ namespace svgio::svgreader
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index 2ffcaa2ecd67..6e06ca141437 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -36,7 +36,7 @@ namespace svgio::svgreader
SvgNumber maCx;
SvgNumber maCy;
SvgNumber maR;
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgCircleNode(
@@ -58,8 +58,8 @@ namespace svgio::svgreader
const SvgNumber& getR() const { return maR; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgclippathnode.hxx b/svgio/inc/svgclippathnode.hxx
index aa2bb68931e1..6f4ab5b4b97d 100644
--- a/svgio/inc/svgclippathnode.hxx
+++ b/svgio/inc/svgclippathnode.hxx
@@ -33,7 +33,7 @@ namespace svgio::svgreader
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
SvgUnits maClipPathUnits;
public:
@@ -49,15 +49,15 @@ namespace svgio::svgreader
/// apply contained clipPath to given geometry #i124852# transform may be needed
void apply(
drawinglayer::primitive2d::Primitive2DContainer& rTarget,
- const basegfx::B2DHomMatrix* pTransform) const;
+ const std::optional<basegfx::B2DHomMatrix>& pTransform) const;
/// clipPathUnits content
SvgUnits getClipPathUnits() const { return maClipPathUnits; }
void setClipPathUnits(const SvgUnits aClipPathUnits) { maClipPathUnits = aClipPathUnits; }
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgellipsenode.hxx b/svgio/inc/svgellipsenode.hxx
index 93f33d794130..8bbad341cf6a 100644
--- a/svgio/inc/svgellipsenode.hxx
+++ b/svgio/inc/svgellipsenode.hxx
@@ -37,7 +37,7 @@ namespace svgio::svgreader
SvgNumber maCy;
SvgNumber maRx;
SvgNumber maRy;
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgEllipseNode(
@@ -62,8 +62,8 @@ namespace svgio::svgreader
const SvgNumber& getRy() const { return maRy; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svggnode.hxx b/svgio/inc/svggnode.hxx
index e59df3e74890..ee814a2f84f1 100644
--- a/svgio/inc/svggnode.hxx
+++ b/svgio/inc/svggnode.hxx
@@ -33,7 +33,7 @@ namespace svgio::svgreader
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgGNode(
@@ -47,8 +47,8 @@ namespace svgio::svgreader
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svggradientnode.hxx b/svgio/inc/svggradientnode.hxx
index e383995c89fe..3267256d0524 100644
--- a/svgio/inc/svggradientnode.hxx
+++ b/svgio/inc/svggradientnode.hxx
@@ -48,7 +48,7 @@ namespace svgio::svgreader
/// variable scan values, dependent of given XAttributeList
SvgUnits maGradientUnits;
drawinglayer::primitive2d::SpreadMethod maSpreadMethod;
- std::unique_ptr<basegfx::B2DHomMatrix> mpaGradientTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaGradientTransform;
/// link to another gradient used as style. If maXLink
/// is set, the node can be fetched on demand by using
@@ -109,8 +109,8 @@ namespace svgio::svgreader
void setSpreadMethod(const drawinglayer::primitive2d::SpreadMethod aSpreadMethod) { maSpreadMethod = aSpreadMethod; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getGradientTransform() const;
- void setGradientTransform(const basegfx::B2DHomMatrix* pMatrix);
+ std::optional<basegfx::B2DHomMatrix> getGradientTransform() const;
+ void setGradientTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaGradientTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgimagenode.hxx b/svgio/inc/svgimagenode.hxx
index e778e992fdf5..a639fba27e67 100644
--- a/svgio/inc/svgimagenode.hxx
+++ b/svgio/inc/svgimagenode.hxx
@@ -34,7 +34,7 @@ namespace svgio::svgreader
/// variable scan values, dependent of given XAttributeList
SvgAspectRatio maSvgAspectRatio;
- std::unique_ptr<basegfx::B2DHomMatrix>
+ std::optional<basegfx::B2DHomMatrix>
mpaTransform;
SvgNumber maX;
SvgNumber maY;
@@ -58,8 +58,8 @@ namespace svgio::svgreader
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
/// x content, set if found in current context
const SvgNumber& getX() const { return maX; }
diff --git a/svgio/inc/svglinenode.hxx b/svgio/inc/svglinenode.hxx
index 82889add15c5..0002dc181d86 100644
--- a/svgio/inc/svglinenode.hxx
+++ b/svgio/inc/svglinenode.hxx
@@ -37,7 +37,7 @@ namespace svgio::svgreader
SvgNumber maY1;
SvgNumber maX2;
SvgNumber maY2;
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgLineNode(
@@ -62,8 +62,8 @@ namespace svgio::svgreader
const SvgNumber& getY2() const { return maY2; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgmasknode.hxx b/svgio/inc/svgmasknode.hxx
index 2a359c53e995..199a258f9643 100644
--- a/svgio/inc/svgmasknode.hxx
+++ b/svgio/inc/svgmasknode.hxx
@@ -37,7 +37,7 @@ namespace svgio::svgreader
SvgNumber maY;
SvgNumber maWidth;
SvgNumber maHeight;
- std::unique_ptr<basegfx::B2DHomMatrix>
+ std::optional<basegfx::B2DHomMatrix>
mpaTransform;
SvgUnits maMaskUnits;
SvgUnits maMaskContentUnits;
@@ -55,7 +55,7 @@ namespace svgio::svgreader
/// apply contained clipPath to given geometry #i124852# transform may be needed
void apply(
drawinglayer::primitive2d::Primitive2DContainer& rTarget,
- const basegfx::B2DHomMatrix* pTransform) const;
+ const std::optional<basegfx::B2DHomMatrix>& pTransform) const;
/// x content, set if found in current context
const SvgNumber& getX() const { return maX; }
@@ -70,8 +70,8 @@ namespace svgio::svgreader
const SvgNumber& getHeight() const { return maHeight; }
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
/// MaskUnits content
void setMaskUnits(const SvgUnits aMaskUnits) { maMaskUnits = aMaskUnits; }
diff --git a/svgio/inc/svgpathnode.hxx b/svgio/inc/svgpathnode.hxx
index 59daac852891..bc962691fe25 100644
--- a/svgio/inc/svgpathnode.hxx
+++ b/svgio/inc/svgpathnode.hxx
@@ -36,7 +36,7 @@ namespace svgio::svgreader
/// variable scan values, dependent of given XAttributeList
std::optional<basegfx::B2DPolyPolygon> mpPolyPolygon;
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
SvgNumber maPathLength;
basegfx::utils::PointIndexSet maHelpPointIndices;
@@ -55,8 +55,8 @@ namespace svgio::svgreader
void setPath(const std::optional<basegfx::B2DPolyPolygon>& pPath) { mpPolyPolygon = pPath; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset(new basegfx::B2DHomMatrix(*pMatrix)); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
/// PathLength content
const SvgNumber& getPathLength() const { return maPathLength; }
diff --git a/svgio/inc/svgpatternnode.hxx b/svgio/inc/svgpatternnode.hxx
index a8b4497a335d..1da003c085d1 100644
--- a/svgio/inc/svgpatternnode.hxx
+++ b/svgio/inc/svgpatternnode.hxx
@@ -47,7 +47,7 @@ namespace svgio::svgreader
mpPatternUnits;
std::unique_ptr<SvgUnits>
mpPatternContentUnits;
- std::unique_ptr<basegfx::B2DHomMatrix>
+ std::optional<basegfx::B2DHomMatrix>
mpaPatternTransform;
/// link to another pattern used as style. If maXLink
@@ -106,8 +106,8 @@ namespace svgio::svgreader
void setPatternContentUnits(const SvgUnits aPatternContentUnits) { mpPatternContentUnits.reset( new SvgUnits(aPatternContentUnits) ); }
/// PatternTransform content
- const basegfx::B2DHomMatrix* getPatternTransform() const;
- void setPatternTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaPatternTransform.reset(); if(pMatrix) mpaPatternTransform.reset(new basegfx::B2DHomMatrix(*pMatrix)); }
+ std::optional<basegfx::B2DHomMatrix> getPatternTransform() const;
+ void setPatternTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaPatternTransform = pMatrix; }
};
diff --git a/svgio/inc/svgpolynode.hxx b/svgio/inc/svgpolynode.hxx
index f5974cd28c08..fd356cd55588 100644
--- a/svgio/inc/svgpolynode.hxx
+++ b/svgio/inc/svgpolynode.hxx
@@ -35,7 +35,7 @@ namespace svgio::svgreader
/// variable scan values, dependent of given XAttributeList
std::optional<basegfx::B2DPolygon> mpPolygon;
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
bool mbIsPolyline : 1; // true = polyline, false = polygon
@@ -54,8 +54,8 @@ namespace svgio::svgreader
void setPolygon(const std::optional<basegfx::B2DPolygon>& pPolygon) { mpPolygon = pPolygon; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset(new basegfx::B2DHomMatrix(*pMatrix)); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgrectnode.hxx b/svgio/inc/svgrectnode.hxx
index 61088e8fdff8..467fa41d8de3 100644
--- a/svgio/inc/svgrectnode.hxx
+++ b/svgio/inc/svgrectnode.hxx
@@ -39,7 +39,7 @@ namespace svgio::svgreader
SvgNumber maHeight;
SvgNumber maRx;
SvgNumber maRy;
- std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform;
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
public:
SvgRectNode(
@@ -70,8 +70,8 @@ namespace svgio::svgreader
const SvgNumber& getRy() const { return maRy; }
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index b1c9da120573..05f3ef085fd3 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -290,7 +290,7 @@ namespace svgio::svgreader
void add_postProcess(
drawinglayer::primitive2d::Primitive2DContainer& rTarget,
const drawinglayer::primitive2d::Primitive2DContainer& rSource,
- const basegfx::B2DHomMatrix* pTransform) const;
+ const std::optional<basegfx::B2DHomMatrix>& pTransform) const;
/// helper to set mpCssStyleParent temporarily for CSS style hierarchies
void setCssStyleParent(const SvgStyleAttributes* pNew) { mpCssStyleParent = pNew; }
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index d7a912b56994..9ff73d66d104 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -34,7 +34,7 @@ namespace svgio::svgreader
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- std::unique_ptr<basegfx::B2DHomMatrix>
+ std::optional<basegfx::B2DHomMatrix>
mpaTransform;
SvgTextPositions maSvgTextPositions;
@@ -61,8 +61,8 @@ namespace svgio::svgreader
virtual double getCurrentFontSize() const override;
/// transform content, set if found in current context
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgusenode.hxx b/svgio/inc/svgusenode.hxx
index 110ce0c1e3fa..87b25908b7e0 100644
--- a/svgio/inc/svgusenode.hxx
+++ b/svgio/inc/svgusenode.hxx
@@ -23,6 +23,7 @@
#include "svgstyleattributes.hxx"
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <memory>
+#include <optional>
namespace svgio::svgreader
{
@@ -33,7 +34,7 @@ namespace svgio::svgreader
SvgStyleAttributes maSvgStyleAttributes;
/// variable scan values, dependent of given XAttributeList
- std::unique_ptr<basegfx::B2DHomMatrix>
+ std::optional<basegfx::B2DHomMatrix>
mpaTransform;
SvgNumber maX;
SvgNumber maY;
@@ -57,8 +58,8 @@ namespace svgio::svgreader
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
/// transform content
- const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform.get(); }
- void setTransform(const basegfx::B2DHomMatrix* pMatrix) { mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new basegfx::B2DHomMatrix(*pMatrix) ); }
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; }
/// x content
const SvgNumber& getX() const { return maX; }
diff --git a/svgio/source/svgreader/svganode.cxx b/svgio/source/svgreader/svganode.cxx
index 6065ed498e42..358282d143e9 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -60,7 +60,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx
index 78e280eb0a26..8577ba2726f6 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.cxx
@@ -99,7 +99,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx
index 1a8269684095..341ddaf00327 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -68,7 +68,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
@@ -123,7 +123,7 @@ namespace svgio::svgreader
void SvgClipPathNode::apply(
drawinglayer::primitive2d::Primitive2DContainer& rContent,
- const basegfx::B2DHomMatrix* pTransform) const
+ const std::optional<basegfx::B2DHomMatrix>& pTransform) const
{
if (rContent.empty() || Display::None == getDisplay())
return;
diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx
index 7fd431aeb0f6..b1646b30d929 100644
--- a/svgio/source/svgreader/svgellipsenode.cxx
+++ b/svgio/source/svgreader/svgellipsenode.cxx
@@ -113,7 +113,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx
index e186387a80ba..8e2c1a2486da 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx
@@ -72,7 +72,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx
index 8aa4371e0cfc..0b2ad5cabaf4 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -216,7 +216,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setGradientTransform(&aMatrix);
+ setGradientTransform(aMatrix);
}
break;
}
@@ -490,11 +490,11 @@ namespace svgio::svgreader
return nullptr;
}
- const basegfx::B2DHomMatrix* SvgGradientNode::getGradientTransform() const
+ std::optional<basegfx::B2DHomMatrix> SvgGradientNode::getGradientTransform() const
{
if(mpaGradientTransform)
{
- return mpaGradientTransform.get();
+ return mpaGradientTransform;
}
const_cast< SvgGradientNode* >(this)->tryToFindLink();
@@ -507,17 +507,7 @@ namespace svgio::svgreader
return ret;
}
- return nullptr;
- }
-
- void SvgGradientNode::setGradientTransform(const basegfx::B2DHomMatrix* pMatrix)
- {
- mpaGradientTransform.reset();
-
- if(pMatrix)
- {
- mpaGradientTransform.reset(new basegfx::B2DHomMatrix(*pMatrix) );
- }
+ return std::nullopt;
}
} // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx
index feaf5933ad53..445e78a2646c 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -89,7 +89,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx
index 1f4ef9bbd60d..4259c4b1ca95 100644
--- a/svgio/source/svgreader/svglinenode.cxx
+++ b/svgio/source/svgreader/svglinenode.cxx
@@ -106,7 +106,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx
index 7f3ab9a772ca..d036bed33656 100644
--- a/svgio/source/svgreader/svgmasknode.cxx
+++ b/svgio/source/svgreader/svgmasknode.cxx
@@ -120,7 +120,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
@@ -188,7 +188,7 @@ namespace svgio::svgreader
void SvgMaskNode::apply(
drawinglayer::primitive2d::Primitive2DContainer& rTarget,
- const basegfx::B2DHomMatrix* pTransform) const
+ const std::optional<basegfx::B2DHomMatrix>& pTransform) const
{
if(rTarget.empty() || Display::None == getDisplay())
return;
diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx
index 5187df877261..d32a92b6a8c5 100644
--- a/svgio/source/svgreader/svgpathnode.cxx
+++ b/svgio/source/svgreader/svgpathnode.cxx
@@ -75,7 +75,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx
index 8d8721a5ee27..ff92896fa350 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -169,7 +169,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setPatternTransform(&aMatrix);
+ setPatternTransform(aMatrix);
}
break;
}
@@ -450,11 +450,11 @@ namespace svgio::svgreader
return nullptr;
}
- const basegfx::B2DHomMatrix* SvgPatternNode::getPatternTransform() const
+ std::optional<basegfx::B2DHomMatrix> SvgPatternNode::getPatternTransform() const
{
if(mpaPatternTransform)
{
- return mpaPatternTransform.get();
+ return mpaPatternTransform;
}
const_cast< SvgPatternNode* >(this)->tryToFindLink();
@@ -467,7 +467,7 @@ namespace svgio::svgreader
return ret;
}
- return nullptr;
+ return std::nullopt;
}
} // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx
index 584a94e30d79..0956dcd2dad5 100644
--- a/svgio/source/svgreader/svgpolynode.cxx
+++ b/svgio/source/svgreader/svgpolynode.cxx
@@ -83,7 +83,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx
index aa23954237e4..27c1042edcfc 100644
--- a/svgio/source/svgreader/svgrectnode.cxx
+++ b/svgio/source/svgreader/svgrectnode.cxx
@@ -141,7 +141,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 8ad08b0414e2..fc072882d864 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1149,7 +1149,7 @@ namespace svgio::svgreader
void SvgStyleAttributes::add_postProcess(
drawinglayer::primitive2d::Primitive2DContainer& rTarget,
const drawinglayer::primitive2d::Primitive2DContainer& rSource,
- const basegfx::B2DHomMatrix* pTransform) const
+ const std::optional<basegfx::B2DHomMatrix>& pTransform) const
{
if(rSource.empty())
return;
diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx
index ee096712969a..99d2cf0c6a10 100644
--- a/svgio/source/svgreader/svgtextnode.cxx
+++ b/svgio/source/svgreader/svgtextnode.cxx
@@ -70,7 +70,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx
index e4fc03ae7345..9e3630a2bebb 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -68,7 +68,7 @@ namespace svgio::svgreader
if(!aMatrix.isIdentity())
{
- setTransform(&aMatrix);
+ setTransform(aMatrix);
}
break;
}
diff --git a/svgio/source/svgreader/svgvisitor.cxx b/svgio/source/svgreader/svgvisitor.cxx
index ba4baaa2abfa..8ad5395f1ce3 100644
--- a/svgio/source/svgreader/svgvisitor.cxx
+++ b/svgio/source/svgreader/svgvisitor.cxx
@@ -77,7 +77,7 @@ void SvgDrawVisitor::visit(svgio::svgreader::SvgNode const& rNode)
aGradientInfo->x2 = pFillGradient->getX2().getNumber();
aGradientInfo->y2 = pFillGradient->getY2().getNumber();
- const basegfx::B2DHomMatrix* pGradientTransform
+ std::optional<basegfx::B2DHomMatrix> pGradientTransform
= pFillGradient->getGradientTransform();
if (pGradientTransform)
{