diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2008-03-09 17:58:10 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2008-03-09 17:58:10 +0000 |
| commit | c6ee3b19220a8be783497511e269069d063bd190 (patch) | |
| tree | e0e9dd4fa2b94de8152b78a7ae62bf748295ecb8 | |
| parent | 75693af5dae5dfecefd7d44ee507011326adc56b (diff) | |
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
| -rw-r--r-- | src/fl_read_image.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
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; |
