Implement new coordinates conversion functions in wxDC

Current DeviceToLogical{X|Y}(), LogicalToDevice{X|Y}(),
DeviceToLogicalRel{X|Y}(), LogicalToDeviceRel{X|Y}() functions
don't take into account transformations applied with
SetTransformMatrix() so conversion results are invalid if coordinate
system is e.g. rotated.
We need to implement new conversion functions that take into account all
applied transformations and also convert x,y coordinates in one call
because in general case x,y coordinates are coupled and cannot be
converted independently on each other.

Closes #18923.
This commit is contained in:
Artur Wieczorek
2020-09-27 11:16:26 +02:00
parent 2c3c841719
commit 7153eaf6ec
2 changed files with 84 additions and 0 deletions

View File

@@ -1014,6 +1014,14 @@ public:
{ return m_pimpl->DeviceToLogicalXRel(x); }
wxCoord DeviceToLogicalYRel(wxCoord y) const
{ return m_pimpl->DeviceToLogicalYRel(y); }
wxPoint DeviceToLogical(const wxPoint& pt) const
{ return m_pimpl->DeviceToLogical(pt.x, pt.y); }
wxPoint DeviceToLogical(wxCoord x, wxCoord y) const
{ return m_pimpl->DeviceToLogical(x, y); }
wxSize DeviceToLogicalRel(const wxSize& dim) const
{ return m_pimpl->DeviceToLogicalRel(dim.x, dim.y); }
wxSize DeviceToLogicalRel(int x, int y) const
{ return m_pimpl->DeviceToLogicalRel(x, y); }
wxCoord LogicalToDeviceX(wxCoord x) const
{ return m_pimpl->LogicalToDeviceX(x); }
wxCoord LogicalToDeviceY(wxCoord y) const
@@ -1022,6 +1030,14 @@ public:
{ return m_pimpl->LogicalToDeviceXRel(x); }
wxCoord LogicalToDeviceYRel(wxCoord y) const
{ return m_pimpl->LogicalToDeviceYRel(y); }
wxPoint LogicalToDevice(const wxPoint& pt) const
{ return m_pimpl->LogicalToDevice(pt.x, pt.y); }
wxPoint LogicalToDevice(wxCoord x, wxCoord y) const
{ return m_pimpl->LogicalToDevice(x, y); }
wxSize LogicalToDeviceRel(const wxSize& dim) const
{ return m_pimpl->LogicalToDeviceRel(dim.x, dim.y); }
wxSize LogicalToDeviceRel(int x, int y) const
{ return m_pimpl->LogicalToDeviceRel(x, y); }
void SetMapMode(wxMappingMode mode)
{ m_pimpl->SetMapMode(mode); }