diff options
author | David Robillard <d@drobilla.net> | 2013-12-18 19:13:04 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-12-18 19:13:04 +0000 |
commit | 5b34aff56759854ee18dbd901264ee445a232703 (patch) | |
tree | b8f76c26b0deb0064df35fc75461e639eabc9179 /src | |
parent | b3bc9a7a3688aeac53d75befae2a6552d8bc5846 (diff) | |
download | ganv-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')
-rw-r--r-- | src/Canvas.cpp | 10 | ||||
-rw-r--r-- | src/canvas-base.c | 24 |
2 files changed, 19 insertions, 15 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp index 5d4eb55..cbe8263 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -797,16 +797,8 @@ GanvCanvasImpl::layout_iteration() // Update position const Vector dpos = vec_mult(node->impl->vel, dur); - if (fabs(dpos.x) > 1.0 || fabs(dpos.y) > 1.0) { - GanvItem* item = GANV_ITEM(node); + if (fabs(dpos.x) >= 1.0 || fabs(dpos.y) >= 1.0) { ganv_item_move(GANV_ITEM(node), dpos.x, dpos.y); - static const float min_coord = 4.0; - if (item->x < min_coord) { - item->x = min_coord; - } - if (item->y < min_coord) { - item->y = min_coord; - } } } 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 */ |