From 17dc6e7c041adad57a6b038975aa3d2e7ba967ca Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 24 Sep 2012 18:22:33 +0000 Subject: [PATCH] Some further fixes for #32626: TIFF renders are limited to 8 bit even when we choose 16. File type was checking for wrong flags, now it should be checked against actual file format flags which would be used on save. We also can not free float buffer if file format doesn't have IM_FTYPE_FLOAT flag -- i.e. TIFF doesn't have such flag and it decides whether float or byte buffer should be used based on image depth. --- source/blender/imbuf/intern/colormanagement.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 91eb1f5153e..0f1a880fb75 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1686,12 +1686,18 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int if (allocate_result) colormanaged_ibuf = IMB_dupImBuf(ibuf); + /* 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 + * saving only and ftype would be overwritten a bit later by BKE_imbuf_write + */ + colormanaged_ibuf->ftype = BKE_imtype_to_ftype(image_format_data->imtype); + /* if file format isn't able to handle float buffer itself, * we need to allocate byte buffer and store color managed * image there */ for (type = IMB_FILE_TYPES; type->is_a; type++) { - if (type->save && type->ftype(type, ibuf)) { + if (type->save && type->ftype(type, colormanaged_ibuf)) { if ((type->flag & IM_FTYPE_FLOAT) == 0) make_byte = TRUE; @@ -1703,17 +1709,11 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int colormanagement_imbuf_make_display_space(colormanaged_ibuf, view_settings, display_settings, make_byte); if (colormanaged_ibuf->rect_float) { - if (make_byte && allocate_result) { - /* save a bit of memory */ - imb_freerectfloatImBuf(colormanaged_ibuf); - } - else { - /* float buffer isn't linear anymore, - * image format write callback should check for this flag and assume - * no space conversion should happen if ibuf->float_colorspace != NULL - */ - colormanaged_ibuf->float_colorspace = display_transform_get_colorspace(view_settings, display_settings); - } + /* float buffer isn't linear anymore, + * image format write callback should check for this flag and assume + * no space conversion should happen if ibuf->float_colorspace != NULL + */ + colormanaged_ibuf->float_colorspace = display_transform_get_colorspace(view_settings, display_settings); } }