diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
commit | b8a71efeba70d6c3ebc579f5043daa4162da86e8 (patch) | |
tree | d2d89da2a59f8955583f4968a35e48c578fd4d4c /source/blender/imbuf/intern/dds | |
parent | 81d8f17843f92c6d6abbacb652ca22917910f4bc (diff) |
style cleanup: follow style guide for/with/if spacing
Diffstat (limited to 'source/blender/imbuf/intern/dds')
-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 |
4 files changed, 44 insertions, 44 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"); |