Richard Penman wrote:
> hello,
> 
> I am useing clipping with FLTK 1.1.7 on Debian but occassionally it stalls 
> for a few seconds and I get these messages on the console:
> 
> fl_push_clip: clip stack overflow!
> fl_pop_clip: clip stack underflow!
> 
> What is going on? I only have one clipping region on the stack.

        When I've seen that, I usually had a bug in my draw() code
        where either:

                1) I was either recursively calling draw() too many times
                2) The logic of my draw() function was skipping an fl_pop_clip()
                   (causing the overflow).

        The 'stall for a few seconds' sounds like something in your program
        is going wrong, and I would try to identify that by running your app
        in a debugger, and hitting 'break' when the stall is happening,
        so you can inspect what's causing that.

        The clip buffer is implemented as a stack which I think is
        defined to a depth of 10 in fl_rect.cxx:

#define STACK_SIZE 10
#define STACK_MAX (STACK_SIZE - 1)
static Fl_Region rstack[STACK_SIZE];
[..]
void fl_push_clip(int x, int y, int w, int h) {
[..]
  if (rstackptr < STACK_MAX) rstack[++rstackptr] = r;
  else Fl::warning("fl_push_clip: clip stack overflow!\n");

        10 is certainly a small value, but it shouldn't really
        get all that large, and you definitely don't want it
        too large, since all drawing operations have to be masked
        through it.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to