From fe0f9fefe4e77916f09175e1e67b5860a519a83e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Jun 2018 00:26:32 +0200 Subject: [PATCH] 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. --- include/wx/dc.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/wx/dc.h b/include/wx/dc.h index 38edf9da5f..cfc57cd1bd 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -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;