Add static void Fl_Surface_Device::push_current(Fl_Surface_Device *new_current) and pop_current() to set/unset the current drawing surface.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12140 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2016-12-07 15:09:52 +00:00
parent 0a1eed150a
commit 43935dffeb
13 changed files with 72 additions and 73 deletions
+2 -3
View File
@@ -76,8 +76,7 @@ Fl_RGB_Image* prepare_shape(int w)
{
// draw a white circle with a hole in it on black background
Fl_Image_Surface *surf = new Fl_Image_Surface(w, w);
Fl_Surface_Device* current = Fl_Surface_Device::surface();
surf->set_current();
Fl_Surface_Device::push_current(surf);
fl_color(FL_BLACK);
fl_rectf(-1, -1, w+2, w+2);
fl_color(FL_WHITE);
@@ -86,7 +85,7 @@ Fl_RGB_Image* prepare_shape(int w)
fl_pie(0.7*w,w/2,w/4,w/4,0,360);
Fl_RGB_Image* img = surf->image();
delete surf;
current->set_current();
Fl_Surface_Device::pop_current();
return img; // return white image on black background
}