Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-07-18 16:47:21 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-07-18 16:50:39 +0300
commit1f8567ac68b667ba9b001fd2f33c4c1f24ccafa0 (patch)
tree3f73821a4348f1eb6b150e935f4aa69154e871d8 /source/blender/imbuf
parent757041560f6dca8eecfa743dc563394623e3ad13 (diff)
Fix T99750: crash with file output node, after image colorspace saving changes
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/divers.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 588c92d748d..13c8f0887b3 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -695,9 +695,6 @@ void IMB_buffer_byte_from_byte(uchar *rect_to,
void IMB_rect_from_float(ImBuf *ibuf)
{
- float *buffer;
- const char *from_colorspace;
-
/* verify we have a float buffer */
if (ibuf->rect_float == NULL) {
return;
@@ -710,24 +707,21 @@ void IMB_rect_from_float(ImBuf *ibuf)
}
}
- if (ibuf->float_colorspace == NULL) {
- from_colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
- }
- else {
- from_colorspace = ibuf->float_colorspace->name;
- }
+ const char *from_colorspace = (ibuf->float_colorspace == NULL) ?
+ IMB_colormanagement_role_colorspace_name_get(
+ COLOR_ROLE_SCENE_LINEAR) :
+ ibuf->float_colorspace->name;
+ const char *to_colorspace = (ibuf->rect_colorspace == NULL) ?
+ IMB_colormanagement_role_colorspace_name_get(
+ COLOR_ROLE_DEFAULT_BYTE) :
+ ibuf->rect_colorspace->name;
- buffer = MEM_dupallocN(ibuf->rect_float);
+ float *buffer = MEM_dupallocN(ibuf->rect_float);
/* first make float buffer in byte space */
const bool predivide = IMB_alpha_affects_rgb(ibuf);
- IMB_colormanagement_transform(buffer,
- ibuf->x,
- ibuf->y,
- ibuf->channels,
- from_colorspace,
- ibuf->rect_colorspace->name,
- predivide);
+ IMB_colormanagement_transform(
+ buffer, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, to_colorspace, predivide);
/* convert from float's premul alpha to byte's straight alpha */
if (IMB_alpha_affects_rgb(ibuf)) {