From c6ee3b19220a8be783497511e269069d063bd190 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 9 Mar 2008 17:58:10 +0000 Subject: STR 1891: fixing fl_read_image for double buffered windows. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@6065 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_read_image.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/fl_read_image.cxx b/src/fl_read_image.cxx index e2d6b61e2..da48d5ea1 100644 --- a/src/fl_read_image.cxx +++ b/src/fl_read_image.cxx @@ -124,18 +124,18 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate if (!image) { // fetch absolute coordinates - int dx, dy; + int dx, dy, sx, sy, sw, sh; Window child_win; - XTranslateCoordinates(fl_display, fl_window, - RootWindow(fl_display, fl_screen), X, Y, &dx, &dy, &child_win); - - // screen dimensions - int sx, sy, sw, sh; - Fl::screen_xywh(sx, sy, sw, sh, fl_screen); - - if (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh) { + Fl_Window *win = fl_find(fl_window); + if (win) { + XTranslateCoordinates(fl_display, fl_window, + RootWindow(fl_display, fl_screen), X, Y, &dx, &dy, &child_win); + // screen dimensions + Fl::screen_xywh(sx, sy, sw, sh, fl_screen); + } + if (!win || (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh)) { // the image is fully contained, we can use the traditional method - image = XGetImage(fl_display, fl_window, X, Y, w, h, AllPlanes, ZPixmap); + image = XGetImage(fl_display, fl_window, X, Y, w, h, AllPlanes, ZPixmap); } else { // image is crossing borders, determine visible region int nw, nh, noffx, noffy; -- cgit v1.2.3