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 | |
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>
-rw-r--r-- | basegfx/source/polygon/b2dpolygon.cxx | 4 | ||||
-rw-r--r-- | svgio/inc/svgpolynode.hxx | 5 | ||||
-rw-r--r-- | svgio/source/svgreader/svgpolynode.cxx | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 9c8604e6ad32..141982aef10b 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -461,7 +461,7 @@ class ImplBufferedData : public basegfx::SystemDependentDataHolder { private: // Possibility to hold the last subdivision - std::unique_ptr< basegfx::B2DPolygon > mpDefaultSubdivision; + std::optional< basegfx::B2DPolygon > mpDefaultSubdivision; // Possibility to hold the last B2DRange calculation std::unique_ptr< basegfx::B2DRange > mpB2DRange; @@ -478,7 +478,7 @@ public: { if(!mpDefaultSubdivision) { - const_cast< ImplBufferedData* >(this)->mpDefaultSubdivision.reset(new basegfx::B2DPolygon(basegfx::utils::adaptiveSubdivideByAngle(rSource))); + const_cast< ImplBufferedData* >(this)->mpDefaultSubdivision = basegfx::utils::adaptiveSubdivideByAngle(rSource); } return *mpDefaultSubdivision; 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; |