diff options
| author | Manolo Gouy <Manolo> | 2012-03-14 08:49:36 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2012-03-14 08:49:36 +0000 |
| commit | 7d0b5d05cb14b2a14b891e4957d3db30d451b0f1 (patch) | |
| tree | 2f6bb78f4937483d3fc4aaedffa7c5ebe672c672 /src/Fl_cocoa.mm | |
| parent | f6cb583e27ffd6046da7a28edc35fc8001ea9415 (diff) | |
Simplified Fl_Paged_Device::print_window() under Mac OS
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9282 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_cocoa.mm')
| -rw-r--r-- | src/Fl_cocoa.mm | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 2f41c7c48..d1dd3ade0 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3244,7 +3244,7 @@ int Fl::dnd(void) } unsigned char *Fl_X::bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel) -// delete the returned pointer after use +// delete[] the returned pointer after use { while(win->window()) { x += win->x(); @@ -3346,23 +3346,14 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset) Fl::check(); win->make_current(); this->set_current(); // back to the Fl_Paged_Device - if (driver()->class_name() == Fl_Quartz_Graphics_Driver::class_id) { - // capture as transparent image the window title bar from screen - CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt); - CGRect rect = { { x_offset, y_offset }, { win->w(), bt } }; // print the title bar - Fl_X::q_begin_image(rect, 0, 0, win->w(), bt); - CGContextDrawImage(fl_gc, rect, img); - Fl_X::q_end_image(); - CGImageRelease(img); - } - else { - // capture the window title bar from screen - uchar *top_image = fl_read_image(NULL, 0, -bt, win->w(), bt); - if (top_image) { // print the title bar - fl_draw_image(top_image, x_offset, y_offset, win->w(), bt, 3); - delete[] top_image; - } - } + int bpp; + // capture the window title bar as an RGBA image + unsigned char *top_image = Fl_X::bitmap_from_window_rect(win, 0, -bt, win->w(), bt, &bpp); + Fl_RGB_Image* rgba = new Fl_RGB_Image(top_image, win->w(), bt, bpp); + // and print it + rgba->draw(x_offset, y_offset); + delete rgba; + delete[] top_image; this->print_widget(win, x_offset, y_offset + bt); // print the window inner part } |
