Use new CoreGraphics API to reset clipping region
Since 10.13 there is available a dedicated CGContextResetClip() API to reset a clipping region so we don't need to use current workaround anymore.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "wx/osx/dcmemory.h"
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/osx/core/cfdictionary.h"
|
||||
#include "wx/osx/private/available.h"
|
||||
#else
|
||||
#include "CoreServices/CoreServices.h"
|
||||
#include "ApplicationServices/ApplicationServices.h"
|
||||
@@ -2052,21 +2053,30 @@ void wxMacCoreGraphicsContext::ResetClip()
|
||||
{
|
||||
if ( m_cgContext )
|
||||
{
|
||||
// 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
|
||||
CGAffineTransform transform = CGContextGetCTM( m_cgContext );
|
||||
CGContextRestoreGState( m_cgContext );
|
||||
CGContextSaveGState( m_cgContext );
|
||||
CGAffineTransform transformNew = CGContextGetCTM( m_cgContext );
|
||||
transformNew = CGAffineTransformInvert( transformNew ) ;
|
||||
CGContextConcatCTM( m_cgContext, transformNew);
|
||||
CGContextConcatCTM( m_cgContext, transform);
|
||||
// Retain antialiasing mode
|
||||
DoSetAntialiasMode(m_antialias);
|
||||
// Retain interpolation quality
|
||||
DoSetInterpolationQuality(m_interpolation);
|
||||
// Retain composition mode
|
||||
DoSetCompositionMode(m_composition);
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13
|
||||
if ( WX_IS_MACOS_OR_IOS_AVAILABLE(10, 13, 11, 0) )
|
||||
{
|
||||
CGContextResetClip(m_cgContext);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// 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
|
||||
CGAffineTransform transform = CGContextGetCTM( m_cgContext );
|
||||
CGContextRestoreGState( m_cgContext );
|
||||
CGContextSaveGState( m_cgContext );
|
||||
CGAffineTransform transformNew = CGContextGetCTM( m_cgContext );
|
||||
transformNew = CGAffineTransformInvert( transformNew ) ;
|
||||
CGContextConcatCTM( m_cgContext, transformNew);
|
||||
CGContextConcatCTM( m_cgContext, transform);
|
||||
// Retain antialiasing mode
|
||||
DoSetAntialiasMode(m_antialias);
|
||||
// Retain interpolation quality
|
||||
DoSetInterpolationQuality(m_interpolation);
|
||||
// Retain composition mode
|
||||
DoSetCompositionMode(m_composition);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user