diff options
| author | Manolo Gouy <Manolo> | 2017-04-24 09:23:33 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-04-24 09:23:33 +0000 |
| commit | d91b3d80e560a698f394e12e777f58e5bfaf2a8b (patch) | |
| tree | 1b82b542def90f3b009b8e88888eeae0e67b4efe /src | |
| parent | da31ffd9528d61a4e02d61719bb1d657f36aff9a (diff) | |
Allow the use of Fl_Image_Surface::image() also when the Fl_Image_Surface object is not the current drawing surface.
This fixes an issue uncovered in a thread of fltk.general entitled
fl_pop_clip: clip stack underflow! warning on X11
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12222 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Image_Surface.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index 632bc3de0..b8b50a2bc 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -77,7 +77,13 @@ int Fl_Image_Surface::printable_rect(int *w, int *h) {return platform_surface-> The returned object contains its own copy of the RGB data. The caller is responsible for deleting the image. */ -Fl_RGB_Image *Fl_Image_Surface::image() {return platform_surface->image();} +Fl_RGB_Image *Fl_Image_Surface::image() { + bool need_push = (Fl_Surface_Device::surface() != this); + if (need_push) Fl_Surface_Device::push_current(this); + Fl_RGB_Image *img = platform_surface->image(); + if (need_push) Fl_Surface_Device::pop_current(); + return img; +} /** Returns a possibly high resolution image made of all drawings sent to the Fl_Image_Surface object. The Fl_Image_Surface object should have been constructed with Fl_Image_Surface(W, H, 1). |
