mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
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:
@@ -187,6 +187,8 @@ public:
|
|||||||
}
|
}
|
||||||
void push_clip(int x, int y, int w, int h) {
|
void push_clip(int x, int y, int w, int h) {
|
||||||
// TODO: implement OpenGL clipping
|
// 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) {
|
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H) {
|
||||||
// TODO: implement OpenGL clipping
|
// TODO: implement OpenGL clipping
|
||||||
@@ -199,12 +201,20 @@ public:
|
|||||||
}
|
}
|
||||||
void push_no_clip() {
|
void push_no_clip() {
|
||||||
// TODO: implement OpenGL clipping
|
// 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() {
|
void pop_clip() {
|
||||||
// TODO: implement OpenGL clipping
|
// 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() {
|
void restore_clip() {
|
||||||
// TODO: implement OpenGL clipping
|
// TODO: implement OpenGL clipping
|
||||||
|
fl_clip_state_number++;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -45,9 +45,9 @@
|
|||||||
// This is defined in src/fl_line_style.cxx
|
// This is defined in src/fl_line_style.cxx
|
||||||
extern int fl_line_width_;
|
extern int fl_line_width_;
|
||||||
|
|
||||||
|
|
||||||
void Fl_Graphics_Driver::restore_clip() {
|
void Fl_Graphics_Driver::restore_clip() {
|
||||||
fl_clip_state_number++;
|
fl_clip_state_number++;
|
||||||
Fl_Region r = rstack[rstackptr];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Graphics_Driver::clip_region(Fl_Region r) {
|
void Fl_Graphics_Driver::clip_region(Fl_Region r) {
|
||||||
|
|||||||
Reference in New Issue
Block a user