[Automatic fixed-to-float.sh change] Applies all scripted changes
This is the result of running a number of sed and perl scripts over the code to do 90% of the work in converting from 16.16 fixed to single precision floating point. Note: A pristine cogl-fixed.c has been maintained as a standalone utility API so that applications may still take advantage of fixed point if they desire for certain optimisations where lower precision may be acceptable. Note: no API changes were made in Clutter, only in Cogl. Overview of changes: - Within clutter/* all usage of the COGL_FIXED_ macros have been changed to use the CLUTTER_FIXED_ macros. - Within cogl/* all usage of the COGL_FIXED_ macros have been completly stripped and expanded into code that works with single precision floats instead. - Uses of cogl_fixed_* have been replaced with single precision math.h alternatives. - Uses of COGL_ANGLE_* and cogl_angle_* have been replaced so we use a float for angles and math.h replacements.
This commit is contained in:
@ -108,8 +108,8 @@ ClutterFixed clamp_angle (ClutterFixed a)
|
||||
ClutterFixed a1, a2;
|
||||
gint rounds;
|
||||
|
||||
rounds = a / COGL_FIXED_360;
|
||||
a1 = rounds * COGL_FIXED_360;
|
||||
rounds = a / 360.0;
|
||||
a1 = rounds * 360.0;
|
||||
a2 = a - a1;
|
||||
|
||||
return a2;
|
||||
@ -126,7 +126,7 @@ clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
|
||||
rotate_behaviour = CLUTTER_BEHAVIOUR_ROTATE (behaviour);
|
||||
priv = rotate_behaviour->priv;
|
||||
|
||||
factor = COGL_FIXED_FROM_INT (alpha_value) / CLUTTER_ALPHA_MAX_ALPHA;
|
||||
factor = (float)(alpha_value) / CLUTTER_ALPHA_MAX_ALPHA;
|
||||
angle = 0;
|
||||
|
||||
start = priv->angle_start;
|
||||
@ -134,14 +134,14 @@ clutter_behaviour_rotate_alpha_notify (ClutterBehaviour *behaviour,
|
||||
|
||||
if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
|
||||
{
|
||||
end += COGL_FIXED_360;
|
||||
end += 360.0;
|
||||
}
|
||||
else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
|
||||
{
|
||||
end -= COGL_FIXED_360;
|
||||
end -= 360.0;
|
||||
}
|
||||
|
||||
angle = COGL_FIXED_FAST_MUL ((end - start), factor) + start;
|
||||
angle = CLUTTER_FIXED_MUL ((end - start), factor) + start;
|
||||
|
||||
clutter_behaviour_actors_foreach (behaviour,
|
||||
alpha_notify_foreach,
|
||||
@ -163,10 +163,10 @@ clutter_behaviour_rotate_set_property (GObject *gobject,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ANGLE_START:
|
||||
priv->angle_start = COGL_FIXED_FROM_FLOAT (g_value_get_double (value));
|
||||
priv->angle_start = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
||||
break;
|
||||
case PROP_ANGLE_END:
|
||||
priv->angle_end = COGL_FIXED_FROM_FLOAT (g_value_get_double (value));
|
||||
priv->angle_end = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
||||
break;
|
||||
case PROP_AXIS:
|
||||
priv->axis = g_value_get_enum (value);
|
||||
@ -211,10 +211,10 @@ clutter_behaviour_rotate_get_property (GObject *gobject,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ANGLE_START:
|
||||
g_value_set_double (value, COGL_FIXED_TO_DOUBLE (priv->angle_start));
|
||||
g_value_set_double (value, CLUTTER_FIXED_TO_DOUBLE (priv->angle_start));
|
||||
break;
|
||||
case PROP_ANGLE_END:
|
||||
g_value_set_double (value, COGL_FIXED_TO_DOUBLE (priv->angle_end));
|
||||
g_value_set_double (value, CLUTTER_FIXED_TO_DOUBLE (priv->angle_end));
|
||||
break;
|
||||
case PROP_AXIS:
|
||||
g_value_set_enum (value, priv->axis);
|
||||
@ -367,8 +367,8 @@ clutter_behaviour_rotate_init (ClutterBehaviourRotate *rotate)
|
||||
|
||||
rotate->priv = priv = CLUTTER_BEHAVIOUR_ROTATE_GET_PRIVATE (rotate);
|
||||
|
||||
priv->angle_start = COGL_FIXED_FROM_FLOAT (0.0);
|
||||
priv->angle_end = COGL_FIXED_FROM_FLOAT (0.0);
|
||||
priv->angle_start = CLUTTER_FLOAT_TO_FIXED (0.0);
|
||||
priv->angle_end = CLUTTER_FLOAT_TO_FIXED (0.0);
|
||||
priv->axis = CLUTTER_Z_AXIS;
|
||||
priv->direction = CLUTTER_ROTATE_CW;
|
||||
priv->center_x = priv->center_y = priv->center_z = 0;
|
||||
@ -568,10 +568,10 @@ clutter_behaviour_rotate_get_bounds (ClutterBehaviourRotate *rotate,
|
||||
priv = rotate->priv;
|
||||
|
||||
if (angle_start)
|
||||
*angle_start = COGL_FIXED_TO_DOUBLE (priv->angle_start);
|
||||
*angle_start = CLUTTER_FIXED_TO_DOUBLE (priv->angle_start);
|
||||
|
||||
if (angle_end)
|
||||
*angle_end = COGL_FIXED_TO_DOUBLE (priv->angle_end);
|
||||
*angle_end = CLUTTER_FIXED_TO_DOUBLE (priv->angle_end);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -593,8 +593,8 @@ clutter_behaviour_rotate_set_bounds (ClutterBehaviourRotate *rotate,
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate));
|
||||
|
||||
clutter_behaviour_rotate_set_boundsx (rotate,
|
||||
COGL_FIXED_FROM_FLOAT (angle_start),
|
||||
COGL_FIXED_FROM_FLOAT (angle_end));
|
||||
CLUTTER_FLOAT_TO_FIXED (angle_start),
|
||||
CLUTTER_FLOAT_TO_FIXED (angle_end));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user