X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Frender.c;fp=lib%2Fdevices%2Frender.c;h=01706211bfa59bb96a25d3c418089aaa5eb98758;hb=172b7b06fdb27cba6792711b1d2975f070a5575c;hp=cf6c056f5c1deeaf70e05e17758e88a52ed31251;hpb=8c2ec81f5bf33f6cda0ba5fdfa6a289d14e49315;p=swftools.git diff --git a/lib/devices/render.c b/lib/devices/render.c index cf6c056..0170621 100644 --- a/lib/devices/render.c +++ b/lib/devices/render.c @@ -477,12 +477,13 @@ void newclip(struct _gfxdevice*dev) memset(c->data, 0, sizeof(U32)*i->bitwidth*i->height2); } -void endclip(struct _gfxdevice*dev) +void endclip(struct _gfxdevice*dev, char removelast) { internal_t*i = (internal_t*)dev->internal; - - if(!i->clipbuf) { - fprintf(stderr, "endclip without any active clip buffers"); + + /* test for at least one cliplevel (the one we created ourselves) */ + if(!i->clipbuf || (!i->clipbuf->next && !removelast)) { + fprintf(stderr, "endclip without any active clip buffers\n"); return; } @@ -599,7 +600,7 @@ void render_startclip(struct _gfxdevice*dev, gfxline_t*line) void render_endclip(struct _gfxdevice*dev) { internal_t*i = (internal_t*)dev->internal; - endclip(dev); + endclip(dev, 0); } void render_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color) @@ -884,10 +885,10 @@ void render_endpage(struct _gfxdevice*dev) exit(1); } - endclip(dev); + endclip(dev, 1); while(i->clipbuf) { fprintf(stderr, "Warning: unclosed clip while processing endpage()\n"); - endclip(dev); + endclip(dev, 1); } internal_result_t*ir= (internal_result_t*)rfx_calloc(sizeof(internal_result_t));