Refactor wxDCClipper ctors to use a common Init() method

No changes, this is just a pure refactoring to facilitate the upcoming
change which won't have to be done in all these ctors any more.
This commit is contained in:
Vadim Zeitlin 2018-06-18 00:26:32 +02:00
parent caa2fde425
commit fe0f9fefe4

View File

@ -1437,18 +1437,15 @@ class WXDLLIMPEXP_CORE wxDCClipper
public:
wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc)
{
dc.GetClippingBox(m_oldClipRect);
dc.SetClippingRegion(r.GetBox());
Init(r.GetBox());
}
wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
{
dc.GetClippingBox(m_oldClipRect);
dc.SetClippingRegion(r.x, r.y, r.width, r.height);
Init(r);
}
wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)
{
dc.GetClippingBox(m_oldClipRect);
dc.SetClippingRegion(x, y, w, h);
Init(wxRect(x, y, w, h));
}
~wxDCClipper()
@ -1459,6 +1456,13 @@ public:
}
private:
// Common part of all ctors.
void Init(const wxRect& r)
{
m_dc.GetClippingBox(m_oldClipRect);
m_dc.SetClippingRegion(r);
}
wxDC& m_dc;
wxRect m_oldClipRect;