diff --git a/src/Fl_Copy_Surface.cxx b/src/Fl_Copy_Surface.cxx index 47881bf98..5cab56609 100644 --- a/src/Fl_Copy_Surface.cxx +++ b/src/Fl_Copy_Surface.cxx @@ -244,7 +244,7 @@ void Fl_Copy_Surface::draw_decorated_window(Fl_Window* win, int delta_x, int del } else { CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt); CGContextDrawImage(gc, CGRectMake(0, 0, win->w(), bt), img); - CFRelease(img); + CGImageRelease(img); } CGContextRestoreGState(gc); } diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index ffc3666a1..b24541a6a 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -215,7 +215,7 @@ void Fl_Image_Surface::draw_decorated_window(Fl_Window* win, int delta_x, int de } else { CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt); CGContextDrawImage(fl_gc, CGRectMake(0, 0, win->w(), bt), img); - CFRelease(img); + CGImageRelease(img); } helper->untranslate(); CGContextTranslateCTM(fl_gc, delta_x, height+delta_y); diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 3164ce38c..468db64b4 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -4492,7 +4492,7 @@ static NSBitmapImageRep* rect_to_NSBitmapImageRep_layer(Fl_Window *win, int x, i NSBitmapImageRep *bitmap = nil; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 CGContextRef gc = ((FLViewLayer*)[fl_xid(win) contentView])->layer_data; - if (!gc) return nil; + if (!gc || y < 0) return nil; CGImageRef cgimg = CGBitmapContextCreateImage(gc); // requires 10.4 Fl_X *i = Fl_X::i( win ); int resolution = i->mapped_to_retina() ? 2 : 1;