Fix for [#24208] ObjectId information is wrong when read from multilayer exr
authorJanne Karhu <jhkarh@gmail.com>
Wed, 13 Oct 2010 13:10:35 +0000 (13:10 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Wed, 13 Oct 2010 13:10:35 +0000 (13:10 +0000)
* non-rgba passes shouldn't use color correction

source/blender/nodes/intern/CMP_nodes/CMP_image.c

index 9309d2939dbe110209b0bc6842b7d683d8c022ab..c99496d966470c913f219fcd678c5a698ff51051 100644 (file)
@@ -77,25 +77,31 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
 
        /* now we need a float buffer from the image
         * with matching color management */
-       if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
-               if(ibuf->profile != IB_PROFILE_NONE) {
-                       rect= ibuf->rect_float;
+       if(ibuf->channels == 4) {
+               if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
+                       if(ibuf->profile != IB_PROFILE_NONE) {
+                               rect= ibuf->rect_float;
+                       }
+                       else {
+                               rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+                               srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+                               alloc= TRUE;
+                       }
                }
                else {
-                       rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
-                       srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
-                       alloc= TRUE;
+                       if(ibuf->profile == IB_PROFILE_NONE) {
+                               rect= ibuf->rect_float;
+                       }
+                       else {
+                               rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+                               linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
+                               alloc= TRUE;
+                       }
                }
        }
        else {
-               if(ibuf->profile == IB_PROFILE_NONE) {
-                       rect= ibuf->rect_float;
-               }
-               else {
-                       rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
-                       linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
-                       alloc= TRUE;
-               }
+               /* non-rgba passes can't use color profiles */
+               rect= ibuf->rect_float;
        }
        /* done coercing into the correct color management */