From ea04c72754d65c2b711076b6feb6f91ed95e22c8 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 27 Jul 2021 17:25:29 +0200 Subject: [PATCH] Revert "Store clipping box coordinates in device units in wxWindowDCImpl, wxGTKDCImpl" This reverts commit 95f1b262a4 ("Store clipping box coordinates in device units in wxWindowDCImpl, wxGTKDCImpl", 2021-07-26) because device coordinates can be used to determine final clipping box coordinates more accurately only if current logical coordinates are not stored directly in the corresponding variables of the base class wxDCImpl. --- src/gtk/dc.cpp | 5 +++-- src/gtk/dcclient.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index 0c4349834c..917a98acaa 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -619,7 +619,7 @@ void wxGTKDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCo wxASSERT_MSG( width >= 0 && height >= 0, "Clipping box size values cannot be negative" ); - wxRect newRegion(LogicalToDevice(x, y), LogicalToDeviceRel(width, height)); + wxRect newRegion(x, y, width, height); wxRect clipRegion; if ( m_clipping ) @@ -635,7 +635,8 @@ void wxGTKDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCo // of required clipping box and DC surface. int dcWidth, dcHeight; DoGetSize(&dcWidth, &dcHeight); - wxRect dcRect(0, 0, dcWidth, dcHeight); + wxRect dcRect(DeviceToLogicalX(0), DeviceToLogicalY(0), + DeviceToLogicalXRel(dcWidth), DeviceToLogicalYRel(dcHeight)); clipRegion = dcRect.Intersect(newRegion); m_clipping = true; diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 7592de0d06..fed357b468 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1919,10 +1919,10 @@ void wxWindowDCImpl::UpdateClipBox() } else { - m_clipX1 = r.GetLeft(); - m_clipY1 = r.GetTop(); - m_clipX2 = r.GetRight() + 1; - m_clipY2 = r.GetBottom() + 1; + m_clipX1 = DeviceToLogicalX(r.GetLeft()); + m_clipY1 = DeviceToLogicalY(r.GetTop()); + m_clipX2 = m_clipX1 + DeviceToLogicalXRel(r.GetWidth()); + m_clipY2 = m_clipY1 + DeviceToLogicalYRel(r.GetHeight()); } m_isClipBoxValid = true; }