diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-14 02:05:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-14 02:05:51 +0400 |
commit | 4f2c83f573472c69f7f72762a34e1158433a06b6 (patch) | |
tree | e5fe9dcd6d151adf2b906603b15ee20fb4ba9067 /source/blender/imbuf/intern/rotate.c | |
parent | e5963aae1de14c4aaf2953b1cb91b4119415c565 (diff) |
style cleanup: imbuf & icons
Diffstat (limited to 'source/blender/imbuf/intern/rotate.c')
-rw-r--r-- | source/blender/imbuf/intern/rotate.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c index 8914d4ee64d..b3fe363a266 100644 --- a/source/blender/imbuf/intern/rotate.c +++ b/source/blender/imbuf/intern/rotate.c @@ -44,7 +44,7 @@ #include "IMB_allocimbuf.h" -void IMB_flipy(struct ImBuf * ibuf) +void IMB_flipy(struct ImBuf *ibuf) { int x, y; @@ -57,47 +57,47 @@ void IMB_flipy(struct ImBuf * ibuf) y = ibuf->y; top = ibuf->rect; - bottom = top + ((y-1) * x); - line= MEM_mallocN(x*sizeof(int), "linebuf"); + bottom = top + ((y - 1) * x); + line = MEM_mallocN(x * sizeof(int), "linebuf"); y >>= 1; - for (;y>0;y--) { - memcpy(line, top, x*sizeof(int)); - memcpy(top, bottom, x*sizeof(int)); - memcpy(bottom, line, x*sizeof(int)); + for (; y > 0; y--) { + memcpy(line, top, x * sizeof(int)); + memcpy(top, bottom, x * sizeof(int)); + memcpy(bottom, line, x * sizeof(int)); bottom -= x; - top+= x; + top += x; } MEM_freeN(line); } if (ibuf->rect_float) { - float *topf=NULL, *bottomf=NULL, *linef=NULL; + float *topf = NULL, *bottomf = NULL, *linef = NULL; x = ibuf->x; y = ibuf->y; - topf= ibuf->rect_float; - bottomf = topf + 4*((y-1) * x); - linef= MEM_mallocN(4*x*sizeof(float), "linebuff"); + topf = ibuf->rect_float; + bottomf = topf + 4 * ((y - 1) * x); + linef = MEM_mallocN(4 * x * sizeof(float), "linebuff"); y >>= 1; - for (;y>0;y--) { - memcpy(linef, topf, 4*x*sizeof(float)); - memcpy(topf, bottomf, 4*x*sizeof(float)); - memcpy(bottomf, linef, 4*x*sizeof(float)); - bottomf -= 4*x; - topf+= 4*x; + for (; y > 0; y--) { + memcpy(linef, topf, 4 * x * sizeof(float)); + memcpy(topf, bottomf, 4 * x * sizeof(float)); + memcpy(bottomf, linef, 4 * x * sizeof(float)); + bottomf -= 4 * x; + topf += 4 * x; } MEM_freeN(linef); } } -void IMB_flipx(struct ImBuf * ibuf) +void IMB_flipx(struct ImBuf *ibuf) { int x, y, xr, xl, yi; float px_f[4]; @@ -108,19 +108,19 @@ void IMB_flipx(struct ImBuf * ibuf) y = ibuf->y; if (ibuf->rect) { - for (yi=y-1;yi>=0;yi--) { - for (xr=x-1, xl=0; xr>=xl; xr--, xl++) { - SWAP(unsigned int, ibuf->rect[(x*yi)+xr], ibuf->rect[(x*yi)+xl]); + for (yi = y - 1; yi >= 0; yi--) { + for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) { + SWAP(unsigned int, ibuf->rect[(x * yi) + xr], ibuf->rect[(x * yi) + xl]); } } } if (ibuf->rect_float) { - for (yi=y-1;yi>=0;yi--) { - for (xr=x-1, xl=0; xr>=xl; xr--, xl++) { - memcpy(&px_f, &ibuf->rect_float[((x*yi)+xr)*4], 4*sizeof(float)); - memcpy(&ibuf->rect_float[((x*yi)+xr)*4], &ibuf->rect_float[((x*yi)+xl)*4], 4*sizeof(float)); - memcpy(&ibuf->rect_float[((x*yi)+xl)*4], &px_f, 4*sizeof(float)); + for (yi = y - 1; yi >= 0; yi--) { + for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) { + memcpy(&px_f, &ibuf->rect_float[((x * yi) + xr) * 4], 4 * sizeof(float)); + memcpy(&ibuf->rect_float[((x * yi) + xr) * 4], &ibuf->rect_float[((x * yi) + xl) * 4], 4 * sizeof(float)); + memcpy(&ibuf->rect_float[((x * yi) + xl) * 4], &px_f, 4 * sizeof(float)); } } } |