diff options
| author | Manolo Gouy <Manolo> | 2018-02-09 13:48:22 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-02-09 13:48:22 +0000 |
| commit | c472d5d8b76e17e4dd537ca20c9bfb144b06189c (patch) | |
| tree | fbe64110002b5d36127631c37cc5d1bb44f86318 /src/drivers/X11 | |
| parent | b78b2f7f5f24b98640d31bb8ee7b573703e8cc19 (diff) | |
Fix fl_read_image() under MacOS platform when GUI is rescaled.
This commit also simplifies the platform-dependent support of fl_read_image():
only Fl_XXX_Screen_Driver::read_win_rectangle() contains platform-specific
code to capture pixels from the current window or from an offscreen buffer.
Platform-independent function Fl_Screen_Driver::traverse_to_gl_subwindows()
captures subwindows that intersect with the area fl_read_image() targets.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12653 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/X11')
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H index 6ceca775c..78a0510a5 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.H +++ b/src/drivers/X11/Fl_X11_Screen_Driver.H @@ -4,7 +4,7 @@ // Definition of X11 Screen interface // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2017 by Bill Spitzak and others. +// Copyright 2010-2018 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -93,7 +93,7 @@ public: virtual int compose(int &del); virtual void compose_reset(); virtual int text_display_can_leak(); - virtual Fl_RGB_Image *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha); + virtual Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h); virtual int get_mouse(int &x, int &y); virtual void enable_im(); virtual void disable_im(); diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index 6b253931d..7f6dc5528 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -750,7 +750,7 @@ extern "C" { } } -Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha) +Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h) { XImage *image; // Captured image int i, maxindex; // Looping vars @@ -862,14 +862,14 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, i printf("map_entries = %d\n", fl_visual->visual->map_entries); #endif // DEBUG - d = alpha ? 4 : 3; - + d = 3; + uchar *p = NULL; // Allocate the image data array as needed... const uchar *oldp = p; if (!p) p = new uchar[w * h * d]; // Initialize the default colors/alpha in the whole image... - memset(p, alpha, w * h * d); + memset(p, 0, w * h * d); // Check that we have valid mask/shift values... if (!image->red_mask && image->bits_per_pixel > 12) { diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 5612ce4df..b89688b47 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -413,22 +413,22 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F htop /= s; wsides /= s; fl_window = parent; if (htop) { - r_top = Fl::screen_driver()->read_win_rectangle(NULL, 0, 0, - (w() + 2 * wsides), htop, 0); + r_top = Fl::screen_driver()->read_win_rectangle(0, 0, - (w() + 2 * wsides), htop); top = Fl_Shared_Image::get(r_top); top->scale(w() + 2 * wsides, htop, 0, 1); } if (wsides) { - r_left = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop, -wsides, h(), 0); + r_left = Fl::screen_driver()->read_win_rectangle(0, htop, -wsides, h()); if (r_left) { left = Fl_Shared_Image::get(r_left); left->scale(wsides, h(), 0, 1); } - r_right = Fl::screen_driver()->read_win_rectangle(NULL, w() + wsides, htop, -wsides, h(), 0); + r_right = Fl::screen_driver()->read_win_rectangle(w() + wsides, htop, -wsides, h()); if (r_right) { right = Fl_Shared_Image::get(r_right); right->scale(wsides, h(), 0, 1); } - r_bottom = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop + h(), -(w() + 2*wsides), hbottom, 0); + r_bottom = Fl::screen_driver()->read_win_rectangle(0, htop + h(), -(w() + 2*wsides), hbottom); if (r_bottom) { bottom = Fl_Shared_Image::get(r_bottom); bottom->scale(w() + 2*wsides, wsides, 0, 1); |
