From e6929834c7f41b172b63795bd76cddb6295b7ca5 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 5 May 2018 17:35:09 +0000 Subject: Fix Fl_Screen_Driver::traverse_to_gl_subwindows() to support Fl_Widget_Surface::print_window_part(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12900 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Screen_Driver.cxx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index 0f5008e32..d926c02ff 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -191,7 +191,7 @@ Fl_RGB_Image *Fl_Screen_Driver::traverse_to_gl_subwindows(Fl_Group *g, int x, in if (!pi) return full_img; full_img = pi->rectangle_capture(g, x, y, w, h); } - else if ( g->as_window()/* && (!full_img || (g->window() && g->window()->as_gl_window()))*/ ) { + else if ( g->as_window() ) { if (full_img) g->as_window()->make_current(); full_img = Fl::screen_driver()->read_win_rectangle(x, y, w, h); } @@ -205,23 +205,15 @@ Fl_RGB_Image *Fl_Screen_Driver::traverse_to_gl_subwindows(Fl_Group *g, int x, in if (x < c->x()) origin_x = c->x(); int origin_y = y; if (y < c->y()) origin_y = c->y(); - int width = c->w(); - if (origin_x + width > c->x() + c->w()) width = c->x() + c->w() - origin_x; - if (origin_x + width > x + w) width = x + w - origin_x; - int height = c->w(); - if (origin_y + height > c->y() + c->h()) height = c->y() + c->h() - origin_y; - if (origin_y + height > y + h) height = y + h - origin_y; + int maxi = x + w; if (maxi > c->x() + c->w()) maxi = c->x() + c->w(); + int width = maxi - origin_x; + maxi = y + h; if (maxi > c->y() + c->h()) maxi = c->y() + c->h(); + int height = maxi - origin_y; if (width > 0 && height > 0) { Fl_RGB_Image *img = traverse_to_gl_subwindows(c->as_window(), origin_x - c->x(), origin_y - c->y(), width, height, full_img); if (img == full_img) continue; - int top; - //if (c->as_gl_window()) { - top = origin_y - y; - /*} else { - top = full_img->h() - (origin_y - y + img->h()); - }*/ - write_image_inside(full_img, img, (origin_x - x) * full_img_scale, top * full_img_scale); + write_image_inside(full_img, img, (origin_x - x) * full_img_scale, (origin_y - y) * full_img_scale); delete img; } } -- cgit v1.2.3