]> git.saurik.com Git - wxWidgets.git/commitdiff
have CGImage Support in all OSX builds
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 1 Mar 2005 05:31:37 +0000 (05:31 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 1 Mar 2005 05:31:37 +0000 (05:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/bitmap.h
include/wx/mac/carbon/private.h
src/mac/carbon/bitmap.cpp
src/mac/carbon/dccg.cpp
src/mac/carbon/utils.cpp

index 054249c602d4d6817d49e42a1ee8fdc122930125..c051d22fdb8d7d4c8c8f2cf96163083f20124e59 100644 (file)
@@ -196,7 +196,7 @@ public:
     // returns the 'native' implementation, a GWorldPtr for the content and one for the mask 
     WXHBITMAP GetHBITMAP( WXHBITMAP * mask = NULL ) const;
 
-#if wxMAC_USE_CORE_GRAPHICS
+#ifdef __WXMAC_OSX__
     // returns a CGImageRef which must released after usage with CGImageRelease
     WXCGIMAGEREF CGImageCreate() const ;
 #endif
index cc8566c00025e8dd8ed67fa5332ef5e70a6af2a1..61860b319a58548709ac6eeef9d374fc91f8f754 100644 (file)
@@ -637,10 +637,14 @@ private:
     wxBrush m_brush ;
 } ;
 
+#endif // wxMAC_USE_CORE_GRAPHICS
+
+#ifdef __WXMAC_OSX__
+
 CGColorSpaceRef wxMacGetGenericRGBColorSpace(void) ;
 void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t size) ;
 
-#endif // wxMAC_USE_CORE_GRAPHICS
+#endif
 
 class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
 {
@@ -678,7 +682,7 @@ public:
 #endif // wxUSE_PALETTE
     
     wxMask *      m_bitmapMask; // Optional mask
-#if wxMAC_USE_CORE_GRAPHICS
+#ifdef __WXMAC_OSX__
     CGImageRef    CGImageCreate() const ;
 #endif
      
@@ -710,7 +714,7 @@ private :
     wxMemoryBuffer m_memBuf ;
     int           m_rawAccessCount ;
     bool          m_ok;
-#if wxMAC_USE_CORE_GRAPHICS
+#ifdef __WXMAC_OSX__
     mutable CGImageRef    m_cgImageRef ;
 #endif
     IconRef       m_iconRef ;
index b661b95f8f5ce58ded89e5deaaf22b146498f96e..6af3e478ac87ca18dd8493de8921629806058da0 100644 (file)
@@ -454,7 +454,7 @@ PicHandle wxBitmapRefData::GetPictHandle()
     return m_pictHandle ;
 }
 
-#if wxMAC_USE_CORE_GRAPHICS
+#ifdef __WXMAC_OSX__
 void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t size)
 {
     wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;
@@ -817,7 +817,7 @@ bool wxBitmap::CreateFromXpm(const char **bits)
     return TRUE;
 }
 
-#if wxMAC_USE_CORE_GRAPHICS
+#ifdef __WXMAC_OSX__
 WXCGIMAGEREF wxBitmap::CGImageCreate() const
 {
     wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
index 1dc482be5d59e44b78d399d251cbc5a1c5c793c0..f73b9be63b02e0b2766b3a4245b533916e47ab4f 100755 (executable)
@@ -467,68 +467,6 @@ void wxMacCGContext::SetBrush( const wxBrush &brush )
     }
 }
 
