Make member function Fl_Image_Surface::get_offscreen_before_delete() be private.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12904 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
ccae86b291
commit
41eb376060
@ -33,6 +33,7 @@
|
||||
|
||||
class Fl_Graphics_Driver;
|
||||
class Fl_Font_Descriptor;
|
||||
class Fl_Image_Surface;
|
||||
/** \brief Points to the driver that currently receives all graphics requests */
|
||||
FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver;
|
||||
|
||||
@ -249,6 +250,7 @@ protected:
|
||||
pwidth = &(rgb->cache_w_);
|
||||
pheight = &(rgb->cache_h_);
|
||||
}
|
||||
static Fl_Offscreen get_offscreen_and_delete_image_surface(Fl_Image_Surface*);
|
||||
/** For internal library use only */
|
||||
static void draw_empty(Fl_Image* img, int X, int Y) {img->draw_empty(X, Y);}
|
||||
|
||||
|
@ -69,8 +69,10 @@ class FL_EXPORT Fl_Image_Surface : public Fl_Widget_Surface {
|
||||
friend FL_EXPORT void fl_begin_offscreen(Fl_Offscreen ctx);
|
||||
friend FL_EXPORT void fl_end_offscreen(void);
|
||||
friend FL_EXPORT void fl_delete_offscreen(Fl_Offscreen ctx);
|
||||
friend class Fl_Graphics_Driver;
|
||||
private:
|
||||
class Fl_Image_Surface_Driver *platform_surface;
|
||||
Fl_Offscreen get_offscreen_before_delete_();
|
||||
protected:
|
||||
void translate(int x, int y);
|
||||
void untranslate();
|
||||
@ -83,7 +85,6 @@ public:
|
||||
void origin(int *x, int *y);
|
||||
void origin(int x, int y);
|
||||
int printable_rect(int *w, int *h);
|
||||
Fl_Offscreen get_offscreen_before_delete();
|
||||
Fl_Offscreen offscreen();
|
||||
};
|
||||
|
||||
|
@ -319,6 +319,13 @@ void Fl_Graphics_Driver::draw_rgb(Fl_RGB_Image *img, int XP, int YP, int WP, int
|
||||
}
|
||||
}
|
||||
|
||||
/** Accessor to private member function of Fl_Image_Surface */
|
||||
Fl_Offscreen Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(Fl_Image_Surface* surface) {
|
||||
Fl_Offscreen off = surface->get_offscreen_before_delete_();
|
||||
delete surface;
|
||||
return off;
|
||||
}
|
||||
|
||||
|
||||
#ifndef FL_DOXYGEN
|
||||
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
|
||||
|
@ -111,10 +111,8 @@ Fl_Shared_Image* Fl_Image_Surface::highres_image()
|
||||
return s_img;
|
||||
}
|
||||
|
||||
/** Allows to delete the Fl_Image_Surface object while keeping its underlying Fl_Offscreen.
|
||||
This member function is intended for internal use by the FLTK library.
|
||||
*/
|
||||
Fl_Offscreen Fl_Image_Surface::get_offscreen_before_delete() {
|
||||
// Allows to delete the Fl_Image_Surface object while keeping its underlying Fl_Offscreen
|
||||
Fl_Offscreen Fl_Image_Surface::get_offscreen_before_delete_() {
|
||||
Fl_Offscreen keep = platform_surface->offscreen;
|
||||
platform_surface->offscreen = 0;
|
||||
return keep;
|
||||
|
@ -491,8 +491,7 @@ void Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img)
|
||||
}
|
||||
}
|
||||
Fl_Surface_Device::pop_current();
|
||||
Fl_Offscreen offs = surface->get_offscreen_before_delete();
|
||||
delete surface;
|
||||
Fl_Offscreen offs = Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surface);
|
||||
int *pw, *ph;
|
||||
cache_w_h(img, pw, ph);
|
||||
*pw = img->data_w();
|
||||
@ -707,8 +706,7 @@ void Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) {
|
||||
}
|
||||
*pbitmap = 0;
|
||||
Fl_Surface_Device::pop_current();
|
||||
Fl_Offscreen id = surf->get_offscreen_before_delete();
|
||||
delete surf;
|
||||
Fl_Offscreen id = Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surf);
|
||||
int *pw, *ph;
|
||||
cache_w_h(img, pw, ph);
|
||||
*pw = img->data_w();
|
||||
|
@ -259,9 +259,8 @@ void Fl_Quartz_Graphics_Driver::cache(Fl_Pixmap *img) {
|
||||
Fl_Image_Surface *surf = new Fl_Image_Surface(img->data_w(), img->data_h());
|
||||
Fl_Surface_Device::push_current(surf);
|
||||
fl_draw_pixmap(img->data(), 0, 0, FL_BLACK);
|
||||
CGContextRef src = surf->get_offscreen_before_delete();
|
||||
Fl_Surface_Device::pop_current();
|
||||
delete surf;
|
||||
CGContextRef src = Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surf);
|
||||
void *cgdata = CGBitmapContextGetData(src);
|
||||
int sw = CGBitmapContextGetWidth(src);
|
||||
int sh = CGBitmapContextGetHeight(src);
|
||||
|
@ -712,8 +712,7 @@ void Fl_Xlib_Graphics_Driver::cache(Fl_RGB_Image *img) {
|
||||
Fl_Surface_Device::push_current(surface);
|
||||
fl_draw_image(img->array, 0, 0, img->data_w(), img->data_h(), depth, img->ld());
|
||||
Fl_Surface_Device::pop_current();
|
||||
Fl_Offscreen off = surface->get_offscreen_before_delete();
|
||||
delete surface;
|
||||
Fl_Offscreen off = Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surface);
|
||||
int *pw, *ph;
|
||||
cache_w_h(img, pw, ph);
|
||||
*pw = img->data_w();
|
||||
@ -879,8 +878,7 @@ void Fl_Xlib_Graphics_Driver::cache(Fl_Pixmap *pxm) {
|
||||
}
|
||||
*pbitmap = 0;
|
||||
Fl_Surface_Device::pop_current();
|
||||
Fl_Offscreen id = surf->get_offscreen_before_delete();
|
||||
delete surf;
|
||||
Fl_Offscreen id = Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surf);
|
||||
int *pw, *ph;
|
||||
cache_w_h(pxm, pw, ph);
|
||||
*pw = pxm->data_w();
|
||||
|
Loading…
x
Reference in New Issue
Block a user