summaryrefslogtreecommitdiff
path: root/src/Fl_Gl_Window.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-01-20 22:24:08 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-01-20 22:24:08 +0000
commit9550d745cdcf4a819b4563338385d8626810ecb1 (patch)
treeb2b329b1b979b4e89a17592353a062fe4f63d067 /src/Fl_Gl_Window.cxx
parent7d0cf9299ae22b7ff6e9bfe1db31a44663ae83e7 (diff)
Avoid clipping stack overruns in OpenGL graphics driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11018 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Gl_Window.cxx')
-rw-r--r--src/Fl_Gl_Window.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index e74065ac6..82b38fd14 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -187,6 +187,8 @@ public:
}
void push_clip(int x, int y, int w, int h) {
// TODO: implement OpenGL clipping
+ if (rstackptr < region_stack_max) rstack[++rstackptr] = 0L;
+ else Fl::warning("Fl_OpenGL_Graphics_Driver::push_clip: clip stack overflow!\n");
}
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H) {
// TODO: implement OpenGL clipping
@@ -199,12 +201,20 @@ public:
}
void push_no_clip() {
// TODO: implement OpenGL clipping
+ if (rstackptr < region_stack_max) rstack[++rstackptr] = 0;
+ else Fl::warning("Fl_OpenGL_Graphics_Driver::push_no_clip: clip stack overflow!\n");
+ restore_clip();
}
void pop_clip() {
// TODO: implement OpenGL clipping
+ if (rstackptr > 0) {
+ rstackptr--;
+ } else Fl::warning("Fl_OpenGL_Graphics_Driver::pop_clip: clip stack underflow!\n");
+ restore_clip();
}
void restore_clip() {
// TODO: implement OpenGL clipping
+ fl_clip_state_number++;
}
};