summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2015-03-06 11:01:30 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2015-03-06 23:47:35 +0800
commitb3725a455ddd6ecca2e6cac55ac0ebd387f454e5 (patch)
tree3669f34d8076aa905af62c3f74f9b03ba4fff8ca
parent9c545ac2e89943eae98f3d0f782b25cb67cd2eb8 (diff)
downloadgtk+-b3725a455ddd6ecca2e6cac55ac0ebd387f454e5.tar.gz
test/gtkgears.c: Fix on C89 Compilers
Make sure that variables are declared at the top of the block. Break up one of the sincos() calls into individual calls to sin() and cos() so that we do not have to complicate the initialization of the following GLfloat array.
-rw-r--r--tests/gtkgears.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/gtkgears.c b/tests/gtkgears.c
index fe36bf4822..7a28071727 100644
--- a/tests/gtkgears.c
+++ b/tests/gtkgears.c
@@ -408,9 +408,9 @@ multiply (GLfloat *m, const GLfloat *n)
static void
rotate(GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
{
- double s, c;
+ double s = sin (angle);
+ double c = cos (angle);
- sincos(angle, &s, &c);
GLfloat r[16] = {
x * x * (1 - c) + c, y * x * (1 - c) + z * s, x * z * (1 - c) - y * s, 0,
x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0,
@@ -511,10 +511,9 @@ invert(GLfloat *m)
void perspective(GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
{
GLfloat tmp[16];
- identity(tmp);
-
double sine, cosine, cotangent, deltaZ;
GLfloat radians = fovy / 2 * M_PI / 180;
+ identity(tmp);
deltaZ = zFar - zNear;
sincos(radians, &sine, &cosine);