bugfix [#23948] Alpha from images inside compositor is gone
authorCampbell Barton <ideasman42@gmail.com>
Wed, 22 Sep 2010 14:13:34 +0000 (14:13 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 22 Sep 2010 14:13:34 +0000 (14:13 +0000)
also fix memory leak.

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

index 787e126a42b27f39e732039d3fa3e43bdfe37243..2b6a091cc8d33823c5a6ab64f37ab9015c944490 100644 (file)
@@ -393,6 +393,7 @@ void srgb_to_linearrgb_rgba_rgba_buf(float *col_to, float *col_from, int tot)
 {
        while(tot--) {
                srgb_to_linearrgb_v3_v3(col_to, col_from);
 {
        while(tot--) {
                srgb_to_linearrgb_v3_v3(col_to, col_from);
+               col_to[3]= col_from[3];
                col_to += 4;
                col_from += 4;
        }
                col_to += 4;
                col_from += 4;
        }
@@ -402,6 +403,7 @@ void linearrgb_to_srgb_rgba_rgba_buf(float *col_to, float *col_from, int tot)
 {
        while(tot--) {
                linearrgb_to_srgb_v3_v3(col_to, col_from);
 {
        while(tot--) {
                linearrgb_to_srgb_v3_v3(col_to, col_from);
+               col_to[3]= col_from[3];
                col_to += 4;
                col_from += 4;
        }
                col_to += 4;
                col_from += 4;
        }
index 266060c5cc53ed866ee2837ac992d4b8c612644b..9309d2939dbe110209b0bc6842b7d683d8c022ab 100644 (file)
@@ -82,7 +82,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
                        rect= ibuf->rect_float;
                }
                else {
                        rect= ibuf->rect_float;
                }
                else {
-                       rect= MEM_mallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+                       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;
                }
                        srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
                        alloc= TRUE;
                }
@@ -92,7 +92,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
                        rect= ibuf->rect_float;
                }
                else {
                        rect= ibuf->rect_float;
                }
                else {
-                       rect= MEM_mallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image");
+                       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;
                }
                        linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y);
                        alloc= TRUE;
                }
@@ -109,8 +109,9 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
        }
        else {
                /* we put imbuf copy on stack, cbuf knows rect is from other ibuf when freed! */
        }
        else {
                /* we put imbuf copy on stack, cbuf knows rect is from other ibuf when freed! */
-               stackbuf= alloc_compbuf(ibuf->x, ibuf->y, type, alloc);
+               stackbuf= alloc_compbuf(ibuf->x, ibuf->y, type, FALSE);
                stackbuf->rect= rect;
                stackbuf->rect= rect;
+               stackbuf->malloc= alloc;
        }
        
        /*code to respect the premul flag of images; I'm
        }
        
        /*code to respect the premul flag of images; I'm