From 30a4090ac9b24880192564b8f5f6718b3e864f04 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 26 Jul 2021 20:39:40 +0200 Subject: [PATCH] Fix determining DC area for wxDC with applied affine transformation We need to take into account all aplied transformations (including affine transformation set with SetTransformMatrix()) while calculating entire DC area in logical coordinaates. For derived wxDC's that support affine transformations DeviceToLogical[Rel]() functions are overriden with platform-specific implementations taking into account all applied transformations (see documentation of wxDC::DeviceToLogical(), wxDC::DeviceToLogicalRel()) and they may be not equivalent to DeviceToLogical[Rel]{X|Y}(). --- src/common/dcbase.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 330c8d63fe..a788a3aac3 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -377,8 +377,7 @@ void wxDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) // of required clipping box and DC surface. int dcWidth, dcHeight; DoGetSize(&dcWidth, &dcHeight); - wxRect dcRect(DeviceToLogicalX(0), DeviceToLogicalY(0), - DeviceToLogicalXRel(dcWidth), DeviceToLogicalYRel(dcHeight)); + wxRect dcRect(DeviceToLogical(0, 0), DeviceToLogicalRel(dcWidth, dcHeight)); clipRegion.Intersect(dcRect); m_clipping = true; @@ -400,10 +399,7 @@ void wxDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxRect wxDCImpl::GetLogicalArea() const { const wxSize size = GetSize(); - return wxRect(DeviceToLogicalX(0), - DeviceToLogicalY(0), - DeviceToLogicalXRel(size.x), - DeviceToLogicalYRel(size.y)); + return wxRect(DeviceToLogical(0, 0), DeviceToLogicalRel(size.x, size.y)); } bool wxDCImpl::DoGetClippingRect(wxRect& rect) const