From d0ab4856b50d47a3d0b5c4aded88bde37ff9662b Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 6 Nov 2008 11:42:11 +0000 Subject: [PATCH] * clutter/cogl/gles/cogl.c (cogl_perspective): * clutter/cogl/common/cogl-fixed.c (cogl_fixed_sin) (cogl_angle_sin, cogl_angle_tan, cogl_fixed_sqrt): Replaced uses of 1 + ~x with just -x which is equivalent and easier to understand. --- common/cogl-fixed.c | 26 +++++++++++++------------- gles/cogl.c | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/common/cogl-fixed.c b/common/cogl-fixed.c index 76a3b39f7..348d2ce28 100644 --- a/common/cogl-fixed.c +++ b/common/cogl-fixed.c @@ -368,8 +368,8 @@ cogl_fixed_sin (CoglFixed angle) /* convert negative angle to positive + sign */ if ((int) angle < 0) { - sign = 1 + ~sign; - angle = 1 + ~angle; + sign = -sign; + angle = -angle; } /* reduce to <0, 2*pi) */ @@ -378,7 +378,7 @@ cogl_fixed_sin (CoglFixed angle) /* reduce to first quadrant and sign */ if (angle > COGL_FIXED_PI) { - sign = 1 + ~sign; + sign = -sign; if (angle > COGL_FIXED_PI + COGL_FIXED_PI_2) { @@ -427,7 +427,7 @@ cogl_fixed_sin (CoglFixed angle) angle = ((low * d2 + high * d1) / (COGL_SIN_STEP)); if (sign < 0) - angle = (1 + ~angle); + angle = -angle; return angle; } @@ -441,8 +441,8 @@ cogl_angle_sin (CoglAngle angle) /* reduce negative angle to positive + sign */ if (angle < 0) { - sign = 1 + ~sign; - angle = 1 + ~angle; + sign = -sign; + angle = -angle; } /* reduce to <0, 2*pi) */ @@ -451,7 +451,7 @@ cogl_angle_sin (CoglAngle angle) /* reduce to first quadrant and sign */ if (angle > 512) { - sign = 1 + ~sign; + sign = -sign; if (angle > 768) { @@ -476,7 +476,7 @@ cogl_angle_sin (CoglAngle angle) result = sin_tbl[angle]; if (sign < 0) - result = (1 + ~result); + result = -result; return result; } @@ -490,8 +490,8 @@ cogl_angle_tan (CoglAngle angle) /* reduce negative angle to positive + sign */ if (angle < 0) { - sign = 1 + ~sign; - angle = 1 + ~angle; + sign = -sign; + angle = -angle; } /* reduce to <0, pi) */ @@ -500,14 +500,14 @@ cogl_angle_tan (CoglAngle angle) /* reduce to first quadrant and sign */ if (angle > 256) { - sign = 1 + ~sign; + sign = -sign; angle = 512 - angle; } result = tan_tbl[angle]; if (sign < 0) - result = (1 + ~result); + result = -result; return result; } @@ -655,7 +655,7 @@ cogl_fixed_sqrt (CoglFixed x) if (sh > 0) x = x << sh; else if (sh < 0) - x = (x >> (1 + ~sh)); + x = x >> -sh; return x; } diff --git a/gles/cogl.c b/gles/cogl.c index 7e13e0db0..16b8441ef 100644 --- a/gles/cogl.c +++ b/gles/cogl.c @@ -700,7 +700,7 @@ cogl_perspective (CoglFixed fovy, M(1,1) = y; M(2,2) = c; M(2,3) = d; - M(3,2) = 1 + ~COGL_FIXED_1; + M(3,2) = -COGL_FIXED_1; GE( cogl_wrap_glMultMatrixx (m) );