-// snippets from Sketch Sample from Apple :
-
-#define        kGenericRGBProfilePathStr       "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
-/*
-    This function locates, opens, and returns the profile reference for the calibrated 
-    Generic RGB color space. It is up to the caller to call CMCloseProfile when done
-    with the profile reference this function returns.
-*/
-CMProfileRef wxMacOpenGenericProfile(void)
-{
-    static CMProfileRef cachedRGBProfileRef = NULL;
-    
-    // we only create the profile reference once
-    if (cachedRGBProfileRef == NULL)
-    {
-               CMProfileLocation       loc;
-       
-               loc.locType = cmPathBasedProfile;
-               strcpy(loc.u.pathLoc.path, kGenericRGBProfilePathStr);
-       
-               verify_noerr( CMOpenProfile(&cachedRGBProfileRef, &loc) );
-    }
-
-    if (cachedRGBProfileRef)
-    {
-               // clone the profile reference so that the caller has their own reference, not our cached one
-               CMCloneProfileRef(cachedRGBProfileRef);   
-    }
-
-    return cachedRGBProfileRef;
-}
-
-/*
-    Return the generic RGB color space. This is a 'get' function and the caller should
-    not release the returned value unless the caller retains it first. Usually callers
-    of this routine will immediately use the returned colorspace with CoreGraphics
-    so they typically do not need to retain it themselves.
-    
-    This function creates the generic RGB color space once and hangs onto it so it can
-    return it whenever this function is called.
-*/
-
-CGColorSpaceRef wxMacGetGenericRGBColorSpace()
-{
-    static CGColorSpaceRef genericRGBColorSpace = NULL;
-
-       if (genericRGBColorSpace == NULL)
-       {
-               CMProfileRef genericRGBProfile = wxMacOpenGenericProfile();
-       
-               if (genericRGBProfile)
-               {
-                       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); 
-               }
-       }
-    return genericRGBColorSpace;
-}
-
 void AddEllipticArcToPath(CGContextRef c, CGPoint center, float a, float b, float fromDegree , float toDegree )
 {
     CGContextSaveGState(c);
index cef9733b640789f5192bdced93bd94d451b5005e..4c829e6ca5bc7b668fcd50748cbafc66462af9a0 100644 (file)
@@ -1457,5 +1457,73 @@ OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable )
     return ::SetTabEnabled( m_controlRef , tabNo , enable ) ;
 }
 
+//
+// Quartz Support
+//
+
+#ifdef __WXMAC_OSX__
+// snippets from Sketch Sample from Apple :
+
+#define        kGenericRGBProfilePathStr       "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
+/*
+    This function locates, opens, and returns the profile reference for the calibrated 
+    Generic RGB color space. It is up to the caller to call CMCloseProfile when done
+    with the profile reference this function returns.
+*/
+CMProfileRef wxMacOpenGenericProfile(void)
+{
+    static CMProfileRef cachedRGBProfileRef = NULL;
+    
+    // we only create the profile reference once
+    if (cachedRGBProfileRef == NULL)
+    {
+               CMProfileLocation       loc;
+       
+               loc.locType = cmPathBasedProfile;
+               strcpy(loc.u.pathLoc.path, kGenericRGBProfilePathStr);
+       
+               verify_noerr( CMOpenProfile(&cachedRGBProfileRef, &loc) );
+    }
+
+    if (cachedRGBProfileRef)
+    {
+               // clone the profile reference so that the caller has their own reference, not our cached one
+               CMCloneProfileRef(cachedRGBProfileRef);   
+    }
+
+    return cachedRGBProfileRef;
+}
+
+/*
+    Return the generic RGB color space. This is a 'get' function and the caller should
+    not release the returned value unless the caller retains it first. Usually callers
+    of this routine will immediately use the returned colorspace with CoreGraphics
+    so they typically do not need to retain it themselves.
+    
+    This function creates the generic RGB color space once and hangs onto it so it can
+    return it whenever this function is called.
+*/
+
+CGColorSpaceRef wxMacGetGenericRGBColorSpace()
+{
+    static CGColorSpaceRef genericRGBColorSpace = NULL;
+
+       if (genericRGBColorSpace == NULL)
+       {
+               CMProfileRef genericRGBProfile = wxMacOpenGenericProfile();
+       
+               if (genericRGBProfile)
+               {
+                       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); 
+               }
+       }
+    return genericRGBColorSpace;
+}
+#endif
+
 #endif // wxUSE_GUI