diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-12 09:57:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-12 10:13:34 +0300 |
commit | 4ab47a767067a88cfc82ae2e2214178b90e0f544 (patch) | |
tree | 6082569575478f91345a21a9b0b17878909fef7e /source/blender/editors/sculpt_paint/paint_image_proj.c | |
parent | 5893a3445e8227689c2f10b958a79f5f6ec18d20 (diff) |
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.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 8 |
1 files changed, 4 insertions, 4 deletions
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 */ |