[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43561] trunk/blender/source/blender/ editors: quiet warnings for using uninialized color var in ED_image_draw_info().

Campbell Barton ideasman42 at gmail.com
Fri Jan 20 15:33:12 CET 2012


Revision: 43561
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43561
Author:   campbellbarton
Date:     2012-01-20 14:33:03 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
quiet warnings for using uninialized color var in ED_image_draw_info().

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_image.h
    trunk/blender/source/blender/editors/space_image/image_draw.c
    trunk/blender/source/blender/editors/space_image/image_ops.c
    trunk/blender/source/blender/editors/space_node/node_edit.c

Modified: trunk/blender/source/blender/editors/include/ED_image.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_image.h	2012-01-20 13:53:47 UTC (rev 43560)
+++ trunk/blender/source/blender/editors/include/ED_image.h	2012-01-20 14:33:03 UTC (rev 43561)
@@ -67,8 +67,8 @@
 /* UI level image (texture) updating... render calls own stuff (too) */
 void ED_image_update_frame(const struct Main *mainp, int cfra);
 
-void ED_image_draw_info(struct ARegion *ar, int color_manage, int channels,
-                        int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf);
+void ED_image_draw_info(struct ARegion *ar, int color_manage, int channels, int x, int y,
+                        const unsigned char cp[4], const float fp[4], int *zp, float *zpf);
 
 #endif /* ED_IMAGE_H */
 

Modified: trunk/blender/source/blender/editors/space_image/image_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_draw.c	2012-01-20 13:53:47 UTC (rev 43560)
+++ trunk/blender/source/blender/editors/space_image/image_draw.c	2012-01-20 14:33:03 UTC (rev 43561)
@@ -111,7 +111,8 @@
 }
 
 /* used by node view too */
-void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf)
+void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int y,
+                        const unsigned char cp[4], const float fp[4], int *zp, float *zpf)
 {
 	char str[256];
 	float dx= 6;
@@ -211,39 +212,46 @@
 	
 	/* color rectangle */
 	if (channels==1) {
-		if (fp)
+		if (fp) {
 			col[0] = col[1] = col[2] = fp[0];
-		else if (cp)
+		}
+		else if (cp) {
 			col[0] = col[1] = col[2] = (float)cp[0]/255.0f;
-		else
+		}
+		else {
 			col[0] = col[1] = col[2] = 0.0f;
+		}
+		col[3] = 1.0f;
 	}
 	else if (channels==3) {
-		if (fp)
+		if (fp) {
 			copy_v3_v3(col, fp);
+		}
 		else if (cp) {
-			col[0] = (float)cp[0]/255.0f;
-			col[1] = (float)cp[1]/255.0f;
-			col[2] = (float)cp[2]/255.0f;
+			rgb_uchar_to_float(col, cp);
 		}
-		else
+		else {
 			zero_v3(col);
+		}
+		col[3] = 1.0f;
 	}
 	else if (channels==4) {
 		if (fp)
 			copy_v4_v4(col, fp);
 		else if (cp) {
-			col[0] = (float)cp[0]/255.0f;
-			col[1] = (float)cp[1]/255.0f;
-			col[2] = (float)cp[2]/255.0f;
-			col[3] = (float)cp[3]/255.0f;
+			rgba_uchar_to_float(col, cp);
 		}
-		else
+		else {
 			zero_v4(col);
+		}
 	}
+	else {
+		BLI_assert(0);
+		zero_v4(col);
+	}
+
 	if (color_manage) {
-		linearrgb_to_srgb_v3_v3(finalcol, col);
-		finalcol[3] = col[3];
+		linearrgb_to_srgb_v4(finalcol, col);
 	}
 	else {
 		copy_v4_v4(finalcol, col);

Modified: trunk/blender/source/blender/editors/space_image/image_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_ops.c	2012-01-20 13:53:47 UTC (rev 43560)
+++ trunk/blender/source/blender/editors/space_image/image_ops.c	2012-01-20 14:33:03 UTC (rev 43561)
@@ -1780,12 +1780,12 @@
 	int x, y;
 	int channels;
 
-	char col[4];
+	unsigned char col[4];
 	float colf[4];
 	int z;
 	float zf;
 
-	char *colp;
+	unsigned char *colp;
 	float *colfp;
 	int *zp;
 	float *zfp;
@@ -1820,7 +1820,7 @@
 
 	if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
 		float *fp;
-		char *cp;
+		unsigned char *cp;
 		int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y);
 
 		CLAMP(x, 0, ibuf->x-1);
@@ -1837,7 +1837,7 @@
 		info->zfp= NULL;
 		
 		if(ibuf->rect) {
-			cp= (char *)(ibuf->rect + y*ibuf->x + x);
+			cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x);
 
 			info->col[0]= cp[0];
 			info->col[1]= cp[1];

Modified: trunk/blender/source/blender/editors/space_node/node_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_edit.c	2012-01-20 13:53:47 UTC (rev 43560)
+++ trunk/blender/source/blender/editors/space_node/node_edit.c	2012-01-20 14:33:03 UTC (rev 43561)
@@ -1334,7 +1334,7 @@
 	int channels;
 	int color_manage;
 
-	char col[4];
+	unsigned char col[4];
 	float colf[4];
 
 	int draw;




More information about the Bf-blender-cvs mailing list