diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-28 10:31:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-28 10:31:57 +0400 |
commit | b340f930ec5639f24e7e2d47fab221fb752b61dd (patch) | |
tree | 0e880a36bb528d133af6d10701fc090716b3b7f8 /source/blender/imbuf/intern/dds | |
parent | 09dc600839904a198ab4ba3fad62ce58c2d3aa07 (diff) |
style cleanup: changes to brace placement / newlines - for/while/if/switch
Diffstat (limited to 'source/blender/imbuf/intern/dds')
-rw-r--r-- | source/blender/imbuf/intern/dds/ColorBlock.cpp | 24 | ||||
-rw-r--r-- | source/blender/imbuf/intern/dds/DirectDrawSurface.cpp | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/dds/PixelFormat.h | 16 |
3 files changed, 18 insertions, 30 deletions
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index 42ef799cf3e..42bec5874ca 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -93,12 +93,10 @@ void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y) // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( // @@ Ideally we should zero the weights of the pixels out of range. - for (uint i = 0; i < 4; i++) - { + for (uint i = 0; i < 4; i++) { const int by = i % bh; - for (uint e = 0; e < 4; e++) - { + for (uint e = 0; e < 4; e++) { const int bx = e % bw; const uint idx = (y + by) * w + x + bx; @@ -118,12 +116,10 @@ void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y) uint srcPlane = w * h; - for (uint i = 0; i < 4; i++) - { + for (uint i = 0; i < 4; i++) { const uint by = i % bh; - for (uint e = 0; e < 4; e++) - { + for (uint e = 0; e < 4; e++) { const uint bx = e % bw; const uint idx = ((y + by) * w + x + bx); @@ -148,8 +144,7 @@ static inline uint8 component(Color32 c, uint i) void ColorBlock::swizzle(uint x, uint y, uint z, uint w) { - for (int i = 0; i < 16; i++) - { + for (int i = 0; i < 16; i++) { Color32 c = m_color[i]; m_color[i].r = component(c, x); m_color[i].g = component(c, y); @@ -164,10 +159,8 @@ bool ColorBlock::isSingleColor(Color32 mask/*= Color32(0xFF, 0xFF, 0xFF, 0x00)*/ { uint u = m_color[0].u & mask.u; - for (int i = 1; i < 16; i++) - { - if (u != (m_color[i].u & mask.u)) - { + for (int i = 1; i < 16; i++) { + if (u != (m_color[i].u & mask.u)) { return false; } } @@ -243,8 +236,7 @@ Color32 ColorBlock::averageColor() const /// Return true if the block is not fully opaque. bool ColorBlock::hasAlpha() const { - for (uint i = 0; i < 16; i++) - { + for (uint i = 0; i < 16; i++) { if (m_color[i].a != 255) return true; } return false; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index e2874652f02..3966135ea32 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -308,7 +308,7 @@ static const uint DDPF_SRGB = 0x40000000U; const char * getDxgiFormatString(DXGI_FORMAT dxgiFormat) { #define CASE(format) case DXGI_FORMAT_##format: return #format - switch(dxgiFormat) + switch (dxgiFormat) { CASE(UNKNOWN); @@ -431,7 +431,7 @@ static const uint DDPF_SRGB = 0x40000000U; const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension) { - switch(resourceDimension) + switch (resourceDimension) { default: case D3D10_RESOURCE_DIMENSION_UNKNOWN: return "UNKNOWN"; @@ -1305,7 +1305,7 @@ void DirectDrawSurface::readBlock(ColorBlock * rgba) uint DirectDrawSurface::blockSize() const { - switch(header.pf.fourcc) + switch (header.pf.fourcc) { case FOURCC_DXT1: case FOURCC_ATI1: @@ -1318,7 +1318,7 @@ uint DirectDrawSurface::blockSize() const case FOURCC_ATI2: return 16; case FOURCC_DX10: - switch(header.header10.dxgiFormat) + switch (header.header10.dxgiFormat) { case DXGI_FORMAT_BC1_TYPELESS: case DXGI_FORMAT_BC1_UNORM: diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h index 3c5cb34812c..308ea810f03 100644 --- a/source/blender/imbuf/intern/dds/PixelFormat.h +++ b/source/blender/imbuf/intern/dds/PixelFormat.h @@ -66,17 +66,14 @@ // Convert component \a c having \a inbits to the returned value having \a outbits. inline uint convert(uint c, uint inbits, uint outbits) { - if (inbits == 0) - { + if (inbits == 0) { return 0; } - else if (inbits >= outbits) - { + else if (inbits >= outbits) { // truncate return c >> (inbits - outbits); } - else - { + else { // bitexpand return (c << (outbits - inbits)) | convert(c, inbits, outbits - inbits); } @@ -85,21 +82,20 @@ // Get pixel component shift and size given its mask. inline void maskShiftAndSize(uint mask, uint * shift, uint * size) { - if (!mask) - { + if (!mask) { *shift = 0; *size = 0; return; } *shift = 0; - while((mask & 1) == 0) { + while ((mask & 1) == 0) { ++(*shift); mask >>= 1; } *size = 0; - while((mask & 1) == 1) { + while ((mask & 1) == 1) { ++(*size); mask >>= 1; } |