Code

extend the semantics of sp_canvas_force_full_redraw_after_interruptions to allow...
authorbuliabyak <buliabyak@users.sourceforge.net>
Thu, 26 Oct 2006 06:55:45 +0000 (06:55 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Thu, 26 Oct 2006 06:55:45 +0000 (06:55 +0000)
src/display/sp-canvas.cpp
src/display/sp-canvas.h

index 6bd88613240b22fc6ab08be4ba64e8e08cbda1b1..f258d5370525d3c377a0b042c521d17cb3fc67fe 100644 (file)
@@ -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;
 }
 
 /**
index ebc9845f38feea4fff8b96cc284b243cbfe93936..39a7ae1f82e15093a401ceb3ae19c5e13fd70633 100644 (file)
@@ -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;