From e7a0f7c5d02e26b05160b06e4e35d6f66aab5ac6 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 5 Mar 2016 07:04:20 +0000 Subject: Complete the platform-neutral implementation of fl_XXX_offscreen() functions. It is necessary to have a stack of the fl_begin_offscreen() calls, so that nested such calls apply fl_end_offscreen() to the matching fl_begin_offscreen(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11289 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- .../Quartz/Fl_Quartz_Graphics_Driver_image.cxx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx') diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx index 668bb434f..0e1f777f1 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #define MAXBUFFER 0x40000 // 256k @@ -273,25 +272,13 @@ fl_uintptr_t Fl_Quartz_Graphics_Driver::cache(Fl_Bitmap*, int w, int h, const uc } fl_uintptr_t Fl_Quartz_Graphics_Driver::cache(Fl_Pixmap *img, int w, int h, const char *const*data) { - Fl_Image_Surface *surface = new Fl_Image_Surface(w,h); - surface->set_current(); + Fl_Offscreen id = fl_create_offscreen(w, h); + fl_begin_offscreen(id); fl_draw_pixmap(data, 0, 0, FL_BLACK); - surface->end_current(); - Fl_Offscreen id = surface->get_offscreen_before_delete(); - delete surface; + fl_end_offscreen(); return (fl_uintptr_t)id; } -void Fl_Quartz_Graphics_Driver::uncache(Fl_Pixmap *img) -{ - if (img->id_) { - void *data = CGBitmapContextGetData((CGContextRef)img->id_); - free(data); - CGContextRelease((CGContextRef)img->id_); - img->id_ = NULL; - } -} - void Fl_Quartz_Graphics_Driver::draw_CGImage(CGImageRef cgimg, int x, int y, int w, int h, int srcx, int srcy, int sw, int sh) { CGRect rect = CGRectMake(x, y, w, h); -- cgit v1.2.3