Modified Fl_Paged_Device::print_window() so it works with any kind of Fl_Paged_Device instance.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10007 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2013-10-23 14:39:14 +00:00
parent 49e2f6e9db
commit 4827a696df
1 changed files with 7 additions and 8 deletions

View File

@ -3435,22 +3435,21 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
this->print_widget(win, x_offset, y_offset);
return;
}
int bx, by, bt;
int bx, by, bt, bpp;
get_window_frame_sizes(bx, by, bt);
Fl_Display_Device::display_device()->set_current(); // send win to front and make it current
win->show();
fl_gc = NULL;
Fl::check();
win->make_current();
this->set_current(); // back to the Fl_Paged_Device
// capture the window title bar
CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt);
unsigned char *bitmap = Fl_X::bitmap_from_window_rect(win, 0, -bt, win->w(), bt, &bpp);
// and print it
CGRect rect = { { x_offset, y_offset }, { win->w(), bt } };
Fl_X::q_begin_image(rect, 0, 0, win->w(), bt);
CGContextDrawImage(fl_gc, rect, img);
Fl_X::q_end_image();
CFRelease(img);
this->set_current(); // back to the Fl_Paged_Device
Fl_RGB_Image *rgb = new Fl_RGB_Image(bitmap, win->w(), bt, bpp);
rgb->draw(x_offset, y_offset);
delete rgb;
delete[] bitmap;
this->print_widget(win, x_offset, y_offset + bt); // print the window inner part
}