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}().
This commit is contained in:
Artur Wieczorek
2021-07-26 20:39:40 +02:00
parent 74833ac435
commit 30a4090ac9

View File

@@ -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