diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-08-21 19:57:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-22 10:31:24 +0200 |
commit | 3a668a2398fdbe7cfe0176900b26ca6145fb0e8c (patch) | |
tree | 58c3dd991d7609ace1c0560e39748908c2b5c1ae /svgio | |
parent | 523bba89cd5ad6372fb0431cecabdca02ea2b9e3 (diff) |
no need to use unique_ptr for B2DPolygon
it is already a COW type
Change-Id: I86c4be9dd83b98eedf169c3b6668a7994204bca0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120827
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgpolynode.hxx | 5 | ||||
-rw-r--r-- | svgio/source/svgreader/svgpolynode.cxx | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/svgio/inc/svgpolynode.hxx b/svgio/inc/svgpolynode.hxx index abd14271d543..f5974cd28c08 100644 --- a/svgio/inc/svgpolynode.hxx +++ b/svgio/inc/svgpolynode.hxx @@ -23,6 +23,7 @@ #include "svgstyleattributes.hxx" #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#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::B2DPolygon> mpPolygon; + std::optional<basegfx::B2DPolygon> mpPolygon; std::unique_ptr<basegfx::B2DHomMatrix> mpaTransform; bool mbIsPolyline : 1; // true = polyline, false = polygon @@ -50,7 +51,7 @@ namespace svgio::svgreader 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) { mpPolygon.reset(); if(pPolygon) mpPolygon.reset(new basegfx::B2DPolygon(*pPolygon)); } + 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(); } diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx index d7bcb0f07330..584a94e30d79 100644 --- a/svgio/source/svgreader/svgpolynode.cxx +++ b/svgio/source/svgreader/svgpolynode.cxx @@ -72,7 +72,7 @@ namespace svgio::svgreader aPath.setClosed(true); } - setPolygon(&aPath); + setPolygon(aPath); } } break; |