Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-04-28 10:31:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-28 10:31:57 +0400
commitb340f930ec5639f24e7e2d47fab221fb752b61dd (patch)
tree0e880a36bb528d133af6d10701fc090716b3b7f8 /source/blender/imbuf
parent09dc600839904a198ab4ba3fad62ce58c2d3aa07 (diff)
style cleanup: changes to brace placement / newlines - for/while/if/switch
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/anim_movie.c2
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp24
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp8
-rw-r--r--source/blender/imbuf/intern/dds/PixelFormat.h16
-rw-r--r--source/blender/imbuf/intern/jpeg.c6
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp47
-rw-r--r--source/blender/imbuf/intern/png.c2
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c7
-rw-r--r--source/blender/imbuf/intern/targa.c4
-rw-r--r--source/blender/imbuf/intern/thumbs.c4
-rw-r--r--source/blender/imbuf/intern/util.c7
11 files changed, 53 insertions, 74 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 0c8f932db6a..d0d141a8ef8 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1271,7 +1271,7 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position,
}
}
- switch(anim->curtype) {
+ switch (anim->curtype) {
case ANIM_SEQUENCE:
pic = an_stringdec(anim->first, head, tail, &digits);
pic += position;
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;
}
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 3f3ebc5872d..87e56bffb41 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -321,7 +321,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
rect = (uchar *) (ibuf->rect + y * ibuf->x);
buffer = row_pointer[0];
- switch(depth) {
+ switch (depth) {
case 1:
for (x=ibuf->x; x >0; x--) {
rect[3] = 255;
@@ -524,7 +524,7 @@ next_stamp_info:
rect = (uchar *) (ibuf->rect + y * ibuf->x);
buffer = row_pointer[0];
- switch(cinfo->in_color_space) {
+ switch (cinfo->in_color_space) {
case JCS_RGB:
for (x = 0; x < ibuf->x; x++) {
*buffer++ = rect[0];
@@ -577,7 +577,7 @@ static int init_jpeg(FILE * outfile, struct jpeg_compress_struct * cinfo, struct
if (ibuf->planes == 32) cinfo->in_color_space = JCS_UNKNOWN;
#endif
- switch(cinfo->in_color_space) {
+ switch (cinfo->in_color_space) {
case JCS_RGB:
cinfo->input_components = 3;
break;
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index ff3a816f478..44b7472b910 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -117,8 +117,7 @@ private:
bool Mem_IStream::read (char c[], int n)
{
- if (n + _exrpos <= _exrsize)
- {
+ if (n + _exrpos <= _exrsize) {
memcpy(c, (void *)(&_exrbuf[_exrpos]), n);
_exrpos += n;
return true;
@@ -162,8 +161,7 @@ int imb_is_a_openexr(unsigned char *mem)
static void openexr_header_compression(Header *header, int compression)
{
- switch(compression)
- {
+ switch (compression) {
case 0:
header->compression() = NO_COMPRESSION;
break;
@@ -236,12 +234,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
if (ibuf->rect_float) {
float *from;
- for (int i = ibuf->y-1; i >= 0; i--)
- {
+ for (int i = ibuf->y-1; i >= 0; i--) {
from= ibuf->rect_float + channels*i*width;
- for (int j = ibuf->x; j > 0; j--)
- {
+ for (int j = ibuf->x; j > 0; j--) {
to->r = from[0];
to->g = from[1];
to->b = from[2];
@@ -254,12 +250,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
unsigned char *from;
if (ibuf->profile == IB_PROFILE_LINEAR_RGB) {
- for (int i = ibuf->y-1; i >= 0; i--)
- {
+ for (int i = ibuf->y-1; i >= 0; i--) {
from= (unsigned char *)ibuf->rect + channels*i*width;
- for (int j = ibuf->x; j > 0; j--)
- {
+ for (int j = ibuf->x; j > 0; j--) {
to->r = (float)(from[0])/255.0;
to->g = (float)(from[1])/255.0;
to->b = (float)(from[2])/255.0;
@@ -269,12 +263,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
}
}
else {
- for (int i = ibuf->y-1; i >= 0; i--)
- {
+ for (int i = ibuf->y-1; i >= 0; i--) {
from= (unsigned char *)ibuf->rect + channels*i*width;
- for (int j = ibuf->x; j > 0; j--)
- {
+ for (int j = ibuf->x; j > 0; j--) {
to->r = srgb_to_linearrgb((float)from[0] / 255.0);
to->g = srgb_to_linearrgb((float)from[1] / 255.0);
to->b = srgb_to_linearrgb((float)from[2] / 255.0);
@@ -364,8 +356,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
{
- if (flags & IB_mem)
- {
+ if (flags & IB_mem) {
printf("OpenEXR-save: Create EXR in memory CURRENTLY NOT SUPPORTED !\n");
imb_addencodedbufferImBuf(ibuf);
ibuf->encodedsize = 0;
@@ -743,7 +734,7 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
echan->chan_id= echan->name[len-1];
len-= 3;
- while(len>=0) {
+ while (len>=0) {
if (echan->name[len]=='.')
break;
len--;
@@ -913,8 +904,7 @@ static void exr_print_filecontents(InputFile *file)
{
const ChannelList &channels = file->header().channels();
- for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
- {
+ for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) {
const Channel &channel = i.channel();
printf("OpenEXR-load: Found channel %s of type %d\n", i.name(), channel.type);
}
@@ -925,8 +915,7 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan)
{
const ChannelList &channels = file->header().channels();
- for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
- {
+ for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) {
/* const Channel &channel = i.channel(); */ /* Not used yet */
const char *str= i.name();
int len= strlen(str);
@@ -986,8 +975,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
is_multi= exr_is_multilayer(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");
}
else {
@@ -998,10 +986,8 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
/* openEXR is linear as per EXR spec */
ibuf->profile = IB_PROFILE_LINEAR_RGB;
- if (!(flags & IB_test))
- {
- if (is_multi) /* only enters with IB_multilayer flag set */
- {
+ if (!(flags & IB_test)) {
+ 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) {
@@ -1032,8 +1018,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
frameBuffer.insert ( exr_rgba_channelname(file, "A"),
Slice (Imf::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;
addzbuffloatImBuf(ibuf);
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 74e1a4084c2..513fcb9b6dc 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -358,7 +358,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
bytesperpixel = png_get_channels(png_ptr, info_ptr);
- switch(color_type) {
+ switch (color_type) {
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_RGB_ALPHA:
break;
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index 524f96b72af..66acd952ac0 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -192,8 +192,11 @@ struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags)
}
}
if (found && (x<(size + 2))) {
- if (sscanf((char *)&mem[x+1], "%79s %d %79s %d", (char*)&oriY, &height,
- (char*)&oriX, &width) != 4) return NULL;
+ if (sscanf((char *)&mem[x + 1], "%79s %d %79s %d", (char *)&oriY, &height,
+ (char*)&oriX, &width) != 4)
+ {
+ return NULL;
+ }
/* find end of this line, data right behind it */
ptr = (unsigned char *)strchr((char*)&mem[x+1], '\n');
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 7aceb695d00..0ed9b99d0ee 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -288,7 +288,7 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
ok = dumptarga(ibuf, fildes);
}
else {
- switch((ibuf->planes + 7) >> 3) {
+ switch ((ibuf->planes + 7) >> 3) {
case 1:
ok = makebody_tga(ibuf, fildes, tga_out1);
break;
@@ -617,7 +617,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
}
}
- switch(tga.imgtyp) {
+ switch (tga.imgtyp) {
case 1:
case 2:
case 3:
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 5d64e1b2aec..9aeed8002e1 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -83,7 +83,7 @@ static int get_thumb_dir( char* dir , ThumbSize size)
if (!home) return 0;
BLI_strncpy(dir, home, FILE_MAX);
#endif
- switch(size) {
+ switch (size) {
case THB_NORMAL:
strcat(dir, "/.thumbnails/normal/");
break;
@@ -269,7 +269,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
float scaledx, scaledy;
struct stat info;
- switch(size) {
+ switch (size) {
case THB_NORMAL:
tsize = 128;
break;
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index b5fdb897d14..9e819e56da5 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -250,7 +250,7 @@ static int isffmpeg (const char *filename)
do_init_ffmpeg();
- if ( BLI_testextensie(filename, ".swf") ||
+ if (BLI_testextensie(filename, ".swf") ||
BLI_testextensie(filename, ".jpg") ||
BLI_testextensie(filename, ".png") ||
BLI_testextensie(filename, ".dds") ||
@@ -258,7 +258,10 @@ static int isffmpeg (const char *filename)
BLI_testextensie(filename, ".bmp") ||
BLI_testextensie(filename, ".exr") ||
BLI_testextensie(filename, ".cin") ||
- BLI_testextensie(filename, ".wav")) return 0;
+ BLI_testextensie(filename, ".wav"))
+ {
+ return 0;
+ }
if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)!=0) {
if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_open_input_file failed\n");