Use built-in conversion to CGColorRef where available

This commit is contained in:
Stefan Csomor
2018-06-14 20:11:26 +02:00
parent 5091d87825
commit 56d125041f

View File

@@ -21,6 +21,16 @@ static inline wxColour::ChannelType NSColorChannelToWX(CGFloat c)
wxColour::wxColour(WX_NSColor col)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
if ( wxPlatformInfo::Get().CheckOSVersion(10, 8) )
{
CGColorRef cgcolor = [col CGColor];
CFRetain(cgcolor);
InitCGColorRef(cgcolor);
return ;
}
#endif
// Simplest case is when we can directly get the RGBA components:
if ( NSColor* colRGBA = [col colorUsingColorSpaceName:NSCalibratedRGBColorSpace] )
{