2007-10-01 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-fixed.h: Add CLUTTER_FIXED_TO_INT() and
	deprecate CLUTTER_FIXED_INT(), for symmetry with
	CLUTTER_FIXED_FROM_INT().

	* clutter/clutter-alpha.c:
	* clutter/clutter-behaviour-depth.c:
	* clutter/clutter-behaviour-ellipse.c:
	* clutter/clutter-behaviour-path.c:
	* clutter/clutter-fixed.h: Use CLUTTER_FIXED_TO_INT().
This commit is contained in:
Emmanuele Bassi 2007-10-02 14:53:32 +00:00
parent db0ed63c93
commit 4189c66a21
7 changed files with 42 additions and 17 deletions

View File

@ -1,3 +1,15 @@
2007-10-01 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-fixed.h: Add CLUTTER_FIXED_TO_INT() and
deprecate CLUTTER_FIXED_INT(), for symmetry with
CLUTTER_FIXED_FROM_INT().
* clutter/clutter-alpha.c:
* clutter/clutter-behaviour-depth.c:
* clutter/clutter-behaviour-ellipse.c:
* clutter/clutter-behaviour-path.c:
* clutter/clutter-fixed.h: Use CLUTTER_FIXED_TO_INT().
2007-10-01 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c (clutter_actor_get_size): Implement

View File

@ -543,7 +543,7 @@ sincx_func (ClutterAlpha *alpha,
CLUTTER_NOTE (ALPHA, "sine: %2f\n", CLUTTER_FIXED_TO_DOUBLE (sine));
return CLUTTER_FIXED_INT (sine * CLUTTER_ALPHA_MAX_ALPHA);
return CLUTTER_FIXED_TO_INT (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/* NB: angle is not in radians but in muliples of PI, i.e., 2.0

View File

@ -82,8 +82,9 @@ clutter_behaviour_depth_alpha_notify (ClutterBehaviour *behaviour,
/* Need to create factor as to avoid borking signedness */
factor = CLUTTER_INT_TO_FIXED (alpha_value) / CLUTTER_ALPHA_MAX_ALPHA;
depth = priv->start_depth +
CLUTTER_FIXED_INT(factor * (priv->end_depth - priv->start_depth));
depth = priv->start_depth
+ CLUTTER_FIXED_TO_INT (factor
* (priv->end_depth - priv->start_depth));
CLUTTER_NOTE (BEHAVIOUR, "alpha: %d, depth: %d", alpha_value, depth);

View File

@ -109,8 +109,8 @@ clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
ClutterBehaviourEllipsePrivate *priv = e->priv;
gint x, y, z;
x = CLUTTER_FIXED_INT (priv->a * clutter_cosi (angle));
y = CLUTTER_FIXED_INT (priv->b * clutter_sini (angle));
x = CLUTTER_FIXED_TO_INT (priv->a * clutter_cosi (angle));
y = CLUTTER_FIXED_TO_INT (priv->b * clutter_sini (angle));
z = 0;
if (priv->angle_tilt_z)
@ -131,8 +131,8 @@ clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
y2 = y * clutter_cosi (priv->angle_tilt_z)
+ x * clutter_sini (priv->angle_tilt_z);
x = CLUTTER_FIXED_INT (x2);
y = CLUTTER_FIXED_INT (y2);
x = CLUTTER_FIXED_TO_INT (x2);
y = CLUTTER_FIXED_TO_INT (y2);
}
if (priv->angle_tilt_x)
@ -143,8 +143,8 @@ clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
y2 = y * clutter_cosi (priv->angle_tilt_x);
z = CLUTTER_FIXED_INT (z2);
y = CLUTTER_FIXED_INT (y2);
z = CLUTTER_FIXED_TO_INT (z2);
y = CLUTTER_FIXED_TO_INT (y2);
}
if (priv->angle_tilt_y)
@ -157,8 +157,8 @@ clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
z2 = z * clutter_cosi (priv->angle_tilt_y)
+ x * clutter_sini (priv->angle_tilt_y);
x = CLUTTER_FIXED_INT (x2);
z = CLUTTER_FIXED_INT (z2);
x = CLUTTER_FIXED_TO_INT (x2);
z = CLUTTER_FIXED_TO_INT (z2);
}
knot->x = x;

View File

@ -103,8 +103,8 @@ interpolate (const ClutterKnot *begin,
ClutterKnot *out,
ClutterFixed t)
{
out->x = begin->x + CLUTTER_FIXED_INT (t * (end->x - begin->x));
out->y = begin->y + CLUTTER_FIXED_INT (t * (end->y - begin->y));
out->x = begin->x + CLUTTER_FIXED_TO_INT (t * (end->x - begin->x));
out->y = begin->y + CLUTTER_FIXED_TO_INT (t * (end->y - begin->y));
}
static gint

View File

@ -207,7 +207,7 @@ clutter_sinx (ClutterFixed angle)
* Handle the end of the table gracefully
*/
indx1 = CLUTTER_FIXED_DIV (angle, CFX_SIN_STEP);
indx1 = CLUTTER_FIXED_INT (indx1);
indx1 = CLUTTER_FIXED_TO_INT (indx1);
if (indx1 == sizeof (sin_tbl)/sizeof (ClutterFixed) - 1)
{
@ -573,7 +573,7 @@ clutter_sqrtx (ClutterFixed x)
}
else
{
t = CLUTTER_FIXED_INT (x);
t = CLUTTER_FIXED_TO_INT (x);
}
/* Do a weighted average of the two nearest values */

View File

@ -201,19 +201,31 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */
*/
#define CLUTTER_INT_TO_FIXED(x) ((x) << CFX_Q)
/**
* CLUTTER_FIXED_TO_INT:
* @x: a fixed point value
*
* Converts a fixed point value to integer (removing the decimal part).
*
* Since: 0.6
*/
#define CLUTTER_FIXED_TO_INT(x) ((x) >> CFX_Q)
/**
* CLUTTER_FIXED_INT:
* @x: a fixed point value
*
* Convert a fixed point value to integer (removing decimal part).
*
* Deprecated:0.6: Use %CLUTTER_FIXED_TO_INT instead
*/
#define CLUTTER_FIXED_INT(x) ((x) >> CFX_Q)
#define CLUTTER_FIXED_INT(x) CLUTTER_FIXED_TO_INT((x))
/**
* CLUTTER_FIXED_FRACTION:
* @x: a fixed point value
*
* FIXME
* Retrieves the fractionary part of a fixed point value
*/
#define CLUTTER_FIXED_FRACTION(x) ((x) & ((1 << CFX_Q) - 1))