Skip to content

Commit

Permalink
Fix regression in fl_read_image() after introduction of hybrid Waylan…
Browse files Browse the repository at this point in the history
…d/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.
  • Loading branch information
ManoloFLTK committed Sep 11, 2022
1 parent b37576a commit 2ea85ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fl_read_image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2ea85ea

Please sign in to comment.