diff options
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/dds/BlockDXT.cpp | 28 | ||||
-rw-r--r-- | source/blender/imbuf/intern/dds/ColorBlock.cpp | 50 | ||||
-rw-r--r-- | source/blender/imbuf/intern/dds/DirectDrawSurface.cpp | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/dds/dds_api.cpp | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/filter.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/imageprocess.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/iris.c | 46 | ||||
-rw-r--r-- | source/blender/imbuf/intern/moviecache.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 114 | ||||
-rw-r--r-- | source/blender/imbuf/intern/targa.c | 14 | ||||
-rw-r--r-- | source/blender/imbuf/intern/thumbs_blend.c | 2 |
12 files changed, 139 insertions, 139 deletions
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 49ba566b6e8..f5e9e536e41 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -90,7 +90,7 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const // c.u |= (c.u >> 6) & 0x000300; // color_array[1].u = c.u; - if( col0.u > col1.u ) { + if ( col0.u > col1.u ) { // Four-color block: derive the other two colors. color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3; color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; @@ -137,7 +137,7 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const int gdiff = color_array[1].g - color_array[0].g; - if( col0.u > col1.u ) { + if ( col0.u > col1.u ) { // Four-color block: derive the other two colors. color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8; color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256; @@ -227,8 +227,8 @@ void BlockDXT1::decodeBlock(ColorBlock * block) const evaluatePalette(color_array); // Write color block. - for( uint j = 0; j < 4; j++ ) { - for( uint i = 0; i < 4; i++ ) { + for ( uint j = 0; j < 4; j++ ) { + for ( uint i = 0; i < 4; i++ ) { uint idx = (row[j] >> (2 * i)) & 3; block->color(i, j) = color_array[idx]; } @@ -242,8 +242,8 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const evaluatePaletteNV5x(color_array); // Write color block. - for( uint j = 0; j < 4; j++ ) { - for( uint i = 0; i < 4; i++ ) { + for ( uint j = 0; j < 4; j++ ) { + for ( uint i = 0; i < 4; i++ ) { uint idx = (row[j] >> (2 * i)) & 3; block->color(i, j) = color_array[idx]; } @@ -253,7 +253,7 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const void BlockDXT1::setIndices(int * idx) { indices = 0; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { indices |= (idx[i] & 3) << (2 * i); } } @@ -423,7 +423,7 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock * block) const uint8 index_array[16]; indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { block->color(i).a = alpha_array[index_array[i]]; } } @@ -496,7 +496,7 @@ void BlockATI1::decodeBlock(ColorBlock * block) const uint8 index_array[16]; alpha.indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.b = c.g = c.r = alpha_array[index_array[i]]; c.a = 255; @@ -525,7 +525,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const x.evaluatePalette(alpha_array); x.indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.r = alpha_array[index_array[i]]; } @@ -533,7 +533,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const y.evaluatePalette(alpha_array); y.indices(index_array); - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.g = alpha_array[index_array[i]]; c.b = 0; @@ -587,8 +587,8 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const evaluatePalette(color_array); // Write color block. - for( uint j = 0; j < 4; j++ ) { - for( uint i = 0; i < 4; i++ ) { + for ( uint j = 0; j < 4; j++ ) { + for ( uint i = 0; i < 4; i++ ) { uint idx = (row[j] >> (2 * i)) & 3; block->color(i, j) = color_array[idx]; } @@ -598,7 +598,7 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const void BlockCTX1::setIndices(int * idx) { indices = 0; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { indices |= (idx[i] & 3) << (2 * i); } } diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index 0b4a7cabf92..42ef799cf3e 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -59,7 +59,7 @@ ColorBlock::ColorBlock() /// Init the color block from an array of colors. ColorBlock::ColorBlock(const uint * linearImage) { - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { color(i) = Color32(linearImage[i]); } } @@ -67,7 +67,7 @@ ColorBlock::ColorBlock(const uint * linearImage) /// Init the color block with the contents of the given block. ColorBlock::ColorBlock(const ColorBlock & block) { - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { color(i) = block.color(i); } } @@ -181,7 +181,7 @@ bool ColorBlock::isSingleColorNoAlpha() const { Color32 c; int i; - for(i = 0; i < 16; i++) + for (i = 0; i < 16; i++) { if (m_color[i].a != 0) c = m_color[i]; } @@ -189,7 +189,7 @@ bool ColorBlock::isSingleColorNoAlpha() const Color32 mask(0xFF, 0xFF, 0xFF, 0x00); uint u = c.u & mask.u; - for(; i < 16; i++) + for (; i < 16; i++) { if (u != (m_color[i].u & mask.u)) { @@ -207,16 +207,16 @@ bool ColorBlock::isSingleColorNoAlpha() const uint count = 0; // @@ This does not have to be o(n^2) - for(int i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { bool unique = true; - for(int j = 0; j < i; j++) { - if( m_color[i] != m_color[j] ) { + for (int j = 0; j < i; j++) { + if ( m_color[i] != m_color[j] ) { unique = false; } } - if( unique ) { + if ( unique ) { count++; } } @@ -230,7 +230,7 @@ Color32 ColorBlock::averageColor() const uint r, g, b, a; r = g = b = a = 0; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { r += m_color[i].r; g += m_color[i].g; b += m_color[i].b; @@ -258,10 +258,10 @@ void ColorBlock::diameterRange(Color32 * start, Color32 * end) const Color32 c0, c1; uint best_dist = 0; - for(int i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { for (int j = i+1; j < 16; j++) { uint dist = colorDistance(m_color[i], m_color[j]); - if( dist > best_dist ) { + if ( dist > best_dist ) { best_dist = dist; c0 = m_color[i]; c1 = m_color[j]; @@ -281,7 +281,7 @@ void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const maxLuminance = minLuminance = colorLuminance(m_color[0]); - for(uint i = 1; i < 16; i++) + for (uint i = 1; i < 16; i++) { uint luminance = colorLuminance(m_color[i]); @@ -305,7 +305,7 @@ void ColorBlock::boundsRange(Color32 * start, Color32 * end) const Color32 minColor(255, 255, 255); Color32 maxColor(0, 0, 0); - for(uint i = 0; i < 16; i++) + for (uint i = 0; i < 16; i++) { if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; } if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; } @@ -339,7 +339,7 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const Color32 minColor(255, 255, 255, 255); Color32 maxColor(0, 0, 0, 0); - for(uint i = 0; i < 16; i++) + for (uint i = 0; i < 16; i++) { if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; } if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; } @@ -377,14 +377,14 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const void ColorBlock::sortColorsByAbsoluteValue() { // Dummy selection sort. - for( uint a = 0; a < 16; a++ ) { + for ( uint a = 0; a < 16; a++ ) { uint max = a; Color16 cmax(m_color[a]); - for( uint b = a+1; b < 16; b++ ) { + for ( uint b = a+1; b < 16; b++ ) { Color16 cb(m_color[b]); - if( cb.u > cmax.u ) { + if ( cb.u > cmax.u ) { max = b; cmax = cb; } @@ -404,16 +404,16 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end) float min, max; min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis); - for(uint i = 1; i < 16; i++) + for (uint i = 1; i < 16; i++) { const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); float val = dot(vec, axis); - if( val < min ) { + if ( val < min ) { mini = i; min = val; } - else if( val > max ) { + else if ( val > max ) { maxi = i; max = val; } @@ -429,16 +429,16 @@ void ColorBlock::sortColors(const Vector3 & axis) { float luma_array[16]; - for(uint i = 0; i < 16; i++) { + for (uint i = 0; i < 16; i++) { const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); luma_array[i] = dot(vec, axis); } // Dummy selection sort. - for( uint a = 0; a < 16; a++ ) { + for ( uint a = 0; a < 16; a++ ) { uint min = a; - for( uint b = a+1; b < 16; b++ ) { - if( luma_array[b] < luma_array[min] ) { + for ( uint b = a+1; b < 16; b++ ) { + if ( luma_array[b] < luma_array[min] ) { min = b; } } @@ -454,7 +454,7 @@ float ColorBlock::volume() const Box bounds; bounds.clearBounds(); - for(int i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) { const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b); bounds.addPointToBounds(point); } diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index f98f37e388c..e2874652f02 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -803,7 +803,7 @@ void DDSHeader::swapBytes() this->depth = POSH_LittleU32(this->depth); this->mipmapcount = POSH_LittleU32(this->mipmapcount); - for(int i = 0; i < 11; i++) { + for (int i = 0; i < 11; i++) { this->reserved[i] = POSH_LittleU32(this->reserved[i]); } @@ -899,7 +899,7 @@ bool DirectDrawSurface::isValid() const } const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/); - if( (header.flags & required) != required ) { + if ( (header.flags & required) != required ) { return false; } @@ -909,7 +909,7 @@ bool DirectDrawSurface::isValid() const /* in some files DDSCAPS_TEXTURE is missing: silently ignore */ /* - if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) { + if ( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) { return false; } */ diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index b7a3d0e43ba..071d94c2076 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -81,13 +81,13 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags) Color32 pixel; Color32 *pixels = 0; - if(!imb_is_a_dds(mem)) + if (!imb_is_a_dds(mem)) return (0); /* check if DDS is valid and supported */ if (!dds.isValid()) { /* no need to print error here, just testing if it is a DDS */ - if(flags & IB_test) + if (flags & IB_test) return (0); printf("DDS: not valid; header follows\n"); diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index a93f47db9a3..0e6567d2c6b 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -471,7 +471,7 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter) ibuf->miptot= 1; - while(curmap < IB_MIPMAP_LEVELS) { + while (curmap < IB_MIPMAP_LEVELS) { if (ibuf->mipmap[curmap]) { @@ -507,7 +507,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter) ibuf->miptot= 1; - while(curmap < IB_MIPMAP_LEVELS) { + while (curmap < IB_MIPMAP_LEVELS) { if (use_filter) { ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect); IMB_filterN(nbuf, hbuf); diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 85bd3137ddc..1976242ea4f 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -62,7 +62,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf) if (ibuf->rect) { size = ibuf->x * ibuf->y; - while(size-- > 0) { + while (size-- > 0) { rt= cp[0]; cp[0]= cp[3]; cp[3]= rt; @@ -76,7 +76,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf) if (ibuf->rect_float) { size = ibuf->x * ibuf->y; - while(size-- > 0) { + while (size-- > 0) { rtf= cpf[0]; cpf[0]= cpf[3]; cpf[3]= rtf; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 33ff769217d..e50f8e16ea5 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -863,7 +863,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, frame_rate = av_q2d(context->iStream->r_frame_rate); pts_time_base = av_q2d(context->iStream->time_base); - while(av_read_frame(context->iFormatCtx, &next_packet) >= 0) { + while (av_read_frame(context->iFormatCtx, &next_packet) >= 0) { int frame_finished = 0; float next_progress = (float)((int)floor(((double) next_packet.pos) * 100 / ((double) stream_size)+0.5)) / 100; diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index b4f1415207e..e775d0f7bbd 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -196,7 +196,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len) { int r = 0; - while(len) { + while (len) { r = putlong(outf,*tab++); len -= 4; } @@ -205,7 +205,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len) static void readtab(FILE *inf, unsigned int *tab, int len) { - while(len) { + while (len) { *tab++ = getlong(inf); len -= 4; } @@ -222,7 +222,7 @@ static void test_endian_zbuf(struct ImBuf *ibuf) len= ibuf->x*ibuf->y; zval= ibuf->zbuf; - while(len--) { + while (len--) { zval[0]= BIG_LONG(zval[0]); zval++; } @@ -540,7 +540,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n) { lptr += z; - while(n--) { + while (n--) { *lptr = *cptr++; lptr += 4; } @@ -549,7 +549,7 @@ static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n) { lptr += z; - while(n--) { + while (n--) { *lptr = ((cptr[0]<<8) | (cptr[1]<<0)) / (float)0xFFFF; cptr += 2; lptr += 4; @@ -562,14 +562,14 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) float pixel_f; optr += z; - while(1) { + while (1) { pixel = (iptr[0]<<8) | (iptr[1]<<0); iptr += 2; if ( !(count = (pixel & 0x7f)) ) return; if (pixel & 0x80) { - while(count>=8) { + while (count>=8) { optr[0*4] = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF; optr[1*4] = ((iptr[2]<<8) | (iptr[3]<<0))/(float)0xFFFF; optr[2*4] = ((iptr[4]<<8) | (iptr[5]<<0))/(float)0xFFFF; @@ -582,7 +582,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) iptr += 8*2; count -= 8; } - while(count--) { + while (count--) { *optr = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF; iptr+=2; optr+=4; @@ -592,7 +592,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) pixel_f = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF; iptr += 2; - while(count>=8) { + while (count>=8) { optr[0*4] = pixel_f; optr[1*4] = pixel_f; optr[2*4] = pixel_f; @@ -604,7 +604,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z) optr += 8*4; count -= 8; } - while(count--) { + while (count--) { *optr = pixel_f; optr+=4; } @@ -617,12 +617,12 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) unsigned char pixel, count; optr += z; - while(1) { + while (1) { pixel = *iptr++; if ( !(count = (pixel & 0x7f)) ) return; if (pixel & 0x80) { - while(count>=8) { + while (count>=8) { optr[0*4] = iptr[0]; optr[1*4] = iptr[1]; optr[2*4] = iptr[2]; @@ -635,14 +635,14 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) iptr += 8; count -= 8; } - while(count--) { + while (count--) { *optr = *iptr++; optr+=4; } } else { pixel = *iptr++; - while(count>=8) { + while (count>=8) { optr[0*4] = pixel; optr[1*4] = pixel; optr[2*4] = pixel; @@ -654,7 +654,7 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z) optr += 8*4; count -= 8; } - while(count--) { + while (count--) { *optr = pixel; optr+=4; } @@ -764,7 +764,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n) { lumptr += CHANOFFSET(0); - while(n--) { + while (n--) { *lumptr = ILUM(rgbptr[OFFSET_R],rgbptr[OFFSET_G],rgbptr[OFFSET_B]); lumptr += 4; rgbptr += 4; @@ -782,18 +782,18 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn ibufend = iptr+cnt*4; optr = rlebuf; - while(iptr<ibufend) { + while (iptr<ibufend) { sptr = iptr; iptr += 8; - while((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0]))) + while ((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0]))) iptr+=4; iptr -= 8; count = (iptr-sptr)/4; - while(count) { + while (count) { todo = count>126 ? 126:count; count -= todo; *optr++ = 0x80|todo; - while(todo>8) { + while (todo>8) { optr[0] = sptr[0*4]; optr[1] = sptr[1*4]; optr[2] = sptr[2*4]; @@ -807,7 +807,7 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn sptr += 8*4; todo -= 8; } - while(todo--) { + while (todo--) { *optr++ = *sptr; sptr += 4; } @@ -815,10 +815,10 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn sptr = iptr; cc = *iptr; iptr += 4; - while( (iptr<ibufend) && (*iptr == cc) ) + while ( (iptr<ibufend) && (*iptr == cc) ) iptr += 4; count = (iptr-sptr)/4; - while(count) { + while (count) { todo = count>126 ? 126:count; count -= todo; *optr++ = todo; diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c index 24317278a43..307c634b26a 100644 --- a/source/blender/imbuf/intern/moviecache.c +++ b/source/blender/imbuf/intern/moviecache.c @@ -114,7 +114,7 @@ static void check_unused_keys(MovieCache *cache) GHashIterator *iter; iter= BLI_ghashIterator_new(cache->hash); - while(!BLI_ghashIterator_isDone(iter)) { + while (!BLI_ghashIterator_isDone(iter)) { MovieCacheKey *key= BLI_ghashIterator_getKey(iter); MovieCacheItem *item= BLI_ghashIterator_getValue(iter); @@ -322,7 +322,7 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_ iter= BLI_ghashIterator_new(cache->hash); a= 0; - while(!BLI_ghashIterator_isDone(iter)) { + while (!BLI_ghashIterator_isDone(iter)) { MovieCacheKey *key= BLI_ghashIterator_getKey(iter); MovieCacheItem *item= BLI_ghashIterator_getValue(iter); int framenr, curproxy, curflags; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index bb92bd9cc09..3d90267b030 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -187,7 +187,7 @@ static void openexr_header_metadata(Header *header, struct ImBuf *ibuf) { ImMetaData* info; - for(info= ibuf->metadata; info; info= info->next) + for (info= ibuf->metadata; info; info= info->next) header->insert(info->key, StringAttribute(info->value)); } @@ -231,7 +231,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags if (write_zbuf) frameBuffer.insert ("Z", Slice (FLOAT, (char *)(ibuf->zbuf_float + (height-1)*width), sizeof(float), sizeof(float) * -width)); - if(ibuf->rect_float) { + if (ibuf->rect_float) { float *from; for (int i = ibuf->y-1; i >= 0; i--) @@ -251,7 +251,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags else { unsigned char *from; - if(ibuf->profile == IB_PROFILE_LINEAR_RGB) { + if (ibuf->profile == IB_PROFILE_LINEAR_RGB) { for (int i = ibuf->y-1; i >= 0; i--) { from= (unsigned char *)ibuf->rect + channels*i*width; @@ -451,7 +451,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname echan= (ExrChannel *)MEM_callocN(sizeof(ExrChannel), "exr tile channel"); - if(layname) { + if (layname) { char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1]; BLI_strncpy(lay, layname, EXR_LAY_MAXNAME); BLI_strncpy(pass, passname, EXR_PASS_MAXNAME); @@ -479,7 +479,7 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh data->width= width; data->height= height; - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) header.channels().insert (echan->name, Channel (FLOAT)); openexr_header_compression(&header, compress); @@ -512,7 +512,7 @@ void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int data->height= height; data->mipmap= mipmap; - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) header.channels().insert (echan->name, Channel (FLOAT)); header.setTileDescription (TileDescription (tilex, tiley, (mipmap)? MIPMAP_LEVELS: ONE_LEVEL)); @@ -529,9 +529,9 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig { ExrHandle *data= (ExrHandle *)handle; - if(BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */ + if (BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */ data->ifile = new InputFile(filename); - if(data->ifile) { + if (data->ifile) { Box2i dw = data->ifile->header().dataWindow(); data->width= *width = dw.max.x - dw.min.x + 1; data->height= *height = dw.max.y - dw.min.y + 1; @@ -554,7 +554,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname ExrChannel *echan; char name[EXR_TOT_MAXNAME + 1]; - if(layname) { + if (layname) { char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1]; BLI_strncpy(lay, layname, EXR_LAY_MAXNAME); BLI_strncpy(pass, passname, EXR_PASS_MAXNAME); @@ -566,7 +566,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname echan= (ExrChannel *)BLI_findstring(&data->channels, name, offsetof(ExrChannel, name)); - if(echan) { + if (echan) { echan->xstride= xstride; echan->ystride= ystride; echan->rect= rect; @@ -587,7 +587,7 @@ void IMB_exrtile_write_channels(void *handle, int partx, int party, int level) FrameBuffer frameBuffer; ExrChannel *echan; - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { float *rect= echan->rect - echan->xstride*partx - echan->ystride*party; frameBuffer.insert (echan->name, Slice (FLOAT, (char *)rect, @@ -611,8 +611,8 @@ void IMB_exr_write_channels(void *handle) FrameBuffer frameBuffer; ExrChannel *echan; - if(data->channels.first) { - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + if (data->channels.first) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { /* last scanline, stride negative */ float *rect = echan->rect + echan->xstride*(data->height-1)*data->width; @@ -643,10 +643,10 @@ void IMB_exr_read_channels(void *handle) const StringAttribute *ta = data->ifile->header().findTypedAttribute <StringAttribute> ("BlenderMultiChannel"); short flip = (ta && strncmp(ta->value().c_str(), "Blender V2.43", 13)==0); /* 'previous multilayer attribute, flipped */ - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { - if(echan->rect) { - if(flip) + if (echan->rect) { + if (flip) frameBuffer.insert (echan->name, Slice (FLOAT, (char *)echan->rect, echan->xstride*sizeof(float), echan->ystride*sizeof(float))); else @@ -676,15 +676,15 @@ void IMB_exr_multilayer_convert(void *handle, void *base, ExrLayer *lay; ExrPass *pass; - if(data->layers.first==NULL) { + if (data->layers.first==NULL) { printf("cannot convert multilayer, no layers in handle\n"); return; } - for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { + for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { void *laybase= addlayer(base, lay->name); - if(laybase) { - for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { + if (laybase) { + for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { addpass(base, laybase, pass->name, pass->rect, pass->totchan, pass->chan_id); pass->rect= NULL; } @@ -699,11 +699,11 @@ void IMB_exr_close(void *handle) ExrLayer *lay; ExrPass *pass; - if(data->ifile) + if (data->ifile) delete data->ifile; - else if(data->ofile) + else if (data->ofile) delete data->ofile; - else if(data->tofile) + else if (data->tofile) delete data->tofile; data->ifile= NULL; @@ -712,9 +712,9 @@ void IMB_exr_close(void *handle) BLI_freelistN(&data->channels); - for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { - for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) - if(pass->rect) + for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { + for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) + if (pass->rect) MEM_freeN(pass->rect); BLI_freelistN(&lay->passes); } @@ -730,11 +730,11 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa { int plen, len= strlen(echan->name); - if(len < 4) { + if (len < 4) { printf("multilayer read: name too short: %s\n", echan->name); return 0; } - if(echan->name[len-2]!='.') { + if (echan->name[len-2]!='.') { printf("multilayer read: name has no Channel: %s\n", echan->name); return 0; } @@ -742,19 +742,19 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa len-= 3; while(len>=0) { - if(echan->name[len]=='.') + if (echan->name[len]=='.') break; len--; } BLI_strncpy(passname, echan->name+len+1, EXR_PASS_MAXNAME); plen= strlen(passname); - if(plen < 3) { + if (plen < 3) { printf("multilayer read: should not happen: %s\n", echan->name); return 0; } passname[plen-2]= 0; - if(len<1) + if (len<1) layname[0]= 0; else { BLI_strncpy(layname, echan->name, EXR_LAY_MAXNAME); @@ -768,7 +768,7 @@ static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname) { ExrLayer *lay= (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name)); - if(lay==NULL) { + if (lay==NULL) { lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer"); BLI_addtail(lb, lay); BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME); @@ -781,10 +781,10 @@ static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname) { ExrPass *pass= (ExrPass *)BLI_findstring(lb, passname, offsetof(ExrPass, name)); - if(pass==NULL) { + if (pass==NULL) { pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass"); - if(strcmp(passname, "Combined")==0) + if (strcmp(passname, "Combined")==0) BLI_addhead(lb, pass); else BLI_addtail(lb, pass); @@ -816,29 +816,29 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) /* now try to sort out how to assign memory to the channels */ /* first build hierarchical layer list */ - for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { - if( imb_exr_split_channel_name(echan, layname, passname) ) { + for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) { + if ( imb_exr_split_channel_name(echan, layname, passname) ) { ExrLayer *lay= imb_exr_get_layer(&data->layers, layname); ExrPass *pass= imb_exr_get_pass(&lay->passes, passname); pass->chan[pass->totchan]= echan; pass->totchan++; - if(pass->totchan>=EXR_PASS_MAXCHAN) + if (pass->totchan>=EXR_PASS_MAXCHAN) break; } } - if(echan) { + if (echan) { printf("error, too many channels in one pass: %s\n", echan->name); IMB_exr_close(data); return NULL; } /* with some heuristics, try to merge the channels in buffers */ - for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { - for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { - if(pass->totchan) { + for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) { + for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) { + if (pass->totchan) { pass->rect= (float *)MEM_mapallocN(width*height*pass->totchan*sizeof(float), "pass rect"); - if(pass->totchan==1) { + if (pass->totchan==1) { echan= pass->chan[0]; echan->rect= pass->rect; echan->xstride= 1; @@ -851,14 +851,14 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) memset(lookup, 0, sizeof(lookup)); /* we can have RGB(A), XYZ(W), UVA */ - if(pass->totchan==3 || pass->totchan==4) { - if(pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' || pass->chan[2]->chan_id=='B') { + if (pass->totchan==3 || pass->totchan==4) { + if (pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' || pass->chan[2]->chan_id=='B') { lookup[(unsigned int)'R']= 0; lookup[(unsigned int)'G']= 1; lookup[(unsigned int)'B']= 2; lookup[(unsigned int)'A']= 3; } - else if(pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' || pass->chan[2]->chan_id=='Y') { + else if (pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' || pass->chan[2]->chan_id=='Y') { lookup[(unsigned int)'X']= 0; lookup[(unsigned int)'Y']= 1; lookup[(unsigned int)'Z']= 2; @@ -869,7 +869,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) lookup[(unsigned int)'V']= 1; lookup[(unsigned int)'A']= 2; } - for(a=0; a<pass->totchan; a++) { + for (a=0; a<pass->totchan; a++) { echan= pass->chan[a]; echan->rect= pass->rect + lookup[(unsigned int)echan->chan_id]; echan->xstride= pass->totchan; @@ -878,7 +878,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) } } else { /* unknown */ - for(a=0; a<pass->totchan; a++) { + for (a=0; a<pass->totchan; a++) { echan= pass->chan[a]; echan->rect= pass->rect + a; echan->xstride= pass->totchan; @@ -928,8 +928,8 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan) /* const Channel &channel = i.channel(); */ /* Not used yet */ const char *str= i.name(); int len= strlen(str); - if(len) { - if(BLI_strcasecmp(chan, str+len-1)==0) { + if (len) { + if (BLI_strcasecmp(chan, str+len-1)==0) { return str; } } @@ -947,8 +947,8 @@ static int exr_has_zbuffer(InputFile *file) static int exr_is_renderresult(InputFile *file) { const StringAttribute *comments= file->header().findTypedAttribute<StringAttribute>("BlenderMultiChannel"); - if(comments) -// if(comments->value() == "Blender MultiChannel") + if (comments) +// if (comments->value() == "Blender MultiChannel") return 1; return 0; } @@ -973,13 +973,13 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) //printf("OpenEXR-load: image data window %d %d %d %d\n", // dw.min.x, dw.min.y, dw.max.x, dw.max.y); - if(0) // debug + if (0) // debug exr_print_filecontents(file); is_multi= exr_is_renderresult(file); /* do not make an ibuf when */ - if(is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) + if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) { printf("Error: can't process EXR multilayer file\n"); } @@ -993,11 +993,11 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) if (!(flags & IB_test)) { - if(is_multi) /* only enters with IB_multilayer flag set */ + if (is_multi) /* only enters with IB_multilayer flag set */ { /* constructs channels for reading, allocates memory in channels */ ExrHandle *handle= imb_exr_begin_read_mem(file, width, height); - if(handle) { + if (handle) { IMB_exr_read_channels(handle); ibuf->userdata= handle; /* potential danger, the caller has to check for this! */ return ibuf; @@ -1026,7 +1026,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) frameBuffer.insert ( exr_rgba_channelname(file, "A"), Slice (FLOAT, (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); /* 1.0 is fill value */ - if(exr_has_zbuffer(file)) + if (exr_has_zbuffer(file)) { float *firstz; @@ -1046,7 +1046,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) // // Disabling this because the sequencer frees immediate. // - // if(flag & IM_rect) + // if (flag & IM_rect) // IMB_rect_from_float(ibuf); } } diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index c8c4a4fd38c..7aceb695d00 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -153,7 +153,7 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI if (fputc(last-1,file) == EOF) return(0); do { if (out(*rect++,file) == EOF) return(0); - } while(--last != 0); + } while (--last != 0); } rectstart = rect; rect = temp; @@ -204,14 +204,14 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) rect = (uchar *) ibuf->rect; if (ibuf->planes <= 8) { - while(size > 0) { + while (size > 0) { if (putc(*rect, file) == EOF) return (0); size--; rect += 4; } } else if (ibuf->planes <= 16) { - while(size > 0) { + while (size > 0) { putc(rect[0], file); if (putc(rect[1], file) == EOF) return (0); size--; @@ -219,7 +219,7 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) } } else if (ibuf->planes <= 24) { - while(size > 0) { + while (size > 0) { putc(rect[2], file); putc(rect[1], file); if (putc(rect[0], file) == EOF) return (0); @@ -228,7 +228,7 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) } } else if (ibuf->planes <= 32) { - while(size > 0) { + while (size > 0) { putc(rect[2], file); putc(rect[1], file); putc(rect[0], file); @@ -384,7 +384,7 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size, cp[0] = 0xff; cp[1] = cp[2] = 0; - while(size > 0) { + while (size > 0) { count = *mem++; if (mem>mem_end) @@ -502,7 +502,7 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in cp[0] = 0xff; cp[1] = cp[2] = 0; - while(size > 0) { + while (size > 0) { if (mem>mem_end) goto partial_load; diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 91df1e78f44..2d477a5f43d 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -76,7 +76,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile) endian_switch = ((ENDIAN_ORDER != endian)) ? 1 : 0; - while(gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) { + while (gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) { if (endian_switch) SWITCH_INT(bhead[1]); /* length */ |