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
This commit is contained in:
Matthias Melcher
2016-01-20 22:24:08 +00:00
parent 7d0cf9299a
commit 9550d745cd
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -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++;
}
};
+1 -1
View File
@@ -45,9 +45,9 @@
// This is defined in src/fl_line_style.cxx
extern int fl_line_width_;
void Fl_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
Fl_Region r = rstack[rstackptr];
}
void Fl_Graphics_Driver::clip_region(Fl_Region r) {