summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Image_Surface.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx
index 6de588063..00abc747a 100644
--- a/src/Fl_Image_Surface.cxx
+++ b/src/Fl_Image_Surface.cxx
@@ -41,12 +41,14 @@ Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) {
width = w;
height = h;
#ifdef __APPLE__
- offscreen = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h);
+ offscreen = fl_create_offscreen(w, h);
helper = new Fl_Quartz_Flipped_Surface_(width, height);
driver(helper->driver());
CGContextSaveGState(offscreen);
CGContextTranslateCTM(offscreen, 0, height);
CGContextScaleCTM(offscreen, 1.0f, -1.0f);
+ CGContextSetRGBFillColor(offscreen, 1, 1, 1, 1);
+ CGContextFillRect(offscreen, CGRectMake(0,0,w,h));
#elif defined(WIN32)
offscreen = fl_create_offscreen(w, h);
helper = new Fl_GDI_Surface_();
@@ -93,13 +95,9 @@ Fl_Image_Surface::~Fl_Image_Surface() {
Fl_RGB_Image* Fl_Image_Surface::image()
{
unsigned char *data;
- int depth = 3, ld = 0;
#ifdef __APPLE__
CGContextFlush(offscreen);
- ld = CGBitmapContextGetBytesPerRow(offscreen);
- data = (uchar*)malloc(ld * height);
- memcpy(data, (uchar *)CGBitmapContextGetData(offscreen), ld * height);
- depth = 4;
+ data = fl_read_image(NULL, 0, 0, width, height, 0);
fl_gc = 0;
#elif defined(WIN32)
fl_pop_clip();
@@ -117,7 +115,7 @@ Fl_RGB_Image* Fl_Image_Surface::image()
fl_window = pre_window;
previous->set_current();
#endif
- Fl_RGB_Image *image = new Fl_RGB_Image(data, width, height, depth, ld);
+ Fl_RGB_Image *image = new Fl_RGB_Image(data, width, height);
image->alloc_array = 1;
return image;
}