summaryrefslogtreecommitdiff
path: root/src/Fl_Image_Surface.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-12-07 15:09:52 +0000
committerManolo Gouy <Manolo>2016-12-07 15:09:52 +0000
commit43935dffeb7cb54a97b2a8a610c2e453743c0da9 (patch)
tree9f132039b9cf120263bf03965c152ac17853969c /src/Fl_Image_Surface.cxx
parent0a1eed150a9d9215f70f1e50db2ec555199aee7d (diff)
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
Diffstat (limited to 'src/Fl_Image_Surface.cxx')
-rw-r--r--src/Fl_Image_Surface.cxx14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx
index 0dd2f6ff7..c925931ac 100644
--- a/src/Fl_Image_Surface.cxx
+++ b/src/Fl_Image_Surface.cxx
@@ -146,21 +146,13 @@ void fl_delete_offscreen(Fl_Offscreen ctx) {
}
}
-static Fl_Surface_Device* stack_surface[16];
-static unsigned stack_height = 0;
-
/** Send all subsequent drawing commands to this offscreen buffer.
\param ctx the offscreen buffer.
*/
void fl_begin_offscreen(Fl_Offscreen ctx) {
for (int i = 0; i < count_offscreens; i++) {
if (offscreen_api_surface[i] && offscreen_api_surface[i]->offscreen() == ctx) {
- if (stack_height < sizeof(stack_surface)/sizeof(void*)) {
- stack_surface[stack_height++] = Fl_Surface_Device::surface();
- } else {
- fprintf(stderr, "FLTK fl_begin_offscreen Stack overflow error\n");
- }
- offscreen_api_surface[i]->set_current();
+ Fl_Surface_Device::push_current(offscreen_api_surface[i]);
return;
}
}
@@ -169,9 +161,7 @@ void fl_begin_offscreen(Fl_Offscreen ctx) {
/** Quit sending drawing commands to the current offscreen buffer.
*/
void fl_end_offscreen() {
- if (stack_height > 0) {
- stack_surface[--stack_height]->set_current();
- }
+ Fl_Surface_Device::pop_current();
}
/** @} */