[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49500] trunk/blender/source/blender: code cleanup: remove redundant float casts

Campbell Barton ideasman42 at gmail.com
Thu Aug 2 13:33:21 CEST 2012


Revision: 49500
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49500
Author:   campbellbarton
Date:     2012-08-02 11:33:21 +0000 (Thu, 02 Aug 2012)
Log Message:
-----------
code cleanup: remove redundant float casts

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/imbuf/intern/imageprocess.c
    trunk/blender/source/blender/imbuf/intern/radiance_hdr.c
    trunk/blender/source/blender/imbuf/intern/scaling.c
    trunk/blender/source/blender/render/intern/source/envmap.c

Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c	2012-08-02 11:29:32 UTC (rev 49499)
+++ trunk/blender/source/blender/blenkernel/intern/image.c	2012-08-02 11:33:21 UTC (rev 49500)
@@ -603,7 +603,7 @@
 
 	if (floatbuf) {
 		ibuf = IMB_allocImBuf(width, height, depth, IB_rectfloat);
-		rect_float = (float *)ibuf->rect_float;
+		rect_float = ibuf->rect_float;
 		ibuf->profile = IB_PROFILE_LINEAR_RGB;
 	}
 	else {

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2012-08-02 11:29:32 UTC (rev 49499)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2012-08-02 11:33:21 UTC (rev 49500)
@@ -801,7 +801,7 @@
 		
 		if (rgba_fp) {
 			if (ibuf->rect_float) {
-				copy_v4_v4(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4)));
+				copy_v4_v4(rgba_fp, (ibuf->rect_float + ((xi + yi * ibuf->x) * 4)));
 			}
 			else {
 				char *tmp_ch = ((char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4);
@@ -1503,7 +1503,7 @@
 	//memset(projPixel, 0, size);
 	
 	if (ibuf->rect_float) {
-		projPixel->pixel.f_pt = (float *)ibuf->rect_float + ((x_px + y_px * ibuf->x) * 4);
+		projPixel->pixel.f_pt = ibuf->rect_float + ((x_px + y_px * ibuf->x) * 4);
 		projPixel->origColor.f[0] = projPixel->newColor.f[0] = projPixel->pixel.f_pt[0];  
 		projPixel->origColor.f[1] = projPixel->newColor.f[1] = projPixel->pixel.f_pt[1];  
 		projPixel->origColor.f[2] = projPixel->newColor.f[2] = projPixel->pixel.f_pt[2];  

Modified: trunk/blender/source/blender/imbuf/intern/imageprocess.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/imageprocess.c	2012-08-02 11:29:32 UTC (rev 49499)
+++ trunk/blender/source/blender/imbuf/intern/imageprocess.c	2012-08-02 11:33:21 UTC (rev 49500)
@@ -88,7 +88,7 @@
 		*outI = (unsigned char *)ibuf->rect + offset;
 	
 	if (ibuf->rect_float)
-		*outF = (float *)ibuf->rect_float + offset;
+		*outF = ibuf->rect_float + offset;
 }
 
 /**************************************************************************
@@ -258,16 +258,16 @@
 	if (outF) {
 		/* sample including outside of edges of image */
 		if (x1 < 0 || y1 < 0) row1 = empty;
-		else row1 = (float *)in->rect_float + in->x * y1 * 4 + 4 * x1;
+		else row1 = in->rect_float + in->x * y1 * 4 + 4 * x1;
 		
 		if (x1 < 0 || y2 > in->y - 1) row2 = empty;
-		else row2 = (float *)in->rect_float + in->x * y2 * 4 + 4 * x1;
+		else row2 = in->rect_float + in->x * y2 * 4 + 4 * x1;
 		
 		if (x2 > in->x - 1 || y1 < 0) row3 = empty;
-		else row3 = (float *)in->rect_float + in->x * y1 * 4 + 4 * x2;
+		else row3 = in->rect_float + in->x * y1 * 4 + 4 * x2;
 		
 		if (x2 > in->x - 1 || y2 > in->y - 1) row4 = empty;
-		else row4 = (float *)in->rect_float + in->x * y2 * 4 + 4 * x2;
+		else row4 = in->rect_float + in->x * y2 * 4 + 4 * x2;
 
 		a = u - floorf(u);
 		b = v - floorf(v);
@@ -338,10 +338,10 @@
 
 	if (outF) {
 		/* sample including outside of edges of image */
-		row1 = (float *)in->rect_float + in->x * y1 * 4 + 4 * x1;
-		row2 = (float *)in->rect_float + in->x * y2 * 4 + 4 * x1;
-		row3 = (float *)in->rect_float + in->x * y1 * 4 + 4 * x2;
-		row4 = (float *)in->rect_float + in->x * y2 * 4 + 4 * x2;
+		row1 = in->rect_float + in->x * y1 * 4 + 4 * x1;
+		row2 = in->rect_float + in->x * y2 * 4 + 4 * x1;
+		row3 = in->rect_float + in->x * y1 * 4 + 4 * x2;
+		row4 = in->rect_float + in->x * y2 * 4 + 4 * x2;
 
 		a = u - floorf(u);
 		b = v - floorf(v);

Modified: trunk/blender/source/blender/imbuf/intern/radiance_hdr.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/radiance_hdr.c	2012-08-02 11:29:32 UTC (rev 49499)
+++ trunk/blender/source/blender/imbuf/intern/radiance_hdr.c	2012-08-02 11:33:21 UTC (rev 49500)
@@ -213,7 +213,7 @@
 
 			/* read in and decode the actual data */
 			sline = (RGBE *)MEM_mallocN(sizeof(RGBE) * width, "radhdr_read_tmpscan");
-			rect_float = (float *)ibuf->rect_float;
+			rect_float = ibuf->rect_float;
 			
 			for (y = 0; y < height; y++) {
 				ptr = freadcolrs(sline, ptr, width);

Modified: trunk/blender/source/blender/imbuf/intern/scaling.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/scaling.c	2012-08-02 11:29:32 UTC (rev 49499)
+++ trunk/blender/source/blender/imbuf/intern/scaling.c	2012-08-02 11:33:21 UTC (rev 49500)
@@ -1313,7 +1313,7 @@
 			rect += 2 * skipx;
 		}
 		if (do_float) {
-			rectf = ((float *)ibuf->rect_float) + 4 * (x - 1);
+			rectf = ibuf->rect_float + 4 * (x - 1);
 			newrectf = _newrectf + 4 * (x - 1);
 
 			val_af = rectf[0];

Modified: trunk/blender/source/blender/render/intern/source/envmap.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/envmap.c	2012-08-02 11:29:32 UTC (rev 49499)
+++ trunk/blender/source/blender/render/intern/source/envmap.c	2012-08-02 11:33:21 UTC (rev 49500)
@@ -476,7 +476,7 @@
 				ibuf->profile = IB_PROFILE_LINEAR_RGB;
 			
 			/* envmap renders without alpha */
-			alpha = ((float *)ibuf->rect_float) + 3;
+			alpha = ibuf->rect_float + 3;
 			for (y = ibuf->x * ibuf->y - 1; y >= 0; y--, alpha += 4)
 				*alpha = 1.0;
 			




More information about the Bf-blender-cvs mailing list