From 8615921f4229dbcdc059027c335ebb7a215d56ed Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 3 Jul 2016 22:24:30 +0200 Subject: [PATCH] Fixed retrieving clipping box parameters when there is no clipping region set. When there is no clipping region currently set then current effective clipping region is identical with entire DC surface and therefore DC size should be returned as a region size. Closes #17013 --- include/wx/dc.h | 11 +++++++---- interface/wx/dc.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/wx/dc.h b/include/wx/dc.h index 2637b5a828..ac0f97d6ea 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -445,14 +445,17 @@ public: virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const { + int dcWidth, dcHeight; + DoGetSize(&dcWidth, &dcHeight); + if ( x ) - *x = m_clipX1; + *x = m_clipping ? m_clipX1 : 0; if ( y ) - *y = m_clipY1; + *y = m_clipping ? m_clipY1 : 0; if ( w ) - *w = m_clipX2 - m_clipX1; + *w = m_clipping ? m_clipX2 - m_clipX1 : dcWidth; if ( h ) - *h = m_clipY2 - m_clipY1; + *h = m_clipping ? m_clipY2 - m_clipY1 : dcHeight; } virtual void DestroyClippingRegion() { ResetClipping(); } diff --git a/interface/wx/dc.h b/interface/wx/dc.h index 82aa64a36e..748e0a7812 100644 --- a/interface/wx/dc.h +++ b/interface/wx/dc.h @@ -755,6 +755,8 @@ public: /** Gets the rectangle surrounding the current clipping region. + If no clipping region is set this function returns the extent + of the device context. */ void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height) const;