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>
This commit is contained in:
committed by
Noel Grandin
parent
523bba89cd
commit
3a668a2398
@@ -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;
|
||||
|
@@ -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(); }
|
||||
|
@@ -72,7 +72,7 @@ namespace svgio::svgreader
|
||||
aPath.setClosed(true);
|
||||
}
|
||||
|
||||
setPolygon(&aPath);
|
||||
setPolygon(aPath);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user