Index: trunk/src/draw.c =================================================================== --- trunk/src/draw.c (revision 764) +++ trunk/src/draw.c (revision 765) @@ -118,6 +118,8 @@ } } +rnd_cardinal_t camv_draw_inhibit = 0; + void camv_expose_main(rnd_hid_t *hid, const rnd_hid_expose_ctx_t *region, rnd_xform_t *xform_caller) { rnd_cardinal_t lid; @@ -124,7 +126,10 @@ rnd_hid_gc_t gc; int clearing = -1, direct = 1, need_flush = 0; rnd_hid_t *save = rnd_render; - + + if (camv_draw_inhibit) + return; + if ((rnd_render != NULL) && (!rnd_render->override_render)) rnd_render = hid; Index: trunk/src/draw.h =================================================================== --- trunk/src/draw.h (revision 764) +++ trunk/src/draw.h (revision 765) @@ -8,4 +8,18 @@ void camv_expose_main(rnd_hid_t *hid, const rnd_hid_expose_ctx_t *region, rnd_xform_t *xform_caller); void camv_expose_preview(rnd_hid_t *hid, rnd_hid_expose_ctx_t *e); +/* Temporarily inhibid drawing if this is non-zero. A function that calls a + lot of other functions that would call camv_draw() a lot in turn may increase + this value before the calls, then decrease it at the end and call camv_draw(). + This makes sure the whole block is redrawn only once at the end. */ +extern rnd_cardinal_t camv_draw_inhibit; + +#define camv_draw_inhibit_inc() camv_draw_inhibit++ +#define camv_draw_inhibit_dec() \ +do { \ + if (camv_draw_inhibit > 0) \ + camv_draw_inhibit--; \ +} while(0) \ + + #endif