diff options
| author | Manolo Gouy <Manolo> | 2016-08-23 09:38:46 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-08-23 09:38:46 +0000 |
| commit | 0267781cec8c0bb59689c8b1bad59f98fd3283f9 (patch) | |
| tree | ed4498a3cee48df049c1323f1aa91087bc8f7f0a /src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | |
| parent | 9c8c062d6b5498d3acdf07a841f4036f45ff73f0 (diff) | |
Change return type of Fl_Screen_Driver::read_win_rectangle() to Fl_RGB_Image*
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11884 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 | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 86aa78a32..5c3388ce3 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -23,6 +23,7 @@ #include <FL/Fl.H> #include <FL/x.H> #include <FL/Fl_Graphics_Driver.H> +#include <FL/Fl_RGB_Image.H> #include <FL/fl_ask.H> #include <stdio.h> @@ -553,7 +554,7 @@ void Fl_Screen_Driver::font_name(int num, const char *name) { } -uchar * // O - Pixel buffer or NULL if failed +Fl_RGB_Image * // O - Pixel buffer or NULL if failed Fl_WinAPI_Screen_Driver::read_win_rectangle(uchar *p, // I - Pixel buffer or NULL to allocate int X, // I - Left position int Y, // I - Top position @@ -566,6 +567,7 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle(uchar *p, // I - Pixel buffer or NU // Allocate the image data array as needed... d = alpha ? 4 : 3; + const uchar *oldp = p; if (!p) p = new uchar[w * h * d]; // Initialize the default colors/alpha in the whole image... @@ -593,7 +595,7 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle(uchar *p, // I - Pixel buffer or NU Y = 0; } - if (h < 1 || w < 1) return p; // nothing to copy + if (h < 1 || w < 1) return 0/*p*/; // nothing to copy int line_size = ((3*w+3)/4) * 4; // each line is aligned on a DWORD (4 bytes) uchar *dib = new uchar[line_size*h]; // create temporary buffer to read DIB @@ -649,7 +651,9 @@ Fl_WinAPI_Screen_Driver::read_win_rectangle(uchar *p, // I - Pixel buffer or NU DeleteObject(hbm); delete[] dib; // delete DIB temporary buffer - return p; + Fl_RGB_Image *rgb = new Fl_RGB_Image(p, w, h, d); + if (!oldp) rgb->alloc_array = 1; + return rgb; } // |
