Added new render pass: "Mist".
[blender.git] / source / blender / imbuf / intern / allocimbuf.c
index a5d404740cf5da4d9a6ede491f2a14a991db0484..bc750e455a624d1c2ba706d52cafe292ecb7bbfb 100644 (file)
@@ -280,6 +280,7 @@ short imb_addrectfloatImBuf(struct ImBuf * ibuf)
        
        size = ibuf->x * ibuf->y;
        size = size * 4 * sizeof(float);
+       ibuf->channels= 4;
        
        if ( (ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf")) ){
                ibuf->mall |= IB_rectfloat;
@@ -445,7 +446,7 @@ struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1)
                memcpy(ibuf2->rect, ibuf1->rect, x * y * sizeof(int));
        
        if (flags & IB_rectfloat)
-               memcpy(ibuf2->rect_float, ibuf1->rect_float, 4 * x * y * sizeof(float));
+               memcpy(ibuf2->rect_float, ibuf1->rect_float, ibuf1->channels * x * y * sizeof(float));
 
        if (flags & IB_planes) 
                memcpy(*(ibuf2->planes),*(ibuf1->planes),ibuf1->depth * ibuf1->skipx * y * sizeof(int));