]> git.saurik.com Git - wxWidgets.git/commitdiff
cleanup, using Tiger funcs if possible
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 7 Nov 2005 16:58:32 +0000 (16:58 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 7 Nov 2005 16:58:32 +0000 (16:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/utils.cpp

index 1aff6d1778eab71149ca0fbb367d5c3f5a4b1012..b197837cf115bc951f2f2dfd09e7654fea925da1 100644 (file)
@@ -1537,23 +1537,34 @@ CMProfileRef wxMacOpenGenericProfile(void)
     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()
 {
-    static CGColorSpaceRef genericRGBColorSpace = NULL;
-
-    if (genericRGBColorSpace == NULL)
-    {
-        CMProfileRef genericRGBProfile = wxMacOpenGenericProfile();
+    static wxMacCFRefHolder<CGColorSpaceRef> genericRGBColorSpace ;
 
-        if (genericRGBProfile)
+       if (genericRGBColorSpace == NULL)
+       {
+        if ( UMAGetSystemVersion() >= 0x1040 )
         {
-            genericRGBColorSpace = 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);
+            genericRGBColorSpace.Set( CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ) ) ;
         }
-    }
+        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;
 }
 #endif