From 76298e353df88996de4b423f3090811723b73d37 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 27 Dec 2013 00:38:17 +0000 Subject: Performance improvements. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5214 a436a847-0d15-0410-975c-d299462d15a1 --- src/group.c | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) (limited to 'src/group.c') diff --git a/src/group.c b/src/group.c index 8624a90..75183ca 100644 --- a/src/group.c +++ b/src/group.c @@ -195,19 +195,6 @@ ganv_group_unmap(GanvItem* item) (*group_parent_class->unmap)(item); } -static gint -item_layer_cmp(const void* a, const void* b, void* user_data) -{ - const GanvItem* ia = (const GanvItem*)a; - const GanvItem* ib = (const GanvItem*)b; - if (ia->layer == ib->layer) { - // Same layer, order in a quasi-cascade - return (ia->x1 - ib->x1) + (ia->y1 - ib->y1); - } else { - return ia->layer - ib->layer; - } -} - static void ganv_group_draw(GanvItem* item, cairo_t* cr, int x, int y, int width, int height) @@ -223,7 +210,8 @@ ganv_group_draw(GanvItem* item, cairo_t* cr, cairo_rectangle(cr, x, y, width, height); cairo_fill(cr); - GSequence* items = g_sequence_new(NULL); + // TODO: Layered drawing + for (list = group->item_list; list; list = list->next) { child = (GanvItem*)list->data; @@ -231,27 +219,13 @@ ganv_group_draw(GanvItem* item, cairo_t* cr, && ((child->x1 < (x + width)) && (child->y1 < (y + height)) && (child->x2 > x) - && (child->y2 > y))) - || ((GTK_OBJECT_FLAGS(child) & GANV_ITEM_ALWAYS_REDRAW) - && (child->x1 < child->canvas->redraw_x2) - && (child->y1 < child->canvas->redraw_y2) - && (child->x2 > child->canvas->redraw_x1) - && (child->y2 > child->canvas->redraw_y2))) { + && (child->y2 > y)))) { if (GANV_ITEM_GET_CLASS(child)->draw) { - g_sequence_insert_sorted(items, child, item_layer_cmp, NULL); + (*GANV_ITEM_GET_CLASS(child)->draw)( + child, cr, x, y, width, height); } } } - - for (GSequenceIter* i = g_sequence_get_begin_iter(items); - !g_sequence_iter_is_end(i); - i = g_sequence_iter_next(i)) { - child = (GanvItem*)g_sequence_get(i); - (*GANV_ITEM_GET_CLASS(child)->draw)( - child, cr, x, y, width, height); - } - - g_sequence_free(items); } static double -- cgit v1.2.1