diff options
| author | Manolo Gouy <Manolo> | 2016-04-03 08:36:19 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-04-03 08:36:19 +0000 |
| commit | b3af5591ca7f247b1233ce733c0c27fe9e635f1a (patch) | |
| tree | 99fd51b9634d453f3f90db935f1615199ef74075 /src | |
| parent | 9a97fc37fd164225954714d2f68748a8a41a6d08 (diff) | |
Stop using fl_read_image() to read window decoration.
Use instead an API internal to each platform code base.
fl_read_image() is used only for its documented feature
of reading inside the current window or an offscreen buffer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11518 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Screen_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 14 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 13 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index f2071d3cc..a444e293f 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -152,7 +152,7 @@ void Fl_Screen_Driver::compose_reset() { } uchar *Fl_Screen_Driver::read_image(uchar *p, int X, int Y, int w, int h, int alpha) { - if (w < 0 || fl_find(fl_window) == 0) { // read from off_screen buffer or title bar and frame + if (fl_find(fl_window) == 0) { // read from off_screen buffer return read_win_rectangle(p, X, Y, w, h, alpha); } Fl_RGB_Image *img = traverse_to_gl_subwindows(Fl_Window::current(), p, X, Y, w, h, alpha, NULL); diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 2496dab69..8d7e220a1 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -51,6 +51,7 @@ void fl_cleanup_dc_list(void); #include <FL/Fl.H> #include <FL/x.H> #include <FL/Fl_Window_Driver.H> +#include <FL/Fl_Screen_Driver.H> #include <FL/Fl_Graphics_Driver.H> // for fl_graphics_driver #include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H" #include <FL/fl_utf8.h> @@ -2369,8 +2370,8 @@ FL_EXPORT Window fl_xid_(const Fl_Window *w) { } /* Returns images of the captures of the window title-bar, and the left, bottom and right window borders. - On the WIN32 platform, this function exploits a feature of fl_read_image() which, when called - with NULL first argument and when fl_gc is set to the screen device context, captures the window decoration. + This function exploits a feature of Fl_WinAPI_Screen_Driver::read_win_rectangle() which, + when fl_gc is set to the screen device context, captures the window decoration. */ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right) { @@ -2389,24 +2390,23 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top fl_graphics_driver->gc(GetDC(NULL)); int ww = w() + 2 * wsides; // capture the 4 window sides from screen - fl_window = NULL; // force use of read_win_rectangle() by fl_read_image() uchar *rgb; if (htop) { - rgb = fl_read_image(NULL, r.left, r.top, ww, htop); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, r.left, r.top, ww, htop, 0); r_top = new Fl_RGB_Image(rgb, ww, htop, 3); r_top->alloc_array = 1; top = Fl_Shared_Image::get(r_top); } if (wsides) { - rgb = fl_read_image(NULL, r.left, r.top + htop, wsides, h()); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, r.left, r.top + htop, wsides, h(), 0); r_left = new Fl_RGB_Image(rgb, wsides, h(), 3); r_left->alloc_array = 1; left = Fl_Shared_Image::get(r_left); - rgb = fl_read_image(NULL, r.right - wsides, r.top + htop, wsides, h()); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, r.right - wsides, r.top + htop, wsides, h(), 0); r_right = new Fl_RGB_Image(rgb, wsides, h(), 3); r_right->alloc_array = 1; right = Fl_Shared_Image::get(r_right); - rgb = fl_read_image(NULL, r.left, r.bottom-hbottom, ww, hbottom); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, r.left, r.bottom-hbottom, ww, hbottom, 0); r_bottom = new Fl_RGB_Image(rgb, ww, hbottom, 3); r_bottom->alloc_array = 1; bottom = Fl_Shared_Image::get(r_bottom); diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 38b011249..06343fb1b 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -22,6 +22,7 @@ #include "../Xlib/Fl_Xlib_Graphics_Driver.H" #include <FL/Fl_Shared_Image.H> +#include <FL/Fl_Screen_Driver.H> #include <FL/Fl_Overlay_Window.H> #include <FL/Fl_Menu_Window.H> #include <FL/Fl_Tooltip.H> @@ -378,8 +379,8 @@ void Fl_X11_Window_Driver::free_icons() { Returned images can be deleted after use. Their depth and size may be platform-dependent. The top and bottom images extend from left of the left border to right of the right border. - On the X11 platform, this function exploits a feature of fl_read_image() which, when called - with negative 4th argument, captures the window decoration. + This function exploits a feature of Fl_X11_Screen_Driver::read_win_rectangle() which, + when called with negative 4th argument, captures the window decoration. */ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right) { @@ -404,21 +405,21 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F fl_window = parent; uchar *rgb; if (htop) { - rgb = fl_read_image(NULL, 0, 0, - (w() + 2 * wsides), htop); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, 0, 0, - (w() + 2 * wsides), htop, 0); r_top = new Fl_RGB_Image(rgb, w() + 2 * wsides, htop, 3); r_top->alloc_array = 1; top = Fl_Shared_Image::get(r_top); } if (wsides) { - rgb = fl_read_image(NULL, 0, htop, -wsides, h()); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop, -wsides, h(), 0); r_left = new Fl_RGB_Image(rgb, wsides, h(), 3); r_left->alloc_array = 1; left = Fl_Shared_Image::get(r_left); - rgb = fl_read_image(NULL, w() + wsides, htop, -wsides, h()); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, w() + wsides, htop, -wsides, h(), 0); r_right = new Fl_RGB_Image(rgb, wsides, h(), 3); r_right->alloc_array = 1; right = Fl_Shared_Image::get(r_right); - rgb = fl_read_image(NULL, 0, htop + h(), -(w() + 2*wsides), hbottom); + rgb = Fl::screen_driver()->read_win_rectangle(NULL, 0, htop + h(), -(w() + 2*wsides), hbottom, 0); r_bottom = new Fl_RGB_Image(rgb, w() + 2*wsides, hbottom, 3); r_bottom->alloc_array = 1; bottom = Fl_Shared_Image::get(r_bottom); |
