diff options
| -rw-r--r-- | FL/Fl_Image_Surface.H | 3 | ||||
| -rw-r--r-- | src/Fl_Graphics_Driver.cxx | 1 | ||||
| -rw-r--r-- | src/Fl_Image_Surface.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx | 2 |
6 files changed, 10 insertions, 8 deletions
diff --git a/FL/Fl_Image_Surface.H b/FL/Fl_Image_Surface.H index 01c05a87d..ac8f2d24d 100644 --- a/FL/Fl_Image_Surface.H +++ b/FL/Fl_Image_Surface.H @@ -99,7 +99,8 @@ protected: int width; int height; Fl_Offscreen offscreen; - Fl_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Widget_Surface(NULL), width(w), height(h), offscreen(off) {} + int external_offscreen; + Fl_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off) : Fl_Widget_Surface(NULL), width(w), height(h), offscreen(off) {external_offscreen = (off != 0);} virtual ~Fl_Image_Surface_Driver() {} virtual void set_current() {} virtual void translate(int x, int y) {} diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index 8f9371f17..d65fb306d 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -102,7 +102,6 @@ void Fl_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen uchar *img = fl_read_image(NULL, px, py, pw, ph, 0); if (surface) { Fl_Surface_Device::pop_current(); - surface->get_offscreen_before_delete(); // so deleting surface does not touch pixmap delete surface; } else fl_end_offscreen(); if (img) { diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index 9333d858a..0f77006c2 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -39,11 +39,13 @@ Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, i \p w x \p h expressed in FLTK units. If \p highres is non-zero, always use Fl_Image_Surface::highres_image() to get the image data. - \param pixmap Is used internally by FLTK; applications just use its default value. + \param off If not null, the image surface is constructed around a pre-existing + Fl_Offscreen. The caller is responsible for both construction and destruction of this Fl_Offscreen object. + Is mostly intended for internal use by FLTK. \version 1.3.4 (1.3.3 without the \p highres parameter) */ -Fl_Image_Surface::Fl_Image_Surface(int w, int h, int high_res, Fl_Offscreen pixmap) : Fl_Widget_Surface(NULL) { - platform_surface = Fl_Image_Surface_Driver::newImageSurfaceDriver(w, h, high_res, pixmap); +Fl_Image_Surface::Fl_Image_Surface(int w, int h, int high_res, Fl_Offscreen off) : Fl_Widget_Surface(NULL) { + platform_surface = Fl_Image_Surface_Driver::newImageSurfaceDriver(w, h, high_res, off); if (platform_surface) driver(platform_surface->driver()); } diff --git a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx index ae3725721..9a037084f 100644 --- a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx @@ -60,7 +60,7 @@ Fl_GDI_Image_Surface_Driver::Fl_GDI_Image_Surface_Driver(int w, int h, int high_ Fl_GDI_Image_Surface_Driver::~Fl_GDI_Image_Surface_Driver() { - if (offscreen) DeleteObject(offscreen); + if (offscreen && !external_offscreen) DeleteObject(offscreen); delete driver(); } diff --git a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx index 1910d3f46..4eae3d58f 100644 --- a/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Image_Surface_Driver.cxx @@ -72,7 +72,7 @@ Fl_Quartz_Image_Surface_Driver::Fl_Quartz_Image_Surface_Driver(int w, int h, int } Fl_Quartz_Image_Surface_Driver::~Fl_Quartz_Image_Surface_Driver() { - if (offscreen) { + if (offscreen && !external_offscreen) { void *data = CGBitmapContextGetData(offscreen); free(data); CGContextRelease((CGContextRef)offscreen); diff --git a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx index c974ef2cb..2e6250fc1 100644 --- a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx @@ -53,7 +53,7 @@ Fl_Xlib_Image_Surface_Driver::Fl_Xlib_Image_Surface_Driver(int w, int h, int hig } Fl_Xlib_Image_Surface_Driver::~Fl_Xlib_Image_Surface_Driver() { - if (offscreen) XFreePixmap(fl_display, offscreen); + if (offscreen && !external_offscreen) XFreePixmap(fl_display, offscreen); delete driver(); } |
