From b134434224254d4ac3fc73d023f2f6d914746690 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Aug 2020 22:36:11 +1000 Subject: Cleanup: declare arrays arrays where possible --- source/blender/draw/engines/gpencil/gpencil_antialiasing.c | 2 +- source/blender/draw/engines/gpencil/gpencil_cache_utils.c | 2 +- source/blender/draw/engines/gpencil/gpencil_engine.c | 6 +++--- source/blender/draw/engines/gpencil/gpencil_render.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/draw/engines/gpencil') diff --git a/source/blender/draw/engines/gpencil/gpencil_antialiasing.c b/source/blender/draw/engines/gpencil/gpencil_antialiasing.c index 8955240c549..b9600ad8caf 100644 --- a/source/blender/draw/engines/gpencil/gpencil_antialiasing.c +++ b/source/blender/draw/engines/gpencil/gpencil_antialiasing.c @@ -36,7 +36,7 @@ void GPENCIL_antialiasing_init(struct GPENCIL_Data *vedata) const float *size = DRW_viewport_size_get(); const float *sizeinv = DRW_viewport_invert_size_get(); - float metrics[4] = {sizeinv[0], sizeinv[1], size[0], size[1]}; + const float metrics[4] = {sizeinv[0], sizeinv[1], size[0], size[1]}; if (pd->simplify_antialias) { /* No AA fallback. */ diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c index 41a7196cb90..363794e1be3 100644 --- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c @@ -245,7 +245,7 @@ static void gpencil_layer_random_color_get(const Object *ob, uint ob_hash = BLI_ghashutil_strhash_p_murmur(ob->id.name); uint gpl_hash = BLI_ghashutil_strhash_p_murmur(gpl->info); float hue = BLI_hash_int_01(ob_hash * gpl_hash); - float hsv[3] = {hue, hsv_saturation, hsv_value}; + const float hsv[3] = {hue, hsv_saturation, hsv_value}; hsv_to_rgb_v(hsv, r_color); } diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index dbad226099e..746920e38c6 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -71,7 +71,7 @@ void GPENCIL_engine_init(void *ved) } if (txl->dummy_texture == NULL) { - float pixels[1][4] = {{1.0f, 0.0f, 1.0f, 1.0f}}; + const float pixels[1][4] = {{1.0f, 0.0f, 1.0f, 1.0f}}; txl->dummy_texture = DRW_texture_create_2d(1, 1, GPU_RGBA8, DRW_TEX_WRAP, (float *)pixels); } @@ -766,7 +766,7 @@ static void gpencil_draw_mask(GPENCIL_Data *vedata, GPENCIL_tObject *ob, GPENCIL { GPENCIL_PassList *psl = vedata->psl; GPENCIL_FramebufferList *fbl = vedata->fbl; - float clear_col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + const float clear_col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; float clear_depth = ob->is_drawmode3d ? 1.0f : 0.0f; bool inverted = false; /* OPTI(fclem) we could optimize by only clearing if the new mask_bits does not contain all @@ -813,7 +813,7 @@ static void GPENCIL_draw_object(GPENCIL_Data *vedata, GPENCIL_tObject *ob) GPENCIL_PassList *psl = vedata->psl; GPENCIL_PrivateData *pd = vedata->stl->pd; GPENCIL_FramebufferList *fbl = vedata->fbl; - float clear_cols[2][4] = {{0.0f, 0.0f, 0.0f, 0.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}; + const float clear_cols[2][4] = {{0.0f, 0.0f, 0.0f, 0.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}; DRW_stats_group_start("GPencil Object"); diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c b/source/blender/draw/engines/gpencil/gpencil_render.c index c3294f88acf..df52b65aa78 100644 --- a/source/blender/draw/engines/gpencil/gpencil_render.c +++ b/source/blender/draw/engines/gpencil/gpencil_render.c @@ -129,7 +129,7 @@ void GPENCIL_render_init(GPENCIL_Data *vedata, /* To avoid unpredictable result, clear buffers that have not be initialized. */ GPU_framebuffer_bind(fbl->render_fb); if (do_clear_col) { - float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + const float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; GPU_framebuffer_clear_color(fbl->render_fb, clear_col); } if (do_clear_z) { -- cgit v1.2.3