cleanup, using Tiger funcs if possible

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2005-11-07 16:58:32 +00:00
parent d32be04cd7
commit 26a2f9144b

View File

@@ -1537,23 +1537,34 @@ CMProfileRef wxMacOpenGenericProfile(void)
return it whenever this function is called. return it whenever this function is called.
*/ */
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
#define kCGColorSpaceGenericRGB CFSTR("kCGColorSpaceGenericRGB")
#endif
CGColorSpaceRef wxMacGetGenericRGBColorSpace() CGColorSpaceRef wxMacGetGenericRGBColorSpace()
{ {
static CGColorSpaceRef genericRGBColorSpace = NULL; static wxMacCFRefHolder<CGColorSpaceRef> genericRGBColorSpace ;
if (genericRGBColorSpace == NULL) if (genericRGBColorSpace == NULL)
{ {
CMProfileRef genericRGBProfile = wxMacOpenGenericProfile(); if ( UMAGetSystemVersion() >= 0x1040 )
if (genericRGBProfile)
{ {
genericRGBColorSpace = CGColorSpaceCreateWithPlatformColorSpace(genericRGBProfile); genericRGBColorSpace.Set( CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ) ) ;
wxASSERT_MSG( genericRGBColorSpace != NULL, wxT("couldn't create the generic RGB color space") ) ;
// we opened the profile so it is up to us to close it
CMCloseProfile(genericRGBProfile);
} }
} else
{
CMProfileRef genericRGBProfile = wxMacOpenGenericProfile();
if (genericRGBProfile)
{
genericRGBColorSpace.Set( CGColorSpaceCreateWithPlatformColorSpace(genericRGBProfile) ) ;
wxASSERT_MSG( genericRGBColorSpace != NULL, wxT("couldn't create the generic RGB color space") ) ;
// we opened the profile so it is up to us to close it
CMCloseProfile(genericRGBProfile);
}
}
}
return genericRGBColorSpace; return genericRGBColorSpace;
} }
#endif #endif