diff options
author | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:15:01 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:27:46 +0300 |
commit | d138cbfb47e379edc1ee915a8c6ff65b01f000d6 (patch) | |
tree | f4773ecce897c32eaf75295dd5f6a8e730d471ed /source/blender/draw/intern/draw_manager.c | |
parent | b0c1184875d39abac4a65a5d20e263ea6d841009 (diff) |
Code Quality: Replace for loops with LISTBASE_FOREACH
Note this only changes cases where the variable was declared inside
the for loop. To handle it outside as well is a different challenge.
Differential Revision: https://developer.blender.org/D7320
Diffstat (limited to 'source/blender/draw/intern/draw_manager.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 280e82ef473..1434cac5f97 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -690,8 +690,7 @@ void **DRW_duplidata_get(void *vedata) void *DRW_view_layer_engine_data_get(DrawEngineType *engine_type) { - for (ViewLayerEngineData *sled = DST.draw_ctx.view_layer->drawdata.first; sled; - sled = sled->next) { + LISTBASE_FOREACH (ViewLayerEngineData *, sled, &DST.draw_ctx.view_layer->drawdata) { if (sled->engine_type == engine_type) { return sled->storage; } @@ -922,7 +921,7 @@ void DRW_cache_free_old_batches(Main *bmain) static void drw_engines_init(void) { - for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { + LISTBASE_FOREACH (LinkData *, link, &DST.enabled_engines) { DrawEngineType *engine = link->data; ViewportEngineData *data = drw_viewport_engine_data_ensure(engine); PROFILE_START(stime); @@ -966,7 +965,7 @@ static void drw_engines_world_update(Scene *scene) return; } - for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { + LISTBASE_FOREACH (LinkData *, link, &DST.enabled_engines) { DrawEngineType *engine = link->data; ViewportEngineData *data = drw_viewport_engine_data_ensure(engine); @@ -1032,7 +1031,7 @@ static void drw_engines_cache_finish(void) static void drw_engines_draw_scene(void) { - for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { + LISTBASE_FOREACH (LinkData *, link, &DST.enabled_engines) { DrawEngineType *engine = link->data; ViewportEngineData *data = drw_viewport_engine_data_ensure(engine); PROFILE_START(stime); @@ -1055,7 +1054,7 @@ static void drw_engines_draw_scene(void) static void drw_engines_draw_text(void) { - for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { + LISTBASE_FOREACH (LinkData *, link, &DST.enabled_engines) { DrawEngineType *engine = link->data; ViewportEngineData *data = drw_viewport_engine_data_ensure(engine); PROFILE_START(stime); @@ -1071,7 +1070,7 @@ static void drw_engines_draw_text(void) /* Draw render engine info. */ void DRW_draw_region_engine_info(int xoffset, int yoffset) { - for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { + LISTBASE_FOREACH (LinkData *, link, &DST.enabled_engines) { DrawEngineType *engine = link->data; ViewportEngineData *data = drw_viewport_engine_data_ensure(engine); @@ -1178,7 +1177,7 @@ static void drw_engines_data_validate(void) void **engine_handle_array = BLI_array_alloca(engine_handle_array, enabled_engines + 1); int i = 0; - for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { + LISTBASE_FOREACH (LinkData *, link, &DST.enabled_engines) { DrawEngineType *engine = link->data; engine_handle_array[i++] = engine; } @@ -1245,7 +1244,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx) drw_engines_enable(view_layer, engine_type, gpencil_engine_needed); drw_engines_data_validate(); - for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { + LISTBASE_FOREACH (LinkData *, link, &DST.enabled_engines) { DrawEngineType *draw_engine = link->data; ViewportEngineData *data = drw_viewport_engine_data_ensure(draw_engine); |