summaryrefslogtreecommitdiff
path: root/src/drivers/X11/Fl_X11_Screen_Driver.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-08-23 09:38:46 +0000
committerManolo Gouy <Manolo>2016-08-23 09:38:46 +0000
commit0267781cec8c0bb59689c8b1bad59f98fd3283f9 (patch)
treeed4498a3cee48df049c1323f1aa91087bc8f7f0a /src/drivers/X11/Fl_X11_Screen_Driver.cxx
parent9c8c062d6b5498d3acdf07a841f4036f45ff73f0 (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/X11/Fl_X11_Screen_Driver.cxx')
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 5eeb2a1b6..f8bf520b1 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" {
}
}
-uchar *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(uchar *p, int X, int Y, int w, int h, int alpha)
{
XImage *image; // Captured image
int i, maxindex; // Looping vars
@@ -858,6 +858,7 @@ uchar *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, int w, i
d = alpha ? 4 : 3;
// 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...
@@ -1157,7 +1158,9 @@ uchar *Fl_X11_Screen_Driver::read_win_rectangle(uchar *p, int X, int Y, int w, i
// Destroy the X image we've read and return the RGB(A) image...
XDestroyImage(image);
- return p;
+ Fl_RGB_Image *rgb = new Fl_RGB_Image(p, w, h, d);
+ if (!oldp) rgb->alloc_array = 1;
+ return rgb;
}
//