diff --git a/include/wx/dc.h b/include/wx/dc.h index cfc57cd1bd..76b5df8058 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -1459,7 +1459,14 @@ private: // Common part of all ctors. void Init(const wxRect& r) { + // GetClippingBox() is supposed to return the rectangle corresponding + // to the full DC area and some implementations actually do it, while + // others return an empty rectangle instead. Check for both possible + // results here to avoid restoring the clipping region unnecessarily in + // the dtor. m_dc.GetClippingBox(m_oldClipRect); + if ( m_oldClipRect == m_dc.GetSize() ) + m_oldClipRect = wxRect(); m_dc.SetClippingRegion(r); }