Revert to the legacy implementation of setting clipping region given in device coordinates for WXOSX
Solution with full conversion from device to logical coordinates in wxGCDCImpl::DoSetDeviceClippingRegion doesn't seem to work under WXOSX (wxMacCoreGraphics) so we have to use for this port legacy implementation without full conversion of coordinates. Only offset of the origin is taken into account in this case (but not e.g. scale) but this should be enough for simple cases. Closes #17609
This commit is contained in:
parent
e3be67a756
commit
a1682a4568
@ -303,6 +303,19 @@ void wxGCDCImpl::DoSetDeviceClippingRegion( const wxRegion ®ion )
|
||||
// region is in device coordinates
|
||||
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetDeviceClippingRegion - invalid DC") );
|
||||
|
||||
#ifdef __WXOSX__
|
||||
// This is a legacy implementation without
|
||||
// full conversion from device to logical coordinates
|
||||
// (only offset of the origin is taken into account,
|
||||
// but e.g. scale is not).
|
||||
// Solution with full conversion doesn't seem to work under WXOSX.
|
||||
// TODO: check wxMacCoreGraphics
|
||||
wxRegion logRegion(region);
|
||||
|
||||
logRegion.Offset(DeviceToLogicalX(0), DeviceToLogicalY(0));
|
||||
m_graphicContext->Clip(logRegion);
|
||||
wxRect newRegion = logRegion.GetBox();
|
||||
#else
|
||||
// Because graphics context works with logical coordinates
|
||||
// and clipping region is given in device coordinates
|
||||
// we need temporarily reset graphics context's coordinate system
|
||||
@ -331,6 +344,7 @@ void wxGCDCImpl::DoSetDeviceClippingRegion( const wxRegion ®ion )
|
||||
DeviceToLogicalYRel(newRegion.GetHeight()));
|
||||
newRegion.SetPosition(logPos);
|
||||
newRegion.SetSize(logSize);
|
||||
#endif // __WXOSX__ / !__WXOSX__
|
||||
|
||||
wxRect clipRegion;
|
||||
if ( m_clipping )
|
||||
|
Loading…
Reference in New Issue
Block a user