diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-09-25 13:34:19 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-09-25 13:34:19 +0400 |
commit | b5a92a0d87a1f95e305d436289293c9c7e8c31a5 (patch) | |
tree | 8dd665e529e21cf91415991d36adeaba4c306df7 /source/blender/imbuf | |
parent | 0b155618a4e2e0e7cc5374585963bb7251f485e8 (diff) |
Color Management: render result could have been incorrectly changed by file saving routines
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index c5d0b935784..d8d249b57b4 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1692,8 +1692,24 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int int make_byte = FALSE; ImFileType *type; - if (allocate_result) + if (allocate_result) { colormanaged_ibuf = IMB_dupImBuf(ibuf); + } + else { + /* render pipeline is constructing image buffer itself, but it's re-using byte and float buffers from render result + * make copy of this buffers here sine this buffers would be transformed to other color space here + */ + + if (ibuf->rect && (ibuf->mall & IB_rect) == 0) { + ibuf->rect = MEM_dupallocN(ibuf->rect); + ibuf->mall |= IB_rect; + } + + if (ibuf->rect_float && (ibuf->mall & IB_rectfloat) == 0) { + ibuf->rect_float = MEM_dupallocN(ibuf->rect_float); + ibuf->mall |= IB_rectfloat; + } + } /* for proper check whether byte buffer is required by a format or not * should be pretty safe since this image buffer is supposed to be used for |