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:
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_image.c')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_image.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
index 89a3072ac8d..a204f8df4b2 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c
@@ -64,27 +64,19 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
ibuf= BKE_image_get_ibuf(ima, iuser);
if(ibuf==NULL)
return NULL;
-
- if (rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
- if (ibuf->profile == IB_PROFILE_NONE) {
- /* if float buffer already exists = already linear */
- /* else ... */
- if (ibuf->rect_float == NULL) {
- imb_freerectfloatImBuf(ibuf);
- ibuf->profile = IB_PROFILE_SRGB;
- IMB_float_from_rect(ibuf);
- } else {
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
- }
- }
- } else {
- if (ibuf->profile == IB_PROFILE_SRGB) {
- if (ibuf->rect_float != NULL) {
- imb_freerectfloatImBuf(ibuf);
- }
- ibuf->profile = IB_PROFILE_NONE;
- IMB_float_from_rect(ibuf);
+
+ if (!(rd->color_mgt_flag & R_COLOR_MANAGEMENT)) {
+ int profile = IB_PROFILE_NONE;
+
+ /* temporarily set profile to none to not disturb actual */
+ SWAP(int, ibuf->profile, profile);
+
+ if (ibuf->rect_float != NULL) {
+ imb_freerectfloatImBuf(ibuf);
}
+ IMB_float_from_rect(ibuf);
+
+ SWAP(int, ibuf->profile, profile);
}
if (ibuf->rect_float == NULL) {