[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35891] trunk/blender/source/blender/ editors/space_sequencer: quiet gcc's float/double warnings.

Campbell Barton ideasman42 at gmail.com
Wed Mar 30 07:07:12 CEST 2011


Revision: 35891
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35891
Author:   campbellbarton
Date:     2011-03-30 05:07:12 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
quiet gcc's float/double warnings.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2011-03-30 04:58:45 UTC (rev 35890)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2011-03-30 05:07:12 UTC (rev 35891)
@@ -303,20 +303,20 @@
 	/* set up co-ordinates/dimensions for either left or right handle */
 	if (direction == SEQ_LEFTHANDLE) {	
 		rx1 = x1;
-		rx2 = x1+handsize*0.75;
+		rx2 = x1+handsize * 0.75f;
 		
-		v1[0]= x1+handsize/4; v1[1]= y1+( ((y1+y2)/2.0 - y1)/2);
-		v2[0]= x1+handsize/4; v2[1]= y2-( ((y1+y2)/2.0 - y1)/2);
-		v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0;
+		v1[0]= x1+handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2);
+		v2[0]= x1+handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2);
+		v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0f;
 		
 		whichsel = SEQ_LEFTSEL;
 	} else if (direction == SEQ_RIGHTHANDLE) {	
-		rx1 = x2-handsize*0.75;
+		rx1 = x2-handsize*0.75f;
 		rx2 = x2;
 		
-		v1[0]= x2-handsize/4; v1[1]= y1+( ((y1+y2)/2.0 - y1)/2);
-		v2[0]= x2-handsize/4; v2[1]= y2-( ((y1+y2)/2.0 - y1)/2);
-		v3[0]= v2[0] - handsize/4; v3[1]= (y1+y2)/2.0;
+		v1[0]= x2-handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2);
+		v2[0]= x2-handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2);
+		v3[0]= v2[0] - handsize/4; v3[1]= (y1+y2)/2.0f;
 		
 		whichsel = SEQ_RIGHTSEL;
 	}
@@ -351,11 +351,11 @@
 		if (direction == SEQ_LEFTHANDLE) {
 			sprintf(str, "%d", seq->startdisp);
 			x1= rx1;
-			y1 -= 0.45;
+			y1 -= 0.45f;
 		} else {
 			sprintf(str, "%d", seq->enddisp - 1);
-			x1= x2 - handsize*0.75;
-			y1= y2 + 0.05;
+			x1= x2 - handsize*0.75f;
+			y1= y2 + 0.05f;
 		}
 		UI_view2d_text_cache_add(v2d, x1, y1, str, col);
 	}	
@@ -441,7 +441,7 @@
 		
 		glColor3ubv((GLubyte *)col);
 		
-		for(a=y1; a< y2; a+= pixely*2.0 ) {
+		for(a=y1; a< y2; a+= pixely * 2.0f) {
 			fdrawline(x1,  a,  (float)(seq->start),  a);
 		}
 	}
@@ -459,7 +459,7 @@
 		
 		glColor3ubv((GLubyte *)col);
 		
-		for(a=y1; a< y2; a+= pixely*2.0 ) {
+		for(a=y1; a< y2; a+= pixely * 2.0f) {
 			fdrawline((float)(seq->start+seq->len),  a,  x2,  a);
 		}
 	}
@@ -541,8 +541,8 @@
 		glPolygonStipple(stipple_halftone);
 	}
 	
-	ymid1 = (y2-y1)*0.25 + y1;
-	ymid2 = (y2-y1)*0.65 + y1;
+	ymid1 = (y2-y1)*0.25f + y1;
+	ymid2 = (y2-y1)*0.65f + y1;
 	
 	glShadeModel(GL_SMOOTH);
 	glBegin(GL_QUADS);
@@ -719,8 +719,8 @@
 
 	if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
 		viewrectx *= scene->r.xasp / scene->r.yasp;
-		viewrectx /= proxy_size / 100.0;
-		viewrecty /= proxy_size / 100.0;
+		viewrectx /= proxy_size / 100.0f;
+		viewrecty /= proxy_size / 100.0f;
 	}
 
 	if(frame_ofs == 0) {
@@ -835,10 +835,10 @@
 		UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);
 
 		glBegin(GL_LINE_LOOP);
-		glVertex2f(x1-0.5, y1-0.5);
-		glVertex2f(x1-0.5, y2+0.5);
-		glVertex2f(x2+0.5, y2+0.5);
-		glVertex2f(x2+0.5, y1-0.5);
+		glVertex2f(x1-0.5f, y1-0.5f);
+		glVertex2f(x1-0.5f, y2+0.5f);
+		glVertex2f(x2+0.5f, y2+0.5f);
+		glVertex2f(x2+0.5f, y1-0.5f);
 		glEnd();
 
 		/* safety border */
@@ -968,7 +968,7 @@
 			else if (seq == last_seq) continue;
 			else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
 			else if (MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin) continue;
-			else if (seq->machine+1.0 < v2d->cur.ymin) continue;
+			else if (seq->machine+1.0f < v2d->cur.ymin) continue;
 			else if (seq->machine > v2d->cur.ymax) continue;
 			
 			/* strip passed all tests unscathed... so draw it now */
@@ -1022,9 +1022,9 @@
 	/* clear and setup matrix */
 	UI_GetThemeColor3fv(TH_BACK, col);
 	if (ed && ed->metastack.first) 
-		glClearColor(col[0], col[1], col[2]-0.1, 0.0);
+		glClearColor(col[0], col[1], col[2]-0.1f, 0.0f);
 	else 
