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-03-24 11:52:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-24 11:52:14 +0400
commitb8a71efeba70d6c3ebc579f5043daa4162da86e8 (patch)
treed2d89da2a59f8955583f4968a35e48c578fd4d4c /source/blender/imbuf/intern/openexr
parent81d8f17843f92c6d6abbacb652ca22917910f4bc (diff)
style cleanup: follow style guide for/with/if spacing
Diffstat (limited to 'source/blender/imbuf/intern/openexr')
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp114
1 files changed, 57 insertions, 57 deletions
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);
}
}