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/allocimbuf.c | |
parent | e5963aae1de14c4aaf2953b1cb91b4119415c565 (diff) |
style cleanup: imbuf & icons
Diffstat (limited to 'source/blender/imbuf/intern/allocimbuf.c')
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 2cfdd7bc324..319e3f27bd8 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -51,39 +51,39 @@ void imb_freemipmapImBuf(ImBuf *ibuf) { int a; - for (a=1; a<ibuf->miptot; a++) { - if (ibuf->mipmap[a-1]) - IMB_freeImBuf(ibuf->mipmap[a-1]); - ibuf->mipmap[a-1]= NULL; + for (a = 1; a < ibuf->miptot; a++) { + if (ibuf->mipmap[a - 1]) + IMB_freeImBuf(ibuf->mipmap[a - 1]); + ibuf->mipmap[a - 1] = NULL; } - ibuf->miptot= 0; + ibuf->miptot = 0; } /* any free rect frees mipmaps to be sure, creation is in render on first request */ void imb_freerectfloatImBuf(ImBuf *ibuf) { - if (ibuf==NULL) return; + if (ibuf == NULL) return; if (ibuf->rect_float && (ibuf->mall & IB_rectfloat)) { MEM_freeN(ibuf->rect_float); - ibuf->rect_float=NULL; + ibuf->rect_float = NULL; } imb_freemipmapImBuf(ibuf); - ibuf->rect_float= NULL; + ibuf->rect_float = NULL; ibuf->mall &= ~IB_rectfloat; } /* any free rect frees mipmaps to be sure, creation is in render on first request */ void imb_freerectImBuf(ImBuf *ibuf) { - if (ibuf==NULL) return; + if (ibuf == NULL) return; if (ibuf->rect && (ibuf->mall & IB_rect)) MEM_freeN(ibuf->rect); - ibuf->rect= NULL; + ibuf->rect = NULL; imb_freemipmapImBuf(ibuf); @@ -94,14 +94,14 @@ void imb_freetilesImBuf(ImBuf *ibuf) { int tx, ty; - if (ibuf==NULL) return; + if (ibuf == NULL) return; if (ibuf->tiles && (ibuf->mall & IB_tiles)) { - for (ty=0; ty<ibuf->ytiles; ty++) { - for (tx=0; tx<ibuf->xtiles; tx++) { - if (ibuf->tiles[ibuf->xtiles*ty + tx]) { + for (ty = 0; ty < ibuf->ytiles; ty++) { + for (tx = 0; tx < ibuf->xtiles; tx++) { + if (ibuf->tiles[ibuf->xtiles * ty + tx]) { imb_tile_cache_tile_free(ibuf, tx, ty); - MEM_freeN(ibuf->tiles[ibuf->xtiles*ty + tx]); + MEM_freeN(ibuf->tiles[ibuf->xtiles * ty + tx]); } } } @@ -109,13 +109,13 @@ void imb_freetilesImBuf(ImBuf *ibuf) MEM_freeN(ibuf->tiles); } - ibuf->tiles= NULL; + ibuf->tiles = NULL; ibuf->mall &= ~IB_tiles; } static void freeencodedbufferImBuf(ImBuf *ibuf) { - if (ibuf==NULL) return; + if (ibuf == NULL) return; if (ibuf->encodedbuffer && (ibuf->mall & IB_mem)) MEM_freeN(ibuf->encodedbuffer); @@ -128,23 +128,23 @@ static void freeencodedbufferImBuf(ImBuf *ibuf) void IMB_freezbufImBuf(ImBuf *ibuf) { - if (ibuf==NULL) return; + if (ibuf == NULL) return; if (ibuf->zbuf && (ibuf->mall & IB_zbuf)) MEM_freeN(ibuf->zbuf); - ibuf->zbuf= NULL; + ibuf->zbuf = NULL; ibuf->mall &= ~IB_zbuf; } void IMB_freezbuffloatImBuf(ImBuf *ibuf) { - if (ibuf==NULL) return; + if (ibuf == NULL) return; if (ibuf->zbuf_float && (ibuf->mall & IB_zbuffloat)) MEM_freeN(ibuf->zbuf_float); - ibuf->zbuf_float= NULL; + ibuf->zbuf_float = NULL; ibuf->mall &= ~IB_zbuffloat; } @@ -172,9 +172,9 @@ void IMB_refImBuf(ImBuf *ibuf) ibuf->refcounter++; } -ImBuf * IMB_makeSingleUser(ImBuf *ibuf) +ImBuf *IMB_makeSingleUser(ImBuf *ibuf) { - ImBuf * rval; + ImBuf *rval; if (!ibuf || ibuf->refcounter == 0) { return ibuf; } @@ -189,11 +189,11 @@ short addzbufImBuf(ImBuf *ibuf) { int size; - if (ibuf==NULL) return FALSE; + if (ibuf == NULL) return FALSE; IMB_freezbufImBuf(ibuf); - size = ibuf->x *ibuf->y *sizeof(unsigned int); + size = ibuf->x * ibuf->y * sizeof(unsigned int); if ((ibuf->zbuf = MEM_mapallocN(size, "addzbufImBuf"))) { ibuf->mall |= IB_zbuf; ibuf->flags |= IB_zbuf; @@ -207,11 +207,11 @@ short addzbuffloatImBuf(ImBuf *ibuf) { int size; - if (ibuf==NULL) return FALSE; + if (ibuf == NULL) return FALSE; IMB_freezbuffloatImBuf(ibuf); - size = ibuf->x *ibuf->y *sizeof(float); + size = ibuf->x * ibuf->y * sizeof(float); if ((ibuf->zbuf_float = MEM_mapallocN(size, "addzbuffloatImBuf"))) { ibuf->mall |= IB_zbuffloat; ibuf->flags |= IB_zbuffloat; @@ -224,7 +224,7 @@ short addzbuffloatImBuf(ImBuf *ibuf) short imb_addencodedbufferImBuf(ImBuf *ibuf) { - if (ibuf==NULL) return FALSE; + if (ibuf == NULL) return FALSE; freeencodedbufferImBuf(ibuf); @@ -248,14 +248,14 @@ short imb_enlargeencodedbufferImBuf(ImBuf *ibuf) unsigned int newsize, encodedsize; void *newbuffer; - if (ibuf==NULL) return FALSE; + if (ibuf == NULL) return FALSE; if (ibuf->encodedbuffersize < ibuf->encodedsize) { printf("imb_enlargeencodedbufferImBuf: error in parameters\n"); return FALSE; } - newsize = 2 *ibuf->encodedbuffersize; + newsize = 2 * ibuf->encodedbuffersize; if (newsize < 10000) newsize = 10000; newbuffer = MEM_mallocN(newsize, "enlargeencodedbufferImBuf"); @@ -285,14 +285,14 @@ short imb_addrectfloatImBuf(ImBuf *ibuf) { int size; - if (ibuf==NULL) return FALSE; + if (ibuf == NULL) return FALSE; if (ibuf->rect_float) - imb_freerectfloatImBuf(ibuf); /* frees mipmap too, hrm */ + imb_freerectfloatImBuf(ibuf); /* frees mipmap too, hrm */ - size = ibuf->x *ibuf->y; - size = size *4 *sizeof(float); - ibuf->channels= 4; + size = ibuf->x * ibuf->y; + size = size * 4 * sizeof(float); + ibuf->channels = 4; if ((ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf"))) { ibuf->mall |= IB_rectfloat; @@ -308,15 +308,15 @@ short imb_addrectImBuf(ImBuf *ibuf) { int size; - if (ibuf==NULL) return FALSE; + if (ibuf == NULL) return FALSE; /* don't call imb_freerectImBuf, it frees mipmaps, this call is used only too give float buffers display */ if (ibuf->rect && (ibuf->mall & IB_rect)) MEM_freeN(ibuf->rect); - ibuf->rect= NULL; + ibuf->rect = NULL; - size = ibuf->x*ibuf->y; - size = size*sizeof(unsigned int); + size = ibuf->x * ibuf->y; + size = size * sizeof(unsigned int); if ((ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf"))) { ibuf->mall |= IB_rect; @@ -330,10 +330,10 @@ short imb_addrectImBuf(ImBuf *ibuf) short imb_addtilesImBuf(ImBuf *ibuf) { - if (ibuf==NULL) return FALSE; + if (ibuf == NULL) return FALSE; if (!ibuf->tiles) - if ((ibuf->tiles = MEM_callocN(sizeof(unsigned int*)*ibuf->xtiles*ibuf->ytiles, "imb_tiles"))) + if ((ibuf->tiles = MEM_callocN(sizeof(unsigned int *) * ibuf->xtiles * ibuf->ytiles, "imb_tiles"))) ibuf->mall |= IB_tiles; return (ibuf->tiles != NULL); @@ -346,36 +346,36 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int ibuf = MEM_callocN(sizeof(ImBuf), "ImBuf_struct"); if (ibuf) { - ibuf->x= x; - ibuf->y= y; - ibuf->planes= planes; - ibuf->ftype= TGA; - ibuf->channels= 4; /* float option, is set to other values when buffers get assigned */ - ibuf->ppm[0]= ibuf->ppm[1]= 150.0 / 0.0254; /* 150dpi -> pixels-per-meter */ + ibuf->x = x; + ibuf->y = y; + ibuf->planes = planes; + ibuf->ftype = TGA; + ibuf->channels = 4; /* float option, is set to other values when buffers get assigned */ + ibuf->ppm[0] = ibuf->ppm[1] = 150.0 / 0.0254; /* 150dpi -> pixels-per-meter */ if (flags & IB_rect) { - if (imb_addrectImBuf(ibuf)==FALSE) { + if (imb_addrectImBuf(ibuf) == FALSE) { IMB_freeImBuf(ibuf); return NULL; } } if (flags & IB_rectfloat) { - if (imb_addrectfloatImBuf(ibuf)==FALSE) { + if (imb_addrectfloatImBuf(ibuf) == FALSE) { IMB_freeImBuf(ibuf); return NULL; } } if (flags & IB_zbuf) { - if (addzbufImBuf(ibuf)==FALSE) { + if (addzbufImBuf(ibuf) == FALSE) { IMB_freeImBuf(ibuf); return NULL; } } if (flags & IB_zbuffloat) { - if (addzbuffloatImBuf(ibuf)==FALSE) { + if (addzbuffloatImBuf(ibuf) == FALSE) { IMB_freeImBuf(ibuf); return NULL; } @@ -404,10 +404,10 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1) if (ibuf2 == NULL) return NULL; if (flags & IB_rect) - memcpy(ibuf2->rect, ibuf1->rect, x *y *sizeof(int)); + memcpy(ibuf2->rect, ibuf1->rect, x * y * sizeof(int)); if (flags & IB_rectfloat) - memcpy(ibuf2->rect_float, ibuf1->rect_float, ibuf1->channels *x *y *sizeof(float)); + memcpy(ibuf2->rect_float, ibuf1->rect_float, ibuf1->channels * x * y * sizeof(float)); if (ibuf1->encodedbuffer) { ibuf2->encodedbuffersize = ibuf1->encodedbuffersize; @@ -423,16 +423,16 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1) tbuf = *ibuf1; // fix pointers - tbuf.rect = ibuf2->rect; - tbuf.rect_float = ibuf2->rect_float; + tbuf.rect = ibuf2->rect; + tbuf.rect_float = ibuf2->rect_float; tbuf.encodedbuffer = ibuf2->encodedbuffer; - tbuf.zbuf= NULL; - tbuf.zbuf_float= NULL; - for (a=0; a<IB_MIPMAP_LEVELS; a++) - tbuf.mipmap[a]= NULL; + tbuf.zbuf = NULL; + tbuf.zbuf_float = NULL; + for (a = 0; a < IB_MIPMAP_LEVELS; a++) + tbuf.mipmap[a] = NULL; // set malloc flag - tbuf.mall = ibuf2->mall; + tbuf.mall = ibuf2->mall; tbuf.c_handle = NULL; tbuf.refcounter = 0; @@ -449,7 +449,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1) static void imbuf_cache_destructor(void *data) { - ImBuf *ibuf = (ImBuf*) data; + ImBuf *ibuf = (ImBuf *) data; imb_freerectImBuf(ibuf); imb_freerectfloatImBuf(ibuf); |