[Libreoffice-commits] core.git: tools/inc tools/source
Caolán McNamara
caolanm at redhat.com
Fri Dec 15 09:20:10 UTC 2017
tools/inc/poly.h | 8 ++------
tools/source/generic/poly.cxx | 26 ++++++++------------------
2 files changed, 10 insertions(+), 24 deletions(-)
New commits:
commit 5763b7f48e7aaf089c78714a82212e94b28007d7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 14 13:50:17 2017 +0000
merge ImplPolygon and ImplPolygonData
Change-Id: Ia59a4533965bb3b76c73cc23c31bff4718768339
Reviewed-on: https://gerrit.libreoffice.org/46454
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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)
More information about the Libreoffice-commits
mailing list