diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index e9519b4a80..546033894c 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -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 )