-		glClearColor(col[0], col[1], col[2], 0.0);
+		glClearColor(col[0], col[1], col[2], 0.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	UI_view2d_view_ortho(v2d);

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c	2011-03-30 04:58:45 UTC (rev 35890)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c	2011-03-30 05:07:12 UTC (rev 35891)
@@ -42,16 +42,16 @@
 
 static void rgb_to_yuv(float rgb[3], float yuv[3]) 
 {
-		yuv[0]= 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
-		yuv[1]= 0.492*(rgb[2] - yuv[0]);
-		yuv[2]= 0.877*(rgb[0] - yuv[0]);
+		yuv[0]= 0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2];
+		yuv[1]= 0.492f*(rgb[2] - yuv[0]);
+		yuv[2]= 0.877f*(rgb[0] - yuv[0]);
 
 		/* Normalize */
-		yuv[1]*= 255.0/(122*2.0);
-		yuv[1]+= 0.5;
+		yuv[1]*= 255.0f/(122*2.0f);
+		yuv[1]+= 0.5f;
 
-		yuv[2]*= 255.0/(157*2.0);
-		yuv[2]+= 0.5;
+		yuv[2]*= 255.0f/(157*2.0f);
+		yuv[2]+= 0.5f;
 }
 
 static void scope_put_pixel(unsigned char* table, unsigned char * pos)
@@ -132,7 +132,7 @@
 {
 	int i;
 
-	tgt += (int) (perc/100.0 * h) * w * 4;
+	tgt += (int) (perc/100.0f * h) * w * 4;
 
 	for (i = 0; i < w*2; i++) {
 		tgt[0] = 255;
@@ -217,13 +217,13 @@
 
 		for (x = 0; x < ibuf->x; x++) {
 			float * rgb = src + 4 * (ibuf->x * y + x);
-			float v = 1.0 * 
-				(  0.299*rgb[0] 
-				 + 0.587*rgb[1] 
-				 + 0.114*rgb[2]);
+			float v = 1.0f *
+				(  0.299f*rgb[0]
+				 + 0.587f*rgb[1]
+				 + 0.114f*rgb[2]);
 			unsigned char * p = tgt;
 
-			CLAMP(v, 0.0, 1.0);
+			CLAMP(v, 0.0f, 1.0f);
 
 			p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
 
@@ -333,7 +333,7 @@
 				unsigned char * p = tgt;
 				float v = rgb[c];
 
-				CLAMP(v, 0.0, 1.0);
+				CLAMP(v, 0.0f, 1.0f);
 
 				p += 4 * (w * ((int) (v * (h - 3)) + 1)
 					  + c * sw + x/3 + 1);
@@ -367,7 +367,7 @@
 
 static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc)
 {
-	unsigned int limit = 255 * perc / 100.0;
+	unsigned int limit = 255.0f * perc / 100.0f;
 	unsigned char * p = (unsigned char*) src->rect;
 	unsigned char * o = (unsigned char*) ibuf->rect;
 	int x;
@@ -398,7 +398,7 @@
 
 static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc)
 {
-	float limit = perc / 100.0;
+	float limit = perc / 100.0f;
 	float * p = src->rect_float;
 	unsigned char * o = (unsigned char*) ibuf->rect;
 	int x;
@@ -456,7 +456,7 @@
 static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col)
 {
 	unsigned char * p = (unsigned char*) ibuf->rect;
-	int barh = ibuf->y * val * 0.9;
+	int barh = ibuf->y * val * 0.9f;
 	int i;
 
 	p += 4 * (x + ibuf->x);
@@ -513,13 +513,13 @@
 
 static int get_bin_float(float f)
 {
-	if (f < -0.25) {
-		f = -0.25;
-	} else if (f > 1.25) {
-		f = 1.25;
+	if (f < -0.25f) {
+		f = -0.25f;
+	} else if (f > 1.25f) {
+		f = 1.25f;
 	}
 
-	return (int) (((f + 0.25) / 1.5) * 512);
+	return (int) (((f + 0.25f) / 1.5f) * 512);
 }
 
 static struct ImBuf *make_histogram_view_from_ibuf_float(
@@ -582,9 +582,9 @@
 	int x = 0;
 	int y = 0;
 
-	rgb[0]= (float)r/255.0;
-	rgb[1]= (float)g/255.0;
-	rgb[2]= (float)b/255.0;
+	rgb[0]= (float)r/255.0f;
+	rgb[1]= (float)g/255.0f;
+	rgb[2]= (float)b/255.0f;
 	rgb_to_yuv(rgb, yuv);
 			
 	p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
@@ -633,9 +633,9 @@
 			char * src1 = src + 4 * (ibuf->x * y + x);
 			char * p;
 			
-			rgb[0]= (float)src1[0]/255.0;
-			rgb[1]= (float)src1[1]/255.0;
-			rgb[2]= (float)src1[2]/255.0;
+			rgb[0]= (float)src1[0]/255.0f;
+			rgb[1]= (float)src1[1]/255.0f;
+			rgb[2]= (float)src1[2]/255.0f;
 			rgb_to_yuv(rgb, yuv);
 			
 			p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
@@ -682,9 +682,9 @@
 			
 			memcpy(rgb, src1, 3 * sizeof(float));
 
-			CLAMP(rgb[0], 0.0, 1.0);
-			CLAMP(rgb[1], 0.0, 1.0);
-			CLAMP(rgb[2], 0.0, 1.0);
+			CLAMP(rgb[0], 0.0f, 1.0f);
+			CLAMP(rgb[1], 0.0f, 1.0f);
+			CLAMP(rgb[2], 0.0f, 1.0f);
 
 			rgb_to_yuv(rgb, yuv);
 			




More information about the Bf-blender-cvs mailing list