[Bf-blender-cvs] [6203b96] bake-cycles: Cycles-Bake: small fix for external saving + cleanup

Dalai Felinto noreply at git.blender.org
Mon Apr 28 06:58:17 CEST 2014


Commit: 6203b960d00825e9253d93c88116bcca9844d65d
Author: Dalai Felinto
Date:   Mon Apr 28 01:55:16 2014 -0300
https://developer.blender.org/rB6203b960d00825e9253d93c88116bcca9844d65d

Cycles-Bake: small fix for external saving + cleanup

===================================================================

M	source/blender/editors/object/object_bake_api.c

===================================================================

diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index e485c21..6ad2d3a 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -198,7 +198,7 @@ static bool write_external_bake_pixels(
 	/* margins */
 	if (margin > 0) {
 		char *mask_buffer = NULL;
-		int num_pixels = width * height;
+		const int num_pixels = width * height;
 
 		mask_buffer = MEM_callocN(sizeof(char) * num_pixels, "Bake Mask");
 		RE_bake_mask_fill(pixel_array, num_pixels, mask_buffer);
@@ -298,13 +298,11 @@ static int initialize_internal_images(wmOperator *op, BakeImages *bake_images)
 		ibuf = BKE_image_acquire_ibuf(bk_image->image, NULL, &lock);
 
 		if (ibuf) {
-			int num_pixels = ibuf->x * ibuf->y;
-
 			bk_image->width = ibuf->x;
 			bk_image->height = ibuf->y;
 			bk_image->offset = tot_size;
 
-			tot_size += num_pixels;
+			tot_size += ibuf->x * ibuf->y;
 		}
 		else {
 			BKE_image_release_ibuf(bk_image->image, ibuf, lock);
@@ -430,8 +428,6 @@ static int bake_exec(bContext *C, wmOperator *op)
 			bake_images.data[i].height = height;
 			bake_images.data[i].offset = (is_split_materials ? num_pixels : 0);
 			bake_images.data[i].image = NULL;
-
-			num_pixels += width * bake_images.data[i].height;
 		}
 
 		if (!is_split_materials) {




More information about the Bf-blender-cvs mailing list