[Piglit] [PATCH 3/5] gl-1.0: Call piglit_ortho_projection from piglit_init.

Matt Turner mattst88 at gmail.com
Thu Sep 1 18:44:50 UTC 2016


In some cases we called it from piglit_display, and in others we had it
open-coded in a reshape function.
---
 tests/spec/gl-1.0/scissor-bitmap.c        |  2 +-
 tests/spec/gl-1.0/scissor-clear.c         | 17 +----------------
 tests/spec/gl-1.0/scissor-copypixels.c    |  3 +--
 tests/spec/gl-1.0/scissor-depth-clear.c   | 17 +----------------
 tests/spec/gl-1.0/scissor-many.c          | 17 +----------------
 tests/spec/gl-1.0/scissor-offscreen.c     |  3 +--
 tests/spec/gl-1.0/scissor-stencil-clear.c | 11 +----------
 7 files changed, 7 insertions(+), 63 deletions(-)

diff --git a/tests/spec/gl-1.0/scissor-bitmap.c b/tests/spec/gl-1.0/scissor-bitmap.c
index 001072f..b200bf2 100644
--- a/tests/spec/gl-1.0/scissor-bitmap.c
+++ b/tests/spec/gl-1.0/scissor-bitmap.c
@@ -157,7 +157,6 @@ piglit_display()
 	int start_x, start_y;
 	struct probes probes;
 	GLboolean pass = GL_TRUE;
-	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 
 	memset(&probes, 0, sizeof(probes));
 
@@ -305,4 +304,5 @@ void
 piglit_init(int argc, char **argv)
 {
 	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/spec/gl-1.0/scissor-clear.c b/tests/spec/gl-1.0/scissor-clear.c
index 2872581..dbc5c0a 100644
--- a/tests/spec/gl-1.0/scissor-clear.c
+++ b/tests/spec/gl-1.0/scissor-clear.c
@@ -71,23 +71,8 @@ piglit_display(void)
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void reshape(int width, int height)
-{
-	piglit_width = width;
-	piglit_height = height;
-
-	glViewport(0, 0, width, height);
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-
-	glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();
-}
-
 void
 piglit_init(int argc, char **argv)
 {
-	reshape(piglit_width, piglit_height);
+	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/spec/gl-1.0/scissor-copypixels.c b/tests/spec/gl-1.0/scissor-copypixels.c
index 568ac81..74da945 100644
--- a/tests/spec/gl-1.0/scissor-copypixels.c
+++ b/tests/spec/gl-1.0/scissor-copypixels.c
@@ -73,8 +73,6 @@ piglit_display(void)
 	int dst_x = piglit_width / 2 + 10, dst_y;
 	int dst_w = 10, dst_h = 10;
 
-	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-
 	/* whole window red */
 	glClearColor(1.0, 0.0, 0.0, 0.0);
 	glClear(GL_COLOR_BUFFER_BIT);
@@ -115,4 +113,5 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
+	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/spec/gl-1.0/scissor-depth-clear.c b/tests/spec/gl-1.0/scissor-depth-clear.c
index ac1de02..4bd17ea 100644
--- a/tests/spec/gl-1.0/scissor-depth-clear.c
+++ b/tests/spec/gl-1.0/scissor-depth-clear.c
@@ -89,23 +89,8 @@ piglit_display(void)
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void reshape(int width, int height)
-{
-	piglit_width = width;
-	piglit_height = height;
-
-	glViewport(0, 0, width, height);
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-
-	glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();
-}
-
 void
 piglit_init(int argc, char **argv)
 {
-	reshape(piglit_width, piglit_height);
+	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/spec/gl-1.0/scissor-many.c b/tests/spec/gl-1.0/scissor-many.c
index d581416..14762e3 100644
--- a/tests/spec/gl-1.0/scissor-many.c
+++ b/tests/spec/gl-1.0/scissor-many.c
@@ -69,23 +69,8 @@ piglit_display(void)
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void reshape(int width, int height)
-{
-	piglit_width = width;
-	piglit_height = height;
-
-	glViewport(0, 0, width, height);
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-
-	glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();
-}
-
 void
 piglit_init(int argc, char **argv)
 {
-	reshape(piglit_width, piglit_height);
+	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/spec/gl-1.0/scissor-offscreen.c b/tests/spec/gl-1.0/scissor-offscreen.c
index 96abf59..8f96180 100644
--- a/tests/spec/gl-1.0/scissor-offscreen.c
+++ b/tests/spec/gl-1.0/scissor-offscreen.c
@@ -50,8 +50,6 @@ piglit_display(void)
 	static const GLfloat window_color[] = { 1.0f, 1.0f, 1.0f, 1.0f };
 	GLboolean pass = GL_TRUE;
 
-	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-
 	/* Clear to white */
 	glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
@@ -81,4 +79,5 @@ piglit_display(void)
 void
 piglit_init(int argc, char**argv)
 {
+	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
diff --git a/tests/spec/gl-1.0/scissor-stencil-clear.c b/tests/spec/gl-1.0/scissor-stencil-clear.c
index 2ad0fbf..767020f 100644
--- a/tests/spec/gl-1.0/scissor-stencil-clear.c
+++ b/tests/spec/gl-1.0/scissor-stencil-clear.c
@@ -100,17 +100,8 @@ piglit_display(void)
 	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-
-static void reshape(int width, int height)
-{
-	piglit_width = width;
-	piglit_height = height;
-
-	piglit_ortho_projection(width, height, GL_FALSE);
-}
-
 void
 piglit_init(int argc, char **argv)
 {
-	reshape(piglit_width, piglit_height);
+	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
 }
-- 
2.7.3



More information about the Piglit mailing list