summaryrefslogtreecommitdiffstats
path: root/src/canvas-base.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-18 19:13:04 +0000
committerDavid Robillard <d@drobilla.net>2013-12-18 19:13:04 +0000
commit5b34aff56759854ee18dbd901264ee445a232703 (patch)
treeb8f76c26b0deb0064df35fc75461e639eabc9179 /src/canvas-base.c
parentb3bc9a7a3688aeac53d75befae2a6552d8bc5846 (diff)
downloadganv-5b34aff56759854ee18dbd901264ee445a232703.tar.gz
ganv-5b34aff56759854ee18dbd901264ee445a232703.tar.bz2
ganv-5b34aff56759854ee18dbd901264ee445a232703.zip
Futher FDGL performance improvements.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5180 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/canvas-base.c')
-rw-r--r--src/canvas-base.c24
1 files changed, 18 insertions, 6 deletions
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 */