From 5bb4e853c7c80fa16e568f47c49c2282d197a19c Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 30 Nov 2016 07:09:48 +0000 Subject: 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 --- src/Fl_Image_Surface.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/Fl_Image_Surface.cxx') diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index d26a53600..0dd2f6ff7 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -55,9 +55,6 @@ void Fl_Image_Surface::set_current() { if (platform_surface) platform_surface->set_current(); } -/** Stop sending graphics commands to the surface */ -void Fl_Image_Surface::end_current() {platform_surface->end_current();} - void Fl_Image_Surface::translate(int x, int y) { if (platform_surface) platform_surface->translate(x, y); } @@ -149,7 +146,7 @@ void fl_delete_offscreen(Fl_Offscreen ctx) { } } -static int stack_current_offscreen[16]; +static Fl_Surface_Device* stack_surface[16]; static unsigned stack_height = 0; /** Send all subsequent drawing commands to this offscreen buffer. @@ -158,12 +155,12 @@ static unsigned stack_height = 0; 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) { - offscreen_api_surface[i]->set_current(); - if (stack_height < sizeof(stack_current_offscreen)/sizeof(int)) { - stack_current_offscreen[stack_height++] = i; + 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(); return; } } @@ -173,8 +170,7 @@ void fl_begin_offscreen(Fl_Offscreen ctx) { */ void fl_end_offscreen() { if (stack_height > 0) { - int i = stack_current_offscreen[--stack_height]; - offscreen_api_surface[i]->end_current(); + stack_surface[--stack_height]->set_current(); } } -- cgit v1.2.3