mirror of
https://github.com/brl/mutter.git
synced 2025-02-18 14:14:10 +00:00
* 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.
This commit is contained in:
parent
a41624276c
commit
d0ab4856b5
@ -368,8 +368,8 @@ cogl_fixed_sin (CoglFixed angle)
|
|||||||
/* convert negative angle to positive + sign */
|
/* convert negative angle to positive + sign */
|
||||||
if ((int) angle < 0)
|
if ((int) angle < 0)
|
||||||
{
|
{
|
||||||
sign = 1 + ~sign;
|
sign = -sign;
|
||||||
angle = 1 + ~angle;
|
angle = -angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reduce to <0, 2*pi) */
|
/* reduce to <0, 2*pi) */
|
||||||
@ -378,7 +378,7 @@ cogl_fixed_sin (CoglFixed angle)
|
|||||||
/* reduce to first quadrant and sign */
|
/* reduce to first quadrant and sign */
|
||||||
if (angle > COGL_FIXED_PI)
|
if (angle > COGL_FIXED_PI)
|
||||||
{
|
{
|
||||||
sign = 1 + ~sign;
|
sign = -sign;
|
||||||
|
|
||||||
if (angle > COGL_FIXED_PI + COGL_FIXED_PI_2)
|
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));
|
angle = ((low * d2 + high * d1) / (COGL_SIN_STEP));
|
||||||
|
|
||||||
if (sign < 0)
|
if (sign < 0)
|
||||||
angle = (1 + ~angle);
|
angle = -angle;
|
||||||
|
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
@ -441,8 +441,8 @@ cogl_angle_sin (CoglAngle angle)
|
|||||||
/* reduce negative angle to positive + sign */
|
/* reduce negative angle to positive + sign */
|
||||||
if (angle < 0)
|
if (angle < 0)
|
||||||
{
|
{
|
||||||
sign = 1 + ~sign;
|
sign = -sign;
|
||||||
angle = 1 + ~angle;
|
angle = -angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reduce to <0, 2*pi) */
|
/* reduce to <0, 2*pi) */
|
||||||
@ -451,7 +451,7 @@ cogl_angle_sin (CoglAngle angle)
|
|||||||
/* reduce to first quadrant and sign */
|
/* reduce to first quadrant and sign */
|
||||||
if (angle > 512)
|
if (angle > 512)
|
||||||
{
|
{
|
||||||
sign = 1 + ~sign;
|
sign = -sign;
|
||||||
|
|
||||||
if (angle > 768)
|
if (angle > 768)
|
||||||
{
|
{
|
||||||
@ -476,7 +476,7 @@ cogl_angle_sin (CoglAngle angle)
|
|||||||
result = sin_tbl[angle];
|
result = sin_tbl[angle];
|
||||||
|
|
||||||
if (sign < 0)
|
if (sign < 0)
|
||||||
result = (1 + ~result);
|
result = -result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -490,8 +490,8 @@ cogl_angle_tan (CoglAngle angle)
|
|||||||
/* reduce negative angle to positive + sign */
|
/* reduce negative angle to positive + sign */
|
||||||
if (angle < 0)
|
if (angle < 0)
|
||||||
{
|
{
|
||||||
sign = 1 + ~sign;
|
sign = -sign;
|
||||||
angle = 1 + ~angle;
|
angle = -angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reduce to <0, pi) */
|
/* reduce to <0, pi) */
|
||||||
@ -500,14 +500,14 @@ cogl_angle_tan (CoglAngle angle)
|
|||||||
/* reduce to first quadrant and sign */
|
/* reduce to first quadrant and sign */
|
||||||
if (angle > 256)
|
if (angle > 256)
|
||||||
{
|
{
|
||||||
sign = 1 + ~sign;
|
sign = -sign;
|
||||||
angle = 512 - angle;
|
angle = 512 - angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = tan_tbl[angle];
|
result = tan_tbl[angle];
|
||||||
|
|
||||||
if (sign < 0)
|
if (sign < 0)
|
||||||
result = (1 + ~result);
|
result = -result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -655,7 +655,7 @@ cogl_fixed_sqrt (CoglFixed x)
|
|||||||
if (sh > 0)
|
if (sh > 0)
|
||||||
x = x << sh;
|
x = x << sh;
|
||||||
else if (sh < 0)
|
else if (sh < 0)
|
||||||
x = (x >> (1 + ~sh));
|
x = x >> -sh;
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +700,7 @@ cogl_perspective (CoglFixed fovy,
|
|||||||
M(1,1) = y;
|
M(1,1) = y;
|
||||||
M(2,2) = c;
|
M(2,2) = c;
|
||||||
M(2,3) = d;
|
M(2,3) = d;
|
||||||
M(3,2) = 1 + ~COGL_FIXED_1;
|
M(3,2) = -COGL_FIXED_1;
|
||||||
|
|
||||||
GE( cogl_wrap_glMultMatrixx (m) );
|
GE( cogl_wrap_glMultMatrixx (m) );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user