[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49416] branches/soc-2011-tomato: Resolve compilation error with MSVC

Sergey Sharybin sergey.vfx at gmail.com
Tue Jul 31 16:27:14 CEST 2012


Revision: 49416
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49416
Author:   nazgul
Date:     2012-07-31 14:27:14 +0000 (Tue, 31 Jul 2012)
Log Message:
-----------
Resolve compilation error with MSVC

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/cycles/render/tile.cpp
    branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp

Modified: branches/soc-2011-tomato/intern/cycles/render/tile.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/render/tile.cpp	2012-07-31 14:16:27 UTC (rev 49415)
+++ branches/soc-2011-tomato/intern/cycles/render/tile.cpp	2012-07-31 14:27:14 UTC (rev 49416)
@@ -19,6 +19,7 @@
 #include "tile.h"
 
 #include "util_algorithm.h"
+#include "util_types.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -124,8 +125,8 @@
 	int device_y = (image_h / num) * device;
 	int device_h = (device == num - 1) ? image_h - device * (image_h / num) : image_h / num;
 
-	long long int centx = image_w / 2, centy = device_h / 2, tot = 1;
-	long long int mindist = (long long int) image_w * (long long int) device_h;
+	int64_t centx = image_w / 2, centy = device_h / 2, tot = 1;
+	int64_t mindist = (int64_t) image_w * (int64_t) device_h;
 
 	/* find center of rendering tiles, image center counts for 1 too */
 	for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
@@ -145,9 +146,9 @@
 		if(iter->device == device && iter->rendering == false) {
 			Tile &cur_tile = *iter;
 
-			long long int distx = centx - (cur_tile.x + cur_tile.w / 2);
-			long long int disty = centy - (cur_tile.y + cur_tile.h / 2);
-			distx = (long long int) sqrt(distx * distx + disty * disty);
+			int64_t distx = centx - (cur_tile.x + cur_tile.w / 2);
+			int64_t disty = centy - (cur_tile.y + cur_tile.h / 2);
+			distx = (int64_t) sqrt((double)distx * distx + disty * disty);
 
 			if (distx < mindist) {
 				best = iter;

Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp	2012-07-31 14:16:27 UTC (rev 49415)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_InpaintOperation.cpp	2012-07-31 14:27:14 UTC (rev 49416)
@@ -20,10 +20,12 @@
  *		Monique Dewanchand
  */
 
+#include "MEM_guardedalloc.h"
+
 #include "COM_InpaintOperation.h"
-#include "BLI_math.h"
 #include "COM_OpenCLDevice.h"
 
+#include "BLI_math.h"
 
 #define ASSERT_XY_RANGE(x, y)  \
 	BLI_assert(x >= 0 && x < this->getWidth() && \
@@ -131,9 +133,9 @@
 	int width = this->getWidth();
 	int height = this->getHeight();
 	short *m = this->m_manhatten_distance = new short[width * height];
-	int offsets[width + height + 1];
+	int *offsets;
 
-	memset(offsets, 0, sizeof(offsets));
+	offsets = (int *)MEM_callocN(sizeof(int) * (width + height + 1), "InpaintSimpleOperation offsets");
 
 	for (int j = 0; j < height; j++) {
 		for (int i = 0; i < width; i++) {
@@ -179,6 +181,8 @@
 			this->m_pixelorder[offsets[m[i] - 1]++] = i;
 		}
 	}
+
+	MEM_freeN(offsets);
 }
 
 void InpaintSimpleOperation::pix_step(int x, int y)




More information about the Bf-blender-cvs mailing list