summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-14 13:50:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-15 10:16:41 +0100
commit5763b7f48e7aaf089c78714a82212e94b28007d7 (patch)
treedcc834c844c2933ac64a8e0707cb599760dfb099 /tools
parentcfbc934609aaa303d03fd73b58bde1370ea312dc (diff)
merge ImplPolygon and ImplPolygonData
Change-Id: Ia59a4533965bb3b76c73cc23c31bff4718768339 Reviewed-on: https://gerrit.libreoffice.org/46454 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/poly.h8
-rw-r--r--tools/source/generic/poly.cxx26
2 files changed, 10 insertions, 24 deletions
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<Point[]> mxPointAry;
std::unique_ptr<PolyFlags[]> 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)