diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-08-25 20:51:22 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-08-25 21:25:38 +0200 |
commit | 7e911e9cd469d30369c213aa529675b3f7c4f0e8 (patch) | |
tree | dc3239d84a230460314011930306af827ccdd38c /basegfx | |
parent | 0157f98861d589caa60f1ef3dacebb0137d23afe (diff) |
basegfx: remove global ImplB2DPolygon
Change-Id: Ibd97ba1d7cc4e04203142057c47a74034cc4f70f
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dpolygon.cxx | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 00eaa89d1282..aa528ad861ac 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -23,7 +23,6 @@ #include <basegfx/vector/b2dvector.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/curve/b2dcubicbezier.hxx> -#include <rtl/instance.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <algorithm> #include <memory> @@ -632,7 +631,24 @@ public: } } - ImplB2DPolygon& operator=( const ImplB2DPolygon& ) = delete; + ImplB2DPolygon& operator=(const ImplB2DPolygon& rOther) + { + if (this != &rOther) + { + mpControlVector.reset(); + mpBufferedData.reset(); + maPoints = rOther.maPoints; + mbIsClosed = rOther.mbIsClosed; + if (rOther.mpControlVector && rOther.mpControlVector->isUsed()) + { + mpControlVector.reset( new ControlVectorArray2D(*rOther.mpControlVector) ); + + if(!mpControlVector->isUsed()) + mpControlVector.reset(); + } + } + return *this; + } sal_uInt32 count() const { @@ -1091,17 +1107,12 @@ public: namespace basegfx { - namespace - { - struct DefaultPolygon: public rtl::Static<B2DPolygon::ImplType, DefaultPolygon> {}; - } - B2DPolygon::B2DPolygon() - : mpPolygon(DefaultPolygon::get()) + : mpPolygon() {} B2DPolygon::B2DPolygon(std::initializer_list<basegfx::B2DPoint> aPoints) - : mpPolygon(DefaultPolygon::get()) + : mpPolygon() { for (const basegfx::B2DPoint& rPoint : aPoints) { @@ -1432,7 +1443,7 @@ namespace basegfx void B2DPolygon::clear() { - mpPolygon = DefaultPolygon::get(); + *mpPolygon = ImplB2DPolygon(); } bool B2DPolygon::isClosed() const |