mirror of
https://github.com/fltk/fltk.git
synced 2026-02-06 16:31:43 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user