Implement platform-specific coordinate conversion functions
Generic wxDC::DeviceToLogical{X|Y}() and wxDC::LogicalToDevice{X|Y}()
functions don't take into account transformations applied with
wxDC::SetTransformMatrix() so conversion results are invalid if wxDC is
transformed with both e.g. wxDC::SetUserScale() and
wxDC::SetTransformMatrix().
We need to implement functions in wxDCImpl and its platform-specific
derivates to do this conversion with taking into account all applied
transformations.
See #18916.
This commit is contained in:
@@ -502,6 +502,16 @@ wxCoord wxDCImpl::LogicalToDeviceYRel(wxCoord y) const
|
||||
return wxRound((double)(y) * m_scaleY);
|
||||
}
|
||||
|
||||
wxPoint wxDCImpl::DeviceToLogical(wxCoord x, wxCoord y) const
|
||||
{
|
||||
return wxPoint(DeviceToLogicalX(x), DeviceToLogicalY(y));
|
||||
}
|
||||
|
||||
wxPoint wxDCImpl::LogicalToDevice(wxCoord x, wxCoord y) const
|
||||
{
|
||||
return wxPoint(LogicalToDeviceX(x), LogicalToDeviceY(y));
|
||||
}
|
||||
|
||||
void wxDCImpl::ComputeScaleAndOrigin()
|
||||
{
|
||||
m_scaleX = m_logicalScaleX * m_userScaleX;
|
||||
|
||||
Reference in New Issue
Block a user