From 43ce00b5bd2ba645eb0788e35abc8858d9e156e7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Jun 2018 22:52:23 +0200 Subject: [PATCH] Call base class version from overridden DestroyClippingRegion() No real changes, just call wxDCImpl::DestroyClippingRegion() from the overridden versions in the derived classes instead of calling ResetClipping(): this makes the code more clear as it follows the usual pattern of the derived class doing something first and then forwarding to the base class. Also, as ResetClipping() is not really useful, add a comment documenting that it shouldn't be used in the new code. --- include/wx/dc.h | 5 ++++- src/common/dcgraph.cpp | 2 +- src/dfb/dc.cpp | 2 +- src/qt/dc.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/wx/dc.h b/include/wx/dc.h index 5749d578b3..55b1129218 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -666,7 +666,10 @@ private: wxDC *m_owner; protected: - // unset clipping variables (after clipping region was destroyed) + // This method exists for backwards compatibility only (while it's not + // documented, there are derived classes using it outside wxWidgets + // itself), don't use it in any new code and just call wxDCImpl version of + // DestroyClippingRegion() to reset the clipping information instead. void ResetClipping() { m_clipping = false; diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 6eafed2622..8a1441697d 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -376,7 +376,7 @@ void wxGCDCImpl::DestroyClippingRegion() m_graphicContext->SetPen( m_pen ); m_graphicContext->SetBrush( m_brush ); - ResetClipping(); + wxDCImpl::DestroyClippingRegion(); m_isClipBoxValid = false; } diff --git a/src/dfb/dc.cpp b/src/dfb/dc.cpp index a8458e58ea..d6141a7602 100644 --- a/src/dfb/dc.cpp +++ b/src/dfb/dc.cpp @@ -115,7 +115,7 @@ void wxDFBDCImpl::DestroyClippingRegion() m_surface->SetClip(NULL); - ResetClipping(); + wxDCImpl::DestroyClippingRegion(); } // --------------------------------------------------------------------------- diff --git a/src/qt/dc.cpp b/src/qt/dc.cpp index 98c21fa739..38e4e0af21 100644 --- a/src/qt/dc.cpp +++ b/src/qt/dc.cpp @@ -454,7 +454,7 @@ void wxQtDCImpl::DoSetDeviceClippingRegion(const wxRegion& region) void wxQtDCImpl::DestroyClippingRegion() { - ResetClipping(); + wxDCImpl::DestroyClippingRegion(); m_clippingRegion->Clear(); if (m_qtPainter->isActive())