summaryrefslogtreecommitdiffstats
path: root/src/group.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-01-03 22:34:38 +0000
committerDavid Robillard <d@drobilla.net>2014-01-03 22:34:38 +0000
commitcac7e4e5e5b4ad8331ba75649dcc84ead3f4a5b4 (patch)
tree15eb2331de2c941f6106269bb83e35b331413104 /src/group.c
parent3517286a9404d556c384276d63b73b588fadbcfe (diff)
downloadganv-cac7e4e5e5b4ad8331ba75649dcc84ead3f4a5b4.tar.gz
ganv-cac7e4e5e5b4ad8331ba75649dcc84ead3f4a5b4.tar.bz2
ganv-cac7e4e5e5b4ad8331ba75649dcc84ead3f4a5b4.zip
Improve performance by avoiding unnecessary i2w conversions.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5249 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/group.c')
-rw-r--r--src/group.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/group.c b/src/group.c
index 75183ca..2a05e5e 100644
--- a/src/group.c
+++ b/src/group.c
@@ -293,6 +293,19 @@ ganv_group_point(GanvItem* item, double x, double y, int cx, int cy,
}
}
+/** Get bounds of child item in group-relative coordinates. */
+static void
+get_child_bounds(GanvItem* child, double* x1, double* y1, double* x2, double* y2)
+{
+ ganv_item_get_bounds(child, x1, y1, x2, y2);
+
+ // Make bounds relative to the item's parent coordinate system
+ *x1 -= child->x;
+ *y1 -= child->y;
+ *x2 -= child->x;
+ *y2 -= child->y;
+}
+
static void
ganv_group_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* y2)
{
@@ -316,7 +329,7 @@ ganv_group_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* y2
if (child->object.flags & GANV_ITEM_VISIBLE) {
set = TRUE;
- ganv_item_get_bounds(child, &minx, &miny, &maxx, &maxy);
+ get_child_bounds(child, &minx, &miny, &maxx, &maxy);
break;
}
}
@@ -339,7 +352,7 @@ ganv_group_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* y2
continue;
}
- ganv_item_get_bounds(child, &tx1, &ty1, &tx2, &ty2);
+ get_child_bounds(child, &tx1, &ty1, &tx2, &ty2);
if (tx1 < minx) {
minx = tx1;