summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 90c4639)
raw | patch | inline | side by side (parent: 90c4639)
author | johncoswell <johncoswell@users.sourceforge.net> | |
Wed, 6 Sep 2006 12:31:16 +0000 (12:31 +0000) | ||
committer | johncoswell <johncoswell@users.sourceforge.net> | |
Wed, 6 Sep 2006 12:31:16 +0000 (12:31 +0000) |
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 032d7febb7375f75f29cc257806bd02033e483ff..0b0aad79e563890d2fcea8120b8a992e920f0593 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
NR::Rect const r = Inkscape::snap_rectangular_box(desktop, ac->item, pt, ac->center, state);
- sp_canvas_force_full_redraws(desktop->canvas, 1);
-
sp_arc_position_set(SP_ARC(ac->item),
r.midpoint()[NR::X], r.midpoint()[NR::Y],
r.dimensions()[NR::X] / 2, r.dimensions()[NR::Y] / 2);
_("Create ellipse"));
ac->item = NULL;
-
- sp_canvas_clear_forced_full_redraws(desktop->canvas);
}
}
index 6cb3990ddd498f875b3485b2c4c3fe6654cec69a..1f89e8bae5e51469ff25a0f61554325492ad7b8f 100644 (file)
canvas->redraw_count = 0;
- canvas->forced_full_redraw_count = 0;
+ canvas->forced_redraw_count = 0;
+ canvas->forced_redraw_limit = 0;
canvas->slowest_buffer = 0;
}
// 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,
// and only if we're allowed to interrupt this redraw
- if (multiple_buffers && this_buffer > 25000 && !canvas->forced_full_redraw_count) {
+ bool ok_to_interrupt = (multiple_buffers && this_buffer > 25000);
+ if (ok_to_interrupt && canvas->forced_redraw_limit) {
+ ok_to_interrupt = (canvas->forced_redraw_count < canvas->forced_redraw_limit);
+ }
+ if (ok_to_interrupt) {
// 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
// not redraw themselves
// if so, force update and abort
if (canvas->need_redraw || canvas->need_update) {
canvas->slowest_buffer = slowest_buffer;
+ if (canvas->forced_redraw_limit) {
+ canvas->forced_redraw_count++;
+ }
do_update (canvas);
return;
}
}
}
- // 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;
+
+ // we've had a full redraw, reset the full redraw counter
+ if (canvas->forced_redraw_limit) {
+ canvas->forced_redraw_count = 0;
+ }
}
/**
- * 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.
+ * Force a full redraw after a specified number of interrupted redraws
*/
void
-sp_canvas_force_full_redraws(SPCanvas *canvas, unsigned int count) {
- canvas->forced_full_redraw_count += count;
+sp_canvas_force_full_redraw_after_interruptions(SPCanvas *canvas, unsigned int count) {
+ canvas->forced_redraw_limit = count;
+ canvas->forced_redraw_count = 0;
}
/**
- * Flush all forced full redraw requests.
- * Used when accurate representation of the drawing canvas is no
- * longer needed.
+ * End forced full redraw requests
*/
void
-sp_canvas_clear_forced_full_redraws(SPCanvas *canvas) {
- canvas->forced_full_redraw_count = 0;
+sp_canvas_end_forced_full_redraws(SPCanvas *canvas) {
+ canvas->forced_redraw_limit = 0;
}
/**
index f9f4330fc4f48194261292020cebfc98c14a6131..ebc9845f38feea4fff8b96cc284b243cbfe93936 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;
+ unsigned int forced_redraw_count;
+ unsigned int forced_redraw_limit;
/* For use by internal pick_current_item() function */
unsigned int left_grabbed_item : 1;
@@ -189,8 +190,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_force_full_redraw_after_interruptions(SPCanvas *canvas, unsigned int count);
+void sp_canvas_end_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);
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 12de70eda760e5b856dcefd627f0171d09b518bc..257071a42ae2b455caeb75e766512e2a91d57893 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
SPCurve *curve = create_curve(np);
- sp_canvas_force_full_redraws(np->desktop->canvas, 2);
-
sp_shape_set_curve(SP_SHAPE(np->path), curve, TRUE);
sp_curve_unref(curve);
@@ -485,7 +483,7 @@ void sp_nodepath_update_repr(Inkscape::NodePath::Path *np, const gchar *annotati
g_return_if_fail(np != NULL);
update_repr_internal(np);
- sp_canvas_clear_forced_full_redraws(np->desktop->canvas);
+ //sp_canvas_end_forced_full_redraws(np->desktop->canvas);
sp_document_done(sp_desktop_document(np->desktop), SP_VERB_CONTEXT_NODE,
annotation);
}
n->is_dragging = true;
+ //sp_canvas_force_full_redraw_after_interruptions(n->subpath->nodepath->desktop->canvas, 5);
sp_nodepath_remember_origins (n->subpath->nodepath);
}
n->dragging_out = NULL;
n->is_dragging = false;
+ sp_canvas_end_forced_full_redraws(n->subpath->nodepath->desktop->canvas);
sp_nodepath_update_repr(n->subpath->nodepath, _("Move nodes"));
}
g_assert_not_reached();
}
+ //sp_canvas_force_full_redraw_after_interruptions(n->subpath->nodepath->desktop->canvas, 5);
}
/**
}
sp_nodepath_update_repr(n->subpath->nodepath, _("Move node handle"));
+ //sp_canvas_end_forced_full_redraws(n->subpath->nodepath->desktop->canvas);
}
/**
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index adfc5eb7aa061ec27418968ed6ae774b91d20baa..96140a06cd2b7c2cd0f3d4ed181d742c826fcafb 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
pc->_message_context->clear();
pc->_message_context->flash(Inkscape::NORMAL_MESSAGE, _("Drawing cancelled"));
- sp_canvas_clear_forced_full_redraws(pc->desktop->canvas);
+ //sp_canvas_clear_forced_full_redraws(pc->desktop->canvas);
}
/**
@@ -1036,7 +1036,7 @@ spdc_pen_set_subsequent_point(SPPenContext *const pc, NR::Point const p, bool st
g_assert( pc->npoints != 0 );
/* todo: Check callers to see whether 2 <= npoints is guaranteed. */
- sp_canvas_force_full_redraws(pc->desktop->canvas, 4);
+ //sp_canvas_force_full_redraws(pc->desktop->canvas, 4);
pc->p[2] = p;
pc->p[3] = p;
pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
}
- sp_canvas_clear_forced_full_redraws(desktop->canvas);
+ //sp_canvas_clear_forced_full_redraws(desktop->canvas);
pen_enable_events(pc);
}
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index b337b53a1f5bd5e3e819f4c5cb2d677bdfee5883..b03cdeead7c08dc5aee4bd0a3be52900a8587bfc 100644 (file)
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
NR::Rect const r = Inkscape::snap_rectangular_box(desktop, rc.item, pt, rc.center, state);
- sp_canvas_force_full_redraws(desktop->canvas, 2);
-
sp_rect_position_set(SP_RECT(rc.item), r.min()[NR::X], r.min()[NR::Y], r.dimensions()[NR::X], r.dimensions()[NR::Y]);
if ( rc.rx != 0.0 ) {
sp_rect_set_rx (SP_RECT(rc.item), TRUE, rc.rx);
_("Create rectangle"));
rc->item = NULL;
-
- sp_canvas_clear_forced_full_redraws(dt->canvas);
}
}
diff --git a/src/rubberband.cpp b/src/rubberband.cpp
index 49fb34592bd935cf5d283e01b2c594dfa233ed03..cc0e70a7444c564dc72cacd8e58f3288b33ead26 100644 (file)
--- a/src/rubberband.cpp
+++ b/src/rubberband.cpp
void Inkscape::Rubberband::stop()
{
- sp_canvas_clear_forced_full_redraws(_desktop->canvas);
-
if (_canvas) {
gtk_object_destroy((GtkObject *) _canvas);
_canvas = NULL;
_desktop->scroll_to_point(&p);
_end = p;
- sp_canvas_force_full_redraws(_desktop->canvas, 2);
-
_canvas->setRectangle(NR::Rect(_start, _end));
}
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index e878154ba47dc493328aa8f14c64e87081ae4aad..1dc6bd6cbbd9064e8a89ef8b2cc35a075477452c 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
arg = sp_round(arg, M_PI/snaps);
}
- sp_canvas_force_full_redraws(desktop->canvas, 1);
-
/* Fixme: these parameters should be got from dialog box */
sp_spiral_position_set(spiral, p0[NR::X], p0[NR::Y],
/*expansion*/ sc->exp,
/* TODO: annotate */ "spiral-context.cpp:462");
sc->item = NULL;
-
- sp_canvas_clear_forced_full_redraws(desktop->canvas);
}
}
diff --git a/src/star-context.cpp b/src/star-context.cpp
index fc1d710528ed07b5df78ee3a3b58428f0eb3eb25..74b252860ee13c083eec82d085e8abb5f9573f9b 100644 (file)
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
arg1 = sp_round(arg1, M_PI / snaps);
}
- sp_canvas_force_full_redraws(desktop->canvas, 1);
-
sp_star_position_set(star, sc->magnitude, p0, r1, r1 * sc->proportion,
arg1, arg1 + M_PI / sides, sc->isflatsided, sc->rounded, sc->randomized);
/* TODO: annotate */ "star-context.cpp:474");
sc->item = NULL;
-
- sp_canvas_clear_forced_full_redraws(desktop->canvas);
}
}