[Bf-blender-cvs] [67943af] master: glutil: use ints for drawing functions

Campbell Barton noreply at git.blender.org
Wed Oct 8 14:01:53 CEST 2014


Commit: 67943af47a8ded8fab73141f7e03f140bbe80b55
Author: Campbell Barton
Date:   Wed Oct 8 14:00:30 2014 +0200
Branches: master
https://developer.blender.org/rB67943af47a8ded8fab73141f7e03f140bbe80b55

glutil: use ints for drawing functions

shorts would wrap sometimes & many inputs were ints already.

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

M	source/blender/editors/include/BIF_glutil.h
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/screen/screen_edit.c

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

diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index b401f06..4272fd4 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -41,10 +41,12 @@ struct ColorManagedDisplaySettings;
 void fdrawbezier(float vec[4][3]);
 void fdrawline(float x1, float y1, float x2, float y2);
 void fdrawbox(float x1, float y1, float x2, float y2);
-void sdrawline(short x1, short y1, short x2, short y2);
-void sdrawtri(short x1, short y1, short x2, short y2);
-void sdrawtrifill(short x1, short y1, short x2, short y2);
-void sdrawbox(short x1, short y1, short x2, short y2);
+void sdrawline(int x1, int y1, int x2, int y2);
+#if 0
+void sdrawtri(int x1, int y1, int x2, int y2);
+void sdrawtrifill(int x1, int y1, int x2, int y2);
+#endif
+void sdrawbox(int x1, int y1, int x2, int y2);
 
 void sdrawXORline(int x0, int y0, int x1, int y1);
 void sdrawXORline4(int nr, int x0, int y0, int x1, int y1);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 0edde66..c095dfe 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -224,15 +224,15 @@ void fdrawcheckerboard(float x1, float y1, float x2, float y2)
 	glDisable(GL_POLYGON_STIPPLE);
 }
 
-void sdrawline(short x1, short y1, short x2, short y2)
+void sdrawline(int x1, int y1, int x2, int y2)
 {
-	short v[2];
+	int v[2];
 	
 	glBegin(GL_LINE_STRIP);
 	v[0] = x1; v[1] = y1;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	v[0] = x2; v[1] = y2;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	glEnd();
 }
 
@@ -246,25 +246,25 @@ void sdrawline(short x1, short y1, short x2, short y2)
  *     x1,y1-- x2,y1
  */
 
-static void sdrawtripoints(short x1, short y1, short x2, short y2)
+static void sdrawtripoints(int x1, int y1, int x2, int y2)
 {
-	short v[2];
+	int v[2];
 	v[0] = x1; v[1] = y1;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	v[0] = x1; v[1] = y2;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	v[0] = x2; v[1] = y1;
-	glVertex2sv(v);
+	glVertex2iv(v);
 }
 
-void sdrawtri(short x1, short y1, short x2, short y2)
+void sdrawtri(int x1, int y1, int x2, int y2)
 {
 	glBegin(GL_LINE_STRIP);
 	sdrawtripoints(x1, y1, x2, y2);
 	glEnd();
 }
 
-void sdrawtrifill(short x1, short y1, short x2, short y2)
+void sdrawtrifill(int x1, int y1, int x2, int y2)
 {
 	glBegin(GL_TRIANGLES);
 	sdrawtripoints(x1, y1, x2, y2);
@@ -272,22 +272,22 @@ void sdrawtrifill(short x1, short y1, short x2, short y2)
 }
 #endif
 
-void sdrawbox(short x1, short y1, short x2, short y2)
+void sdrawbox(int x1, int y1, int x2, int y2)
 {
-	short v[2];
+	int v[2];
 	
 	glBegin(GL_LINE_STRIP);
 	
 	v[0] = x1; v[1] = y1;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	v[0] = x1; v[1] = y2;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	v[0] = x2; v[1] = y2;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	v[0] = x2; v[1] = y1;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	v[0] = x1; v[1] = y1;
-	glVertex2sv(v);
+	glVertex2iv(v);
 	
 	glEnd();
 }
@@ -339,7 +339,7 @@ void sdrawXORline(int x0, int y0, int x1, int y1)
 
 void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
 {
-	static short old[4][2][2];
+	static int old[4][2][2];
 	static char flags[4] = {0, 0, 0, 0};
 	
 	/* with builtin memory, max 4 lines */
@@ -350,8 +350,8 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
 	if (nr == -1) { /* flush */
 		for (nr = 0; nr < 4; nr++) {
 			if (flags[nr]) {
-				glVertex2sv(old[nr][0]);
-				glVertex2sv(old[nr][1]);
+				glVertex2iv(old[nr][0]);
+				glVertex2iv(old[nr][1]);
 				flags[nr] = 0;
 			}
 		}
@@ -359,8 +359,8 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
 	else {
 		if (nr >= 0 && nr < 4) {
 			if (flags[nr]) {
-				glVertex2sv(old[nr][0]);
-				glVertex2sv(old[nr][1]);
+				glVertex2iv(old[nr][0]);
+				glVertex2iv(old[nr][1]);
 			}
 
 			old[nr][0][0] = x0;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 5beab9f..12236e3 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1009,7 +1009,7 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
 	glDisable(GL_BLEND);
 }
 
-static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, short a) 
+static void drawscredge_area_draw(int sizex, int sizey, int x1, int y1, int x2, int y2, int a)
 {
 	/* right border area */
 	if (x2 < sizex - 1)




More information about the Bf-blender-cvs mailing list