Mac OS: slightly simpler code for Fl_Image_Surface class.

The new code does not call fl_begin_offscreen() in set_current().
That is safer because there is not always a matching fl_end_offscreen().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10864 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2015-09-23 05:16:57 +00:00
parent 2dd9d06818
commit 2af2d88dce

View File

@ -41,6 +41,7 @@ Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) {
#ifdef __APPLE__
helper = new Fl_Quartz_Flipped_Surface_(width, height);
driver(helper->driver());
CGContextSaveGState(offscreen);
#elif defined(WIN32)
helper = new Fl_GDI_Surface_();
driver(helper->driver());
@ -73,7 +74,7 @@ Fl_RGB_Image* Fl_Image_Surface::image()
#ifdef __APPLE__
CGContextFlush(offscreen);
data = fl_read_image(NULL, 0, 0, width, height, 0);
fl_end_offscreen();
fl_gc = 0;
#elif defined(WIN32)
fl_pop_clip();
data = fl_read_image(NULL, 0, 0, width, height, 0);
@ -108,10 +109,8 @@ void Fl_Image_Surface::draw(Fl_Widget *widget, int delta_x, int delta_y)
void Fl_Image_Surface::set_current()
{
#if defined(__APPLE__)
fl_begin_offscreen(offscreen);
fl_pop_clip();
Fl_Surface_Device::set_current();
fl_push_no_clip();
fl_gc = offscreen; fl_window = 0;
Fl_Surface_Device::set_current();
#elif defined(WIN32)
_sgc=fl_gc;
_sw=fl_window;