summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7c42940)
raw | patch | inline | side by side (parent: 7c42940)
author | johncoswell <johncoswell@users.sourceforge.net> | |
Mon, 4 Sep 2006 15:43:24 +0000 (15:43 +0000) | ||
committer | johncoswell <johncoswell@users.sourceforge.net> | |
Mon, 4 Sep 2006 15:43:24 +0000 (15:43 +0000) |
src/display/sp-canvas.cpp | patch | blob | history | |
src/display/sp-canvas.h | patch | blob | history |
index 91712e633a4d59b29addf8cbd0d94c22fbc82d1c..6cb3990ddd498f875b3485b2c4c3fe6654cec69a 100644 (file)
canvas->redraw_aborted.y1 = -NR_HUGE_L;
canvas->redraw_count = 0;
+
+ canvas->forced_full_redraw_count = 0;
canvas->slowest_buffer = 0;
}
// INTERRUPTIBLE DISPLAY:
// Process events that may have arrived while we were busy drawing;
- // only if we're drawing multiple buffers, and only if this one was not very fast
- if (multiple_buffers && this_buffer > 25000) {
+ // 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
+ if (multiple_buffers && this_buffer > 25000 && !canvas->forced_full_redraw_count) {
// Run at most max_iterations of the main loop; we cannot process ALL events
// here because some things (e.g. rubberband) flood with dirtying events but will
}
}
+ // We've finished a redraw; decrement the full redraw counter
+ if (canvas->forced_full_redraw_count > 0) {
+ canvas->forced_full_redraw_count--;
+ }
+
// Remember the slowest buffer of this paint in canvas
canvas->slowest_buffer = slowest_buffer;
}
+/**
+ * Force the next several screen redraws to not be interruptible.
+ * Used when having an accurate representation of the drawing canvas
+ * is more important than speed.
+ *
+ * In the future, this should be a toggle switch to be enabled/disabled
+ * when precise object drawing is necessary.
+ */
+void
+sp_canvas_force_full_redraws(SPCanvas *canvas, unsigned int count) {
+ canvas->forced_full_redraw_count += count;
+}
+
+/**
+ * Flush all forced full redraw requests.
+ * Used when accurate representation of the drawing canvas is no
+ * longer needed.
+ */
+void
+sp_canvas_clear_forced_full_redraws(SPCanvas *canvas) {
+ canvas->forced_full_redraw_count = 0;
+}
+
/**
* The canvas widget's expose callback.
*/
index 1375cf272fa63a7b7b731655c5a3a78a5136b9d1..f9f4330fc4f48194261292020cebfc98c14a6131 100644 (file)
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
long redraw_count;
glong slowest_buffer;
+ unsigned int forced_full_redraw_count;
+
/* For use by internal pick_current_item() function */
unsigned int left_grabbed_item : 1;
/* For use by internal pick_current_item() function */
@@ -187,6 +189,8 @@ void sp_canvas_scroll_to(SPCanvas *canvas, double cx, double cy, unsigned int cl
void sp_canvas_update_now(SPCanvas *canvas);
void sp_canvas_request_redraw(SPCanvas *canvas, int x1, int y1, int x2, int y2);
+void sp_canvas_force_full_redraws(SPCanvas *canvas, unsigned int count);
+void sp_canvas_clear_forced_full_redraws(SPCanvas *canvas);
void sp_canvas_window_to_world(SPCanvas const *canvas, double winx, double winy, double *worldx, double *worldy);
void sp_canvas_world_to_window(SPCanvas const *canvas, double worldx, double worldy, double *winx, double *winy);