From 4ab47a767067a88cfc82ae2e2214178b90e0f544 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 12 Jun 2015 16:57:15 +1000 Subject: BLI_linklist, avoid full list search for append For areas that require append, store the last node, Previous behavior would too easily hide poorly performing code. Also avoid (prepend, reverse) where possible. --- source/blender/editors/sculpt_paint/paint_image_proj.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 46e294de956..6d2f3d5587d 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -3768,7 +3768,7 @@ static void project_paint_prepare_all_faces( const bool is_multi_view) { /* Image Vars - keep track of images we have used */ - LinkNode *image_LinkList = NULL; + LinkNodePair image_LinkList = {NULL, NULL}; Image *tpage_last = NULL, *tpage; TexPaintSlot *slot_last = NULL; @@ -3843,7 +3843,7 @@ static void project_paint_prepare_all_faces( if (tpage_last != tpage) { - image_index = BLI_linklist_index(image_LinkList, tpage); + image_index = BLI_linklist_index(image_LinkList.list, tpage); if (image_index == -1 && BKE_image_has_ibuf(tpage, NULL)) { /* MemArena dosnt have an append func */ BLI_linklist_append(&image_LinkList, tpage); @@ -3864,11 +3864,11 @@ static void project_paint_prepare_all_faces( /* build an array of images we use*/ if (ps->is_shared_user == false) { - project_paint_build_proj_ima(ps, arena, image_LinkList); + project_paint_build_proj_ima(ps, arena, image_LinkList.list); } /* we have built the array, discard the linked list */ - BLI_linklist_free(image_LinkList, NULL); + BLI_linklist_free(image_LinkList.list, NULL); } /* run once per stroke before projection painting */ -- cgit v1.2.3