Fix retrieving clipping box after changing wxGCDC coordinates (wxOSX)

Member data containing clipping box have to be updated not only when the clipping region is explicitly changed by SetClippingRegion()/DestroyClippingRegion() but also when existing wxGraphicsContext is associated with wxGCDC using SetGraphicsContext() or when wxGCDC coordinates are transformed with SetDeviceOrigin(), SetLogicalOrigin(), SetUserScale() or SetLogicalScale().
When any of these functions is called then clipping box data are marked as invalid and retrieved from underlying graphics context using wxGraphicsContext::GetClipBox() at nearest call to GetClippingBox().
Solution for wxMSW, wxGTK was implemented in 98714ea452.

See #17646.
This commit is contained in:
Artur Wieczorek 2017-07-02 13:55:53 +02:00
parent 214ed20697
commit 6b4be47a7a
2 changed files with 1 additions and 18 deletions

View File

@ -118,7 +118,7 @@ All (GUI):
- Add wxSYS_CARET_{ON,OFF,TIMEOUT}_MSEC system settings (brawer).
- Add wxGraphicsContext::GetClipBox().
- Fix wxGCDC::Clear() for rotated graphics context.
- Fix wxGCDC::GetClippingBox() for transformed wxDC (MSW, GTK+).
- Fix wxGCDC::GetClippingBox() for transformed wxDC.
- Add support for affine transformation matrix in wxGCDC.
- Add wxGraphicsContext::Flush() for Cairo renderer.
- Add wxStyledTextEvent::GetListCompletionMethod() (NewPagodi).

View File

@ -292,14 +292,6 @@ void wxGCDCImpl::UpdateClipBox()
void wxGCDCImpl::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
{
wxCHECK_RET( IsOk(), wxS("wxGCDC::DoGetClippingRegion - invalid GC") );
#ifdef __WXOSX__
// This is a legacy implementation which doesn't
// return proper values if graphics context coordinates
// were transformed after the call to SetClippingRegion().
// TODO: Check wxMacCoreGraphics::GetClipBox()
// and switch to the code used by other ports (below).
wxDCImpl::DoGetClippingBox(x, y, w, h);
#else
// Check if we should retrieve the clipping region possibly not set
// by SetClippingRegion() but modified by application: this can
// happen when we're associated with an existing graphics context using
@ -319,7 +311,6 @@ void wxGCDCImpl::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h
*w = m_clipX2 - m_clipX1;
if ( h )
*h = m_clipY2 - m_clipY1;
#endif // __WXOSX__ / !__WXOSX__
}
void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
@ -342,16 +333,8 @@ void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h
}
m_graphicContext->Clip( x, y, w, h );
#ifdef __WXOSX__
// This is a legacy implementation which has to be used
// because wxMacCoreGraphics::GetClipBox() is not yet tested.
// TODO: Check wxMacCoreGraphics::GetClipBox()
// and switch to the code used by other ports (below).
wxDCImpl::DoSetClippingRegion(x, y, w, h);
#else
m_clipping = true;
UpdateClipBox();
#endif // __WXOSX__ / !__WXOSX__
}
void wxGCDCImpl::DoSetDeviceClippingRegion( const wxRegion &region )