From 5b34aff56759854ee18dbd901264ee445a232703 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 18 Dec 2013 19:13:04 +0000 Subject: Futher FDGL performance improvements. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5180 a436a847-0d15-0410-975c-d299462d15a1 --- src/canvas-base.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/canvas-base.c') diff --git a/src/canvas-base.c b/src/canvas-base.c index a56da8e..b437581 100644 --- a/src/canvas-base.c +++ b/src/canvas-base.c @@ -427,11 +427,25 @@ ganv_item_move(GanvItem* item, double dx, double dy) g_return_if_fail(item != NULL); g_return_if_fail(GANV_IS_ITEM(item)); + const double old_x = item->x; + const double old_y = item->y; + item->x += dx; item->y += dy; - ganv_item_request_update(item); - item->canvas->need_repick = TRUE; + static const double MIN_COORD = 4.0; + if (item->x < MIN_COORD) { + item->x = MIN_COORD; + } + if (item->y < MIN_COORD) { + item->y = MIN_COORD; + } + + if (lrint(old_x) != lrint(item->x) || + lrint(old_y) != lrint(item->y)) { + ganv_item_request_update(item); + item->canvas->need_repick = TRUE; + } } /** @@ -750,13 +764,11 @@ ganv_item_get_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* void ganv_item_request_update(GanvItem* item) { - /* FIXME: For some reason, if this short-circuit is enabled, the canvas - stops updating items entirely when connected modules are removed. */ - /* + /* Note: At some point, if this short-circuit was enabled, the canvas stopped + updating items entirely when connected modules are removed. */ if (item->object.flags & GANV_ITEM_NEED_UPDATE) { return; } - */ if (!item->canvas) { /* Item is being / has been destroyed, ignore */ -- cgit v1.2.1