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/WinAPI/Fl_WinAPI_Screen_Driver.cxx | |
| 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/WinAPI/Fl_WinAPI_Screen_Driver.cxx')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 9373d345d..f44fa7a3c 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -496,24 +496,21 @@ int Fl_WinAPI_Screen_Driver::compose(int &del) { Fl_RGB_Image * // O - image or NULL if failed -Fl_WinAPI_Screen_Driver::read_win_rectangle(uchar *p, // I - Pixel buffer or NULL to allocate +Fl_WinAPI_Screen_Driver::read_win_rectangle( int X, // I - Left position int Y, // I - Top position int w, // I - Width of area to read - int h, // I - Height of area to read - int alpha) // I - Alpha value for image (0 for none) + int h) // I - Height of area to read { float s = Fl_Surface_Device::surface()->driver()->scale(); - return read_win_rectangle_unscaled(p, X*s, Y*s, w*s, h*s, alpha); + return read_win_rectangle_unscaled(X*s, Y*s, w*s, h*s); } -Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(uchar *p, int X, int Y, int w, int h, int alpha) +Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y, int w, int h) { - int d; // Depth of image - - // Allocate the image data array as needed... - d = alpha ? 4 : 3; - + int d = 3; // Depth of image + int alpha = 0; uchar *p = NULL; + // Allocate the image data array as needed... const uchar *oldp = p; if (!p) p = new uchar[w * h * d]; |
