diff options
author | Ton Roosendaal <ton@blender.org> | 2006-03-20 19:53:13 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-03-20 19:53:13 +0300 |
commit | e469e4875f97d04fc788cab533495d9408e9b038 (patch) | |
tree | 6d76039c0929782e47003971990773a1394bbcd7 /source | |
parent | 99dbcaa2f1e093a6736c3b14465954940c807092 (diff) |
Cineon/DPX export didn't survive when Blender gave it negative colors.
Was missing test for it before turning it into unsigned short.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineon_dpx.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index d3cf74f60a9..020449897a5 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -135,22 +135,22 @@ static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int f /*note that image is flipped when sent to logImageSetRowBytes (see last passed parameter).*/ for (j = 0; j < height; ++j) { - fline = &buf->rect_float[width*j*4]; - for (i=0; i<width; i++) { - float *fpix, fpix2[3]; - /*we have to convert to cinepaint's 16-bit-per-channel here*/ - pixel = &line[i*depth]; - fpix = &fline[i*4]; - memcpy(fpix2, fpix, sizeof(float)*3); - - if (fpix2[0]>=1) fpix2[0] = 1; - if (fpix2[1]>=1) fpix2[1] = 1; - if (fpix2[2]>=1) fpix2[2] = 1; - - pixel[0] = (unsigned short)(fpix2[0] * 65535.0f); /*float-float math is faster*/ - pixel[1] = (unsigned short)(fpix2[1] * 65535.0f); - pixel[2] = (unsigned short)(fpix2[2] * 65535.0f); - } + fline = &buf->rect_float[width*j*4]; + for (i=0; i<width; i++) { + float *fpix, fpix2[3]; + /*we have to convert to cinepaint's 16-bit-per-channel here*/ + pixel = &line[i*depth]; + fpix = &fline[i*4]; + memcpy(fpix2, fpix, sizeof(float)*3); + + if (fpix2[0]>=1.0f) fpix2[0] = 1.0f; else if (fpix2[0]<0.0f) fpix2[0]= 0.0f; + if (fpix2[1]>=1.0f) fpix2[1] = 1.0f; else if (fpix2[1]<0.0f) fpix2[1]= 0.0f; + if (fpix2[2]>=1.0f) fpix2[2] = 1.0f; else if (fpix2[2]<0.0f) fpix2[2]= 0.0f; + + pixel[0] = (unsigned short)(fpix2[0] * 65535.0f); /*float-float math is faster*/ + pixel[1] = (unsigned short)(fpix2[1] * 65535.0f); + pixel[2] = (unsigned short)(fpix2[2] * 65535.0f); + } logImageSetRowBytes(logImage, (const unsigned short*)line, height-1-j); } logImageClose(logImage); |