From: buliabyak Date: Thu, 26 Oct 2006 06:55:45 +0000 (+0000) Subject: extend the semantics of sp_canvas_force_full_redraw_after_interruptions to allow... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c687af9d655ac8da69872455db8ab2cafb4740f1;p=inkscape.git extend the semantics of sp_canvas_force_full_redraw_after_interruptions to allow passing 0 to it, meaning no interruptions at all until the next sp_canvas_end_forced_full_redraws --- diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 6bd886132..f258d5370 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -979,7 +979,7 @@ sp_canvas_init (SPCanvas *canvas) canvas->redraw_count = 0; canvas->forced_redraw_count = 0; - canvas->forced_redraw_limit = 0; + canvas->forced_redraw_limit = -1; canvas->slowest_buffer = 0; } @@ -1664,7 +1664,7 @@ sp_canvas_paint_rect_internal (SPCanvas *canvas, NRRectL *rect, NR::ICoord *x_ab // only if we're drawing multiple buffers, and only if this one was not very fast, // and only if we're allowed to interrupt this redraw bool ok_to_interrupt = (multiple_buffers && this_buffer > 25000); - if (ok_to_interrupt && canvas->forced_redraw_limit) { + if (ok_to_interrupt && (canvas->forced_redraw_limit != -1)) { ok_to_interrupt = (canvas->forced_redraw_count < canvas->forced_redraw_limit); } @@ -1679,6 +1679,9 @@ sp_canvas_paint_rect_internal (SPCanvas *canvas, NRRectL *rect, NR::ICoord *x_ab // If one of the iterations has redrawn by itself, abort if (this_count != canvas->redraw_count) { canvas->slowest_buffer = slowest_buffer; + if (canvas->forced_redraw_limit != -1) { + canvas->forced_redraw_count++; + } return 1; // interrupted } } @@ -1687,7 +1690,7 @@ sp_canvas_paint_rect_internal (SPCanvas *canvas, NRRectL *rect, NR::ICoord *x_ab // if so, force update and abort if (canvas->need_redraw || canvas->need_update) { canvas->slowest_buffer = slowest_buffer; - if (canvas->forced_redraw_limit) { + if (canvas->forced_redraw_limit != -1) { canvas->forced_redraw_count++; } do_update (canvas); @@ -1815,7 +1818,7 @@ sp_canvas_paint_rect (SPCanvas *canvas, int xx0, int yy0, int xx1, int yy1) } // we've had a full unaborted redraw, reset the full redraw counter - if (canvas->forced_redraw_limit) { + if (canvas->forced_redraw_limit != -1) { canvas->forced_redraw_count = 0; } } @@ -1838,7 +1841,7 @@ void sp_canvas_end_forced_full_redraws(SPCanvas *canvas) { g_return_if_fail(canvas != NULL); - canvas->forced_redraw_limit = 0; + canvas->forced_redraw_limit = -1; } /** diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index ebc9845f3..39a7ae1f8 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -161,8 +161,8 @@ struct SPCanvas { long redraw_count; glong slowest_buffer; - unsigned int forced_redraw_count; - unsigned int forced_redraw_limit; + int forced_redraw_count; + int forced_redraw_limit; /* For use by internal pick_current_item() function */ unsigned int left_grabbed_item : 1;