diff options
| author | Manolo Gouy <Manolo> | 2018-05-04 15:11:47 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-05-04 15:11:47 +0000 |
| commit | 20ccb6b7f2b0b2b742211c31a32c3ac612c43489 (patch) | |
| tree | bc432cbcba741ba6dab1ab27b0c5674160b67b12 /src/Fl_cocoa.mm | |
| parent | d4eeb75ac6829e663996e87c3584e247d10eead8 (diff) | |
Shorten the list of virtual member functions used to support Fl_Widget_Surface derived classes.
Change Fl_Cocoa_Screen_Driver::read_win_rectangle() so it captures only
from the current window and ignores its subwindows, as do other Fl_Screen_Driver derived classes.
Remove Fl_Cocoa_Printer_Driver::print_window_part() that is no longer necessary.
Remove Fl_Printer::print_widget() and Fl_Printer::print_window_part() that
are no longer necessary.
Stop Fl_Widget_Surface::print_window_part() from being virtual because its platform-independent
implementation should suffice.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12894 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_cocoa.mm')
| -rw-r--r-- | src/Fl_cocoa.mm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 7cac1b1ef..20c15e857 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -87,7 +87,7 @@ static void createAppleMenu(void); static void cocoaMouseHandler(NSEvent *theEvent); static void clipboard_check(void); static unsigned make_current_counts = 0; // if > 0, then Fl_Window::make_current() can be called only once -static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y, int w, int h); +static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y, int w, int h, bool capture_subwins = true); static void drain_dropped_files_list(void); int fl_mac_os_version = Fl_Darwin_System_Driver::calc_mac_os_version(); // the version number of the running Mac OS X (e.g., 100604 for 10.6.4) @@ -4181,7 +4181,7 @@ static NSBitmapImageRep* GL_rect_to_nsbitmap(Fl_Window *win, int x, int y, int w return bitmap; } -static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y, int w, int h) +static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y, int w, int h, bool capture_subwins) /* Captures a rectangle from a mapped window. On retina displays, the resulting bitmap has 2 pixels per screen unit. The returned value is to be released after use @@ -4222,7 +4222,7 @@ static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y, NSArray *children = [fl_xid(win) childWindows]; // 10.2 NSEnumerator *enumerator = [children objectEnumerator]; id child; - while ((child = [enumerator nextObject]) != nil) { + while (capture_subwins && ((child = [enumerator nextObject]) != nil)) { if (![child isKindOfClass:[FLWindow class]]) continue; Fl_Window *sub = [(FLWindow*)child getFl_Window]; CGRect rsub = CGRectMake(sub->x(), win->h() -(sub->y()+sub->h()), sub->w(), sub->h()); @@ -4247,7 +4247,7 @@ static void nsbitmapProviderReleaseData (void *info, const void *data, size_t si [(NSBitmapImageRep*)info release]; } -CGImageRef Fl_Cocoa_Window_Driver::CGImage_from_window_rect(int x, int y, int w, int h) +CGImageRef Fl_Cocoa_Window_Driver::CGImage_from_window_rect(int x, int y, int w, int h, bool capture_subwins) /* Returns a capture of a rectangle of a mapped window as a CGImage. With retina displays, the returned image has twice the width and height. CFRelease the returned CGImageRef after use @@ -4255,7 +4255,7 @@ CGImageRef Fl_Cocoa_Window_Driver::CGImage_from_window_rect(int x, int y, int w, { Fl_Window *win = pWindow; CGImageRef img; - NSBitmapImageRep *bitmap = rect_to_NSBitmapImageRep(win, x, y, w, h); + NSBitmapImageRep *bitmap = rect_to_NSBitmapImageRep(win, x, y, w, h, capture_subwins); if (fl_mac_os_version >= 100500) { img = (CGImageRef)[bitmap performSelector:@selector(CGImage)]; // requires Mac OS 10.5 CGImageRetain(img); @@ -4363,7 +4363,7 @@ void Fl_Cocoa_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, } } } else { - CGImageRef img = CGImage_from_window_rect(0, -htop, scaled_w, htop); + CGImageRef img = CGImage_from_window_rect(0, -htop, scaled_w, htop, false); CGContextSaveGState(auxgc); clip_to_rounded_corners(auxgc, scaled_w, htop); CGContextDrawImage(auxgc, CGRectMake(0, 0, scaled_w, htop), img); |
