Fixed some clipping stack bugs (no range checking).
git-svn-id: file:///fltk/svn/fltk/trunk@17 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f3fc32d284
commit
33ee986a7b
@ -208,8 +208,10 @@ void fl_point(int x, int y) {
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
static Region rstack[10];
|
||||
static int rstackptr;
|
||||
#define STACK_SIZE 10
|
||||
#define STACK_MAX (STACK_SIZE - 1)
|
||||
static Region rstack[STACK_SIZE];
|
||||
static int rstackptr=0;
|
||||
int fl_clip_state_number=0; // used by gl_begin.C to update GL clip
|
||||
|
||||
#ifndef WIN32
|
||||
@ -267,20 +269,22 @@ void fl_clip(int x, int y, int w, int h) {
|
||||
r = CreateRectRgn(0,0,0,0);
|
||||
#endif
|
||||
}
|
||||
rstack[++rstackptr] = r;
|
||||
if (rstackptr < STACK_MAX) rstack[++rstackptr] = r;
|
||||
fl_restore_clip();
|
||||
}
|
||||
|
||||
// make there be no clip (used by fl_begin_offscreen() only!)
|
||||
void fl_push_no_clip() {
|
||||
rstack[++rstackptr] = 0;
|
||||
if (rstackptr < STACK_MAX) rstack[++rstackptr] = 0;
|
||||
fl_restore_clip();
|
||||
}
|
||||
|
||||
// pop back to previous clip:
|
||||
void fl_pop_clip() {
|
||||
Region oldr = rstack[rstackptr--];
|
||||
if (oldr) XDestroyRegion(oldr);
|
||||
if (rstackptr > 0) {
|
||||
Region oldr = rstack[rstackptr--];
|
||||
if (oldr) XDestroyRegion(oldr);
|
||||
}
|
||||
fl_restore_clip();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user