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.
This commit is contained in:
Sergey Sharybin 2012-09-24 18:22:33 +00:00
parent 765865c3b1
commit 17dc6e7c04

@ -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);
}
}