commit before doing some hefty shapekey change, will break compilation
[blender-staging.git] / source / blender / nodes / intern / CMP_nodes / CMP_image.c
index 00be52a81aaee138887bf4bb86beb7bfb02418eb..89a3072ac8dfd5628c35cec0689b55c395e863c9 100644 (file)
@@ -67,11 +67,15 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
        
        if (rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
                if (ibuf->profile == IB_PROFILE_NONE) {
-                       if (ibuf->rect_float != NULL) {
+                       /* 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;
                        }
-                       ibuf->profile = IB_PROFILE_SRGB;
-                       IMB_float_from_rect(ibuf);
                }
        } else {
                if (ibuf->profile == IB_PROFILE_SRGB) {
@@ -254,7 +258,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, b
                        if(out[1]->hasoutput)
                                out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
 
-                       generate_preview(node, stackbuf);
+                       generate_preview(data, node, stackbuf);
                }
        }       
 };
@@ -386,7 +390,7 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in,
 
                node_composit_rlayers_out(rd, rl, out, rr->rectx, rr->recty);
 
-               generate_preview(node, stackbuf);
+               generate_preview(data, node, stackbuf);
             }
          }
       }