summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-11 09:15:42 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-09-11 09:15:42 +0200
commit2ea85ea6d7a9d377abcc01f4755d146dcbe30d60 (patch)
tree1004ec355bf78a449d55a195aa1d8d4c1aadd542
parentb37576aa55a9b93e94fb6d1c63e45ad182de1f28 (diff)
Fix regression in fl_read_image() after introduction of hybrid Wayland/X11 platform.
The special use context of fl_read_image() inside the draw() function of an Fl_Double_Window, where the function should read inside the window's double buffer rather than the on-screen window, no longer worked. Removal of all uses of the fl_window global variable from platform-independent code remains necessary, because this variable is ill-defined in the Wayland/X11 library.
-rw-r--r--src/fl_read_image.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fl_read_image.cxx b/src/fl_read_image.cxx
index 0d5f7ec5c..b34585197 100644
--- a/src/fl_read_image.cxx
+++ b/src/fl_read_image.cxx
@@ -40,7 +40,9 @@
uchar *fl_read_image(uchar *p, int X, int Y, int w, int h, int alpha) {
uchar *image_data = NULL;
Fl_RGB_Image *img;
- if (Fl_Surface_Device::surface()->as_image_surface()) { // read from off_screen buffer
+ // TODO: strive to remove use of the fl_window global variable in platform-independent code
+ //if (Fl_Surface_Device::surface()->as_image_surface()) { // read from off_screen buffer
+ if (fl_find(fl_window)==0) { // read from off_screen buffer
img = Fl::screen_driver()->read_win_rectangle(X, Y, w, h, 0);
if (!img) {
return NULL;