diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-23 03:45:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-23 09:40:10 +0300 |
commit | bc8504cb4c93eb3aac22222f62966c13560a2bf6 (patch) | |
tree | 1e3bcf5bf5a02a9722ef049dfc506f5b4c06d72e | |
parent | 676d790d29ead413a9619aa94005c5248d274cb2 (diff) |
Cleanup: shadowing (blenlib, gpu, imbuf)
-rw-r--r-- | source/blender/blenlib/intern/noise.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/targa.c | 28 |
3 files changed, 25 insertions, 17 deletions
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 4b2ad834d75..c3a0c44d7c5 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -452,7 +452,7 @@ float BLI_turbulence1(float noisesize, float x, float y, float z, int nr) /* ********************* FROM PERLIN HIMSELF: ******************** */ -static const char p[512 + 2] = { +static const char g_perlin_data_ub[512 + 2] = { 0xA2, 0xA0, 0x19, 0x3B, 0xF8, 0xEB, 0xAA, 0xEE, 0xF3, 0x1C, 0x67, 0x28, 0x1D, 0xED, 0x0, 0xDE, 0x95, 0x2E, 0xDC, 0x3F, 0x3A, 0x82, 0x35, 0x4D, 0x6C, 0xBA, 0x36, 0xD0, 0xF6, 0xC, 0x79, 0x32, 0xD1, 0x59, 0xF4, 0x8, @@ -499,7 +499,7 @@ static const char p[512 + 2] = { }; -static const float g[512 + 2][3] = { +static const float g_perlin_data_v3[512 + 2][3] = { {0.33783, 0.715698, -0.611206}, {-0.944031, -0.326599, -0.045624}, {-0.101074, -0.416443, -0.903503}, @@ -1028,6 +1028,8 @@ static const float g[512 + 2][3] = { static float noise3_perlin(float vec[3]) { + const char *p = g_perlin_data_ub; + const float (*g)[3] = g_perlin_data_v3; int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11; float rx0, rx1, ry0, ry1, rz0, rz1, sx, sy, sz, a, b, c, d, t, u, v; const float *q; diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index bf7b8fbc386..3ad396a532c 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1029,14 +1029,14 @@ static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, /* float rectangles are already continuous in memory so we can use IMB_scaleImBuf */ if (frect) { - ImBuf *ibuf = IMB_allocFromBuffer(NULL, frect, w, h); - IMB_scaleImBuf(ibuf, rectw, recth); + ImBuf *ibuf_scale = IMB_allocFromBuffer(NULL, frect, w, h); + IMB_scaleImBuf(ibuf_scale, rectw, recth); glBindTexture(GL_TEXTURE_2D, ima->bindcode); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, rectw, recth, GL_RGBA, - GL_FLOAT, ibuf->rect_float); + GL_FLOAT, ibuf_scale->rect_float); - IMB_freeImBuf(ibuf); + IMB_freeImBuf(ibuf_scale); } /* byte images are not continuous in memory so do manual interpolation */ else { diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 7073d34e2bc..0949a431293 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -554,9 +554,10 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char { TARGA tga; struct ImBuf *ibuf; - int col, count, size; - unsigned int *rect, *cmap = NULL /*, mincol = 0*/, maxcol = 0; - uchar *cp = (uchar *) &col; + int count, size; + unsigned int *rect, *cmap = NULL /*, mincol = 0*/, cmap_max = 0; + int32_t cp_data; + uchar *cp = (uchar *) &cp_data; if (checktarga(&tga, mem) == 0) { return NULL; @@ -579,10 +580,10 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char if (tga.mapsize) { /* load color map */ /*mincol = tga.maporig;*/ /*UNUSED*/ - maxcol = tga.mapsize; - cmap = MEM_callocN(sizeof(unsigned int) * maxcol, "targa cmap"); + cmap_max = tga.mapsize; + cmap = MEM_callocN(sizeof(unsigned int) * cmap_max, "targa cmap"); - for (count = 0; count < maxcol; count++) { + for (count = 0; count < cmap_max; count++) { switch (tga.mapbits >> 3) { case 4: cp[0] = mem[3]; @@ -603,14 +604,16 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char mem += 2; break; case 1: - col = *mem++; + cp_data = *mem++; break; } - cmap[count] = col; + cmap[count] = cp_data; } size = 0; - for (col = maxcol - 1; col > 0; col >>= 1) size++; + for (int cmap_index = cmap_max - 1; cmap_index > 0; cmap_index >>= 1) { + size++; + } ibuf->planes = size; if (tga.mapbits != 32) { /* set alpha bits */ @@ -655,14 +658,17 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char /* apply color map */ rect = ibuf->rect; for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect) { - col = *rect; - if (col >= 0 && col < maxcol) *rect = cmap[col]; + int cmap_index = *rect; + if (cmap_index >= 0 && cmap_index < cmap_max) { + *rect = cmap[cmap_index]; + } } MEM_freeN(cmap); } if (tga.pixsize == 16) { + unsigned int col; rect = ibuf->rect; for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect) { col = *rect; |