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:
Artur Wieczorek
2021-03-21 18:44:06 +01:00
parent d1c0d3b18c
commit dc11bb18cf

View File

@@ -40,6 +40,7 @@
#include "wx/osx/dcmemory.h" #include "wx/osx/dcmemory.h"
#include "wx/osx/private.h" #include "wx/osx/private.h"
#include "wx/osx/core/cfdictionary.h" #include "wx/osx/core/cfdictionary.h"
#include "wx/osx/private/available.h"
#else #else
#include "CoreServices/CoreServices.h" #include "CoreServices/CoreServices.h"
#include "ApplicationServices/ApplicationServices.h" #include "ApplicationServices/ApplicationServices.h"
@@ -2051,6 +2052,14 @@ void wxMacCoreGraphicsContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDoubl
void wxMacCoreGraphicsContext::ResetClip() void wxMacCoreGraphicsContext::ResetClip()
{ {
if ( m_cgContext ) if ( m_cgContext )
{
#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 // 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 // state, but then we have to make sure everything else is NOT restored
@@ -2068,6 +2077,7 @@ void wxMacCoreGraphicsContext::ResetClip()
// Retain composition mode // Retain composition mode
DoSetCompositionMode(m_composition); DoSetCompositionMode(m_composition);
} }
}
else else
{ {
#if wxOSX_USE_COCOA_OR_CARBON #if wxOSX_USE_COCOA_OR_CARBON