From 9f60188cd805d10155c79ddb99adb703d6da7ba1 Mon Sep 17 00:00:00 2001 From: YimingWu Date: Tue, 25 May 2021 23:32:04 +0800 Subject: Cleanup: Use ListBase in various places in line art. This clarifies the data structures for storing edges for different calculation stages. Reviewed By: Sebastian Parborg (zeddb) Differential Revision: https://developer.blender.org/D11386 --- .../intern/lineart/lineart_intern.h | 39 ++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h') diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h index 47ca6e45bd5..9ed98b38f07 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h @@ -58,7 +58,7 @@ void *lineart_mem_acquire(struct LineartStaticMemPool *smp, size_t size); void *lineart_mem_acquire_thread(struct LineartStaticMemPool *smp, size_t size); void lineart_mem_destroy(struct LineartStaticMemPool *smp); -void lineart_prepend_edge_direct(struct LineartEdge **first, void *node); +void lineart_prepend_edge_direct(void **list_head, void *node); void lineart_prepend_pool(LinkNode **first, struct LineartStaticMemPool *smp, void *link); void lineart_matrix_ortho_44d(double (*mProjection)[4], @@ -76,29 +76,42 @@ int lineart_count_intersection_segment_count(struct LineartRenderBuffer *rb); void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb); #define LRT_ITER_ALL_LINES_BEGIN \ - LineartEdge *e, *next_e, **current_list; \ - e = rb->contours; \ - for (current_list = &rb->contours; e; e = next_e) { \ + LineartEdge *e, *next_e; \ + void **current_head; \ + e = rb->contour.first; \ + if (!e) { \ + e = rb->crease.first; \ + } \ + if (!e) { \ + e = rb->material.first; \ + } \ + if (!e) { \ + e = rb->edge_mark.first; \ + } \ + if (!e) { \ + e = rb->intersection.first; \ + } \ + for (current_head = &rb->contour.first; e; e = next_e) { \ next_e = e->next; #define LRT_ITER_ALL_LINES_NEXT \ while (!next_e) { \ - if (current_list == &rb->contours) { \ - current_list = &rb->crease_lines; \ + if (current_head == &rb->contour.first) { \ + current_head = &rb->crease.first; \ } \ - else if (current_list == &rb->crease_lines) { \ - current_list = &rb->material_lines; \ + else if (current_head == &rb->crease.first) { \ + current_head = &rb->material.first; \ } \ - else if (current_list == &rb->material_lines) { \ - current_list = &rb->edge_marks; \ + else if (current_head == &rb->material.first) { \ + current_head = &rb->edge_mark.first; \ } \ - else if (current_list == &rb->edge_marks) { \ - current_list = &rb->intersection_lines; \ + else if (current_head == &rb->edge_mark.first) { \ + current_head = &rb->intersection.first; \ } \ else { \ break; \ } \ - next_e = *current_list; \ + next_e = *current_head; \ } #define LRT_ITER_ALL_LINES_END \ -- cgit v1.2.3