]> git.saurik.com Git - wxWidgets.git/commitdiff
bracket 10.5 only code
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 3 Jul 2009 11:51:46 +0000 (11:51 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 3 Jul 2009 11:51:46 +0000 (11:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/utils.mm

index b8aa14190b2bc054b6fd3430bdcdf90b60c1d8cb..3fdecac375f7bd83ea8a996eacdfaf4a3aed5cba 100644 (file)
@@ -298,15 +298,22 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
     // called from OnPaint, even with the window's paint dc as source (see wxHTMLWindow)
     NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect: [view bounds]] retain];
     [view unlockFocus];
+    
+    wxBitmap bitmap(width, height);
+    if ( [rep respondsToSelector:@selector(CGImage)] )
+    {
+        CGImageRef cgImageRef = (CGImageRef)[rep CGImage];
 
-    CGImageRef cgImageRef = (CGImageRef)[rep CGImage];
-
-    wxBitmap bitmap(CGImageGetWidth(cgImageRef)  , CGImageGetHeight(cgImageRef) );
-    CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef)  , CGImageGetHeight(cgImageRef) );
-    // since our context is upside down we dont use CGContextDrawImage
-    wxMacDrawCGImage( (CGContextRef) bitmap.GetHBITMAP() , &r, cgImageRef ) ;
-    CGImageRelease(cgImageRef);
-    cgImageRef = NULL;
+        CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef)  , CGImageGetHeight(cgImageRef) );
+        // since our context is upside down we dont use CGContextDrawImage
+        wxMacDrawCGImage( (CGContextRef) bitmap.GetHBITMAP() , &r, cgImageRef ) ;
+        CGImageRelease(cgImageRef);
+        cgImageRef = NULL;
+    }
+    else
+    {
+        // TODO for 10.4 in case we can support this for osx_cocoa
+    }
     [rep release];
 
     return bitmap;