From 5763b7f48e7aaf089c78714a82212e94b28007d7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 14 Dec 2017 13:50:17 +0000 Subject: merge ImplPolygon and ImplPolygonData MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia59a4533965bb3b76c73cc23c31bff4718768339 Reviewed-on: https://gerrit.libreoffice.org/46454 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- tools/inc/poly.h | 8 ++------ tools/source/generic/poly.cxx | 26 ++++++++------------------ 2 files changed, 10 insertions(+), 24 deletions(-) (limited to 'tools') diff --git a/tools/inc/poly.h b/tools/inc/poly.h index 5609e4a5d681..e59123f06473 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -24,18 +24,15 @@ class Point; -class SAL_WARN_UNUSED ImplPolygonData +class SAL_WARN_UNUSED ImplPolygon { public: std::unique_ptr mxPointAry; std::unique_ptr mxFlagAry; sal_uInt16 mnPoints; -}; -class SAL_WARN_UNUSED ImplPolygon : public ImplPolygonData -{ public: - ImplPolygon() { mnPoints = 0; } + ImplPolygon() : mnPoints(0) {} ImplPolygon( sal_uInt16 nInitSize, bool bFlags = false ); ImplPolygon( sal_uInt16 nPoints, const Point* pPtAry, const PolyFlags* pInitFlags ); ImplPolygon( const ImplPolygon& rImplPoly ); @@ -50,7 +47,6 @@ public: bool operator==( const ImplPolygon& rCandidate ) const; - void ImplInitDefault(); void ImplInitSize(sal_uInt16 nInitSize, bool bFlags = false); void ImplSetSize( sal_uInt16 nSize, bool bResize = true ); void ImplCreateFlagArray(); diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 46ea1db03e2f..19ac62c9bf0c 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -112,7 +112,7 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rRect ) mxPointAry[4] = rRect.TopLeft(); } else - ImplInitDefault(); + mnPoints = 0; } ImplPolygon::ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, sal_uInt32 nVertRound ) @@ -164,7 +164,7 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, } } else - ImplInitDefault(); + mnPoints = 0; } ImplPolygon::ImplPolygon( const Point& rCenter, long nRadX, long nRadY ) @@ -220,7 +220,7 @@ ImplPolygon::ImplPolygon( const Point& rCenter, long nRadX, long nRadY ) } } else - ImplInitDefault(); + mnPoints = 0; } ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, const Point& rEnd, @@ -305,7 +305,7 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, c mxPointAry[nPoints] = mxPointAry[0]; } else - ImplInitDefault(); + mnPoints = 0; } ImplPolygon::ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1, @@ -352,13 +352,12 @@ ImplPolygon::ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1, // and a memcopy at ImplPolygon creation, but contains no zero-controlpoints // for straight edges. ImplPolygon::ImplPolygon(const basegfx::B2DPolygon& rPolygon) + : mnPoints(0) { const bool bCurve(rPolygon.areControlPointsUsed()); const bool bClosed(rPolygon.isClosed()); sal_uInt32 nB2DLocalCount(rPolygon.count()); - ImplInitDefault(); - if(bCurve) { // #127979# Reduce source point count hard to the limit of the tools Polygon @@ -487,18 +486,9 @@ ImplPolygon::ImplPolygon(const basegfx::B2DPolygon& rPolygon) bool ImplPolygon::operator==( const ImplPolygon& rCandidate) const { - if(mnPoints == rCandidate.mnPoints) - { - if (mxFlagAry.get() == rCandidate.mxFlagAry.get() && mxPointAry.get() == rCandidate.mxPointAry.get()) - return true; - } - - return false; -} - -void ImplPolygon::ImplInitDefault() -{ - mnPoints = 0; + return mnPoints == rCandidate.mnPoints && + mxFlagAry.get() == rCandidate.mxFlagAry.get() && + mxPointAry.get() == rCandidate.mxPointAry.get(); } void ImplPolygon::ImplInitSize(sal_uInt16 nInitSize, bool bFlags) -- cgit