diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-21 15:10:37 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-21 15:10:37 +0400 |
commit | feadc66c5e6d5edec5c9d54bcfb496ce467fd639 (patch) | |
tree | 29ab467edbe7d6a7a54c62099264f1305866d70e /source/blender/imbuf/intern/cineon/cineon_dpx.c | |
parent | 2fd1f38fbcb5b872724fe84e8119db2a8a1e43eb (diff) |
Fix #33222: When rendering DPX it's flipped in the Image Editor
Avoid using IMB_flipy from image save callback. It will use a bit more
memory but wold be thread-safe.
Diffstat (limited to 'source/blender/imbuf/intern/cineon/cineon_dpx.c')
-rw-r--r-- | source/blender/imbuf/intern/cineon/cineon_dpx.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index d20c6dec9d3..c8bc3f8ebb8 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -139,9 +139,19 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon if (ibuf->rect_float != 0 && bitspersample != 8) { /* don't use the float buffer to save 8 bpp picture to prevent color banding (there's no dithering algorithm behing the logImageSetDataRGBA function) */ - IMB_flipy(ibuf); - rvalue = (logImageSetDataRGBA(logImage, ibuf->rect_float, 1) == 0); - IMB_flipy(ibuf); + + fbuf = (float *)MEM_mallocN(ibuf->x * ibuf->y * 4 * sizeof(float), "fbuf in imb_save_dpx_cineon"); + + for (y = 0; y < ibuf->y; y++) { + float *dst_ptr = fbuf + 4 * ((ibuf->y - y - 1) * ibuf->x); + float *src_ptr = ibuf->rect_float + 4 * (y * ibuf->x); + + memcpy(dst_ptr, src_ptr, 4 * ibuf->x * sizeof(float)); + } + + rvalue = (logImageSetDataRGBA(logImage, fbuf, 1) == 0); + + MEM_freeN(fbuf); } else { if (ibuf->rect == 0) |