Check if stack of graphics states is empty while attempting to reset the clip
For macOS < 10.13 there is not available any method to really reset the clipping region so ResetClip() is implemented using hack that works for sure only if no graphics state was stored before on the stack with PushState(). If ResetClip() is called when some graphics states are already stored with PushState() we can only warn that resetting the clip may be not effective. See #19231.
This commit is contained in:
@@ -2141,6 +2141,12 @@ void wxMacCoreGraphicsContext::ResetClip()
|
||||
{
|
||||
// there is no way for clearing the clip, we can only revert to the stored
|
||||
// state, but then we have to make sure everything else is NOT restored
|
||||
// Note: This trick works as expected only if a state with no clipping
|
||||
// path is stored on the top of the stack. It's guaranteed to work only
|
||||
// when no PushState() was called before because in this case a reference
|
||||
// state (initial state without clipping region) is on the top of the stack.
|
||||
wxASSERT_MSG(m_stateStackLevel == 0,
|
||||
"Resetting the clip may not work when PushState() was called before");
|
||||
CGAffineTransform transform = CGContextGetCTM( m_cgContext );
|
||||
CGContextRestoreGState( m_cgContext );
|
||||
CGContextSaveGState( m_cgContext );
|
||||
|
Reference in New Issue
Block a user