diff options
| author | Manolo Gouy <Manolo> | 2016-11-30 07:09:48 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-11-30 07:09:48 +0000 |
| commit | 5bb4e853c7c80fa16e568f47c49c2282d197a19c (patch) | |
| tree | ac17b71e7b3f34e688af8aa85d355f940a8a5438 /src/drivers/Xlib | |
| parent | 4755ace9e9252c7cac6e29143fd0662ae62c2bf4 (diff) | |
Remove Fl_Image_Surface::end_current() to be called after usage of the drawing surface.
This ensures API compatibility with FLTK 1.3 where Fl_Surface_Device->set_current()
is used to change the current drawing surface.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12125 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Xlib')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx | 3 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx | 8 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx index e4b1f7979..c439ddf94 100644 --- a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx @@ -57,6 +57,7 @@ Fl_Xlib_Copy_Surface_Driver::Fl_Xlib_Copy_Surface_Driver(int w, int h) : Fl_Copy _ss = NULL; Fl_Surface_Device *present_surface = Fl_Surface_Device::surface(); Fl_Surface_Device::set_current(); + fl_push_no_clip(); fl_window = xid; driver()->color(FL_WHITE); driver()->rectf(0, 0, w, h); @@ -81,7 +82,6 @@ void Fl_Xlib_Copy_Surface_Driver::set_current() { fl_window = xid; if (!_ss) _ss = Fl_Surface_Device::surface(); Fl_Surface_Device::set_current(); - fl_push_no_clip(); } diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx index 543e2ba7f..7ecb5471e 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx @@ -714,9 +714,10 @@ void Fl_Xlib_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, in depth |= FL_IMAGE_WITH_ALPHA; } if (surface) { + Fl_Surface_Device *old_surf = Fl_Surface_Device::surface(); surface->set_current(); fl_draw_image(img->array, 0, 0, img->w(), img->h(), depth, img->ld()); - surface->end_current(); + old_surf->set_current(); *Fl_Graphics_Driver::id(img) = surface->get_offscreen_before_delete(); delete surface; } diff --git a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx index 0c8303bf9..022a94066 100644 --- a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx @@ -27,6 +27,7 @@ class Fl_Xlib_Image_Surface_Driver : public Fl_Image_Surface_Driver { friend class Fl_Image_Surface; + virtual void end_current_(); public: Fl_Surface_Device *previous; Window pre_window; @@ -37,7 +38,6 @@ public: void translate(int x, int y); void untranslate(); Fl_RGB_Image *image(); - void end_current(); }; Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off) @@ -62,8 +62,8 @@ Fl_Xlib_Image_Surface_Driver::~Fl_Xlib_Image_Surface_Driver() { void Fl_Xlib_Image_Surface_Driver::set_current() { pre_window = fl_window; if (!previous) previous = Fl_Surface_Device::surface(); - fl_window = offscreen; Fl_Surface_Device::set_current(); + fl_window = offscreen; fl_push_no_clip(); } @@ -78,16 +78,14 @@ void Fl_Xlib_Image_Surface_Driver::untranslate() { Fl_RGB_Image* Fl_Xlib_Image_Surface_Driver::image() { unsigned char *data = fl_read_image(NULL, 0, 0, width, height, 0); - end_current(); Fl_RGB_Image *image = new Fl_RGB_Image(data, width, height); image->alloc_array = 1; return image; } -void Fl_Xlib_Image_Surface_Driver::end_current() +void Fl_Xlib_Image_Surface_Driver::end_current_() { fl_pop_clip(); - previous->Fl_Surface_Device::set_current(); fl_window = pre_window; } |
