Commit e82f6565 authored by Robert Bragg's avatar Robert Bragg

[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.
parent abc2a359
......@@ -774,12 +774,12 @@ clutter_actor_real_allocate (ClutterActor *self,
g_object_thaw_notify (G_OBJECT (self));
}
/* like ClutterVertex, but using CoglFixed and with a w component */
/* like ClutterVertex, but using float and with a w component */
typedef struct {
CoglFixed x;
CoglFixed y;
CoglFixed z;
CoglFixed w;
float x;
float y;
float z;
float w;
} fixed_vertex_t;
/* copies a fixed vertex into a ClutterVertex */
......@@ -816,25 +816,25 @@ mtx_transform (const ClutterFixed m[],
/* We care lot about precision here, so have to use MUL instead
* of FAST_MUL
*/
vertex->x = COGL_FIXED_MUL (M (m, 0, 0), _x)
+ COGL_FIXED_MUL (M (m, 0, 1), _y)
+ COGL_FIXED_MUL (M (m, 0, 2), _z)
+ COGL_FIXED_MUL (M (m, 0, 3), _w);
vertex->y = COGL_FIXED_MUL (M (m, 1, 0), _x)
+ COGL_FIXED_MUL (M (m, 1, 1), _y)
+ COGL_FIXED_MUL (M (m, 1, 2), _z)
+ COGL_FIXED_MUL (M (m, 1, 3), _w);
vertex->z = COGL_FIXED_MUL (M (m, 2, 0), _x)
+ COGL_FIXED_MUL (M (m, 2, 1), _y)
+ COGL_FIXED_MUL (M (m, 2, 2), _z)
+ COGL_FIXED_MUL (M (m, 2, 3), _w);
vertex->w = COGL_FIXED_MUL (M (m, 3, 0), _x)
+ COGL_FIXED_MUL (M (m, 3, 1), _y)
+ COGL_FIXED_MUL (M (m, 3, 2), _z)
+ COGL_FIXED_MUL (M (m, 3, 3), _w);
vertex->x = CLUTTER_FIXED_MUL (M (m, 0, 0), _x)
+ CLUTTER_FIXED_MUL (M (m, 0, 1), _y)
+ CLUTTER_FIXED_MUL (M (m, 0, 2), _z)
+ CLUTTER_FIXED_MUL (M (m, 0, 3), _w);
vertex->y = CLUTTER_FIXED_MUL (M (m, 1, 0), _x)
+ CLUTTER_FIXED_MUL (M (m, 1, 1), _y)
+ CLUTTER_FIXED_MUL (M (m, 1, 2), _z)
+ CLUTTER_FIXED_MUL (M (m, 1, 3), _w);
vertex->z = CLUTTER_FIXED_MUL (M (m, 2, 0), _x)
+ CLUTTER_FIXED_MUL (M (m, 2, 1), _y)
+ CLUTTER_FIXED_MUL (M (m, 2, 2), _z)
+ CLUTTER_FIXED_MUL (M (m, 2, 3), _w);
vertex->w = CLUTTER_FIXED_MUL (M (m, 3, 0), _x)
+ CLUTTER_FIXED_MUL (M (m, 3, 1), _y)
+ CLUTTER_FIXED_MUL (M (m, 3, 2), _z)
+ CLUTTER_FIXED_MUL (M (m, 3, 3), _w);
/* Specially for Matthew: was going to put a comment here, but could not
* think of anything at all to say ;)
......@@ -846,8 +846,8 @@ mtx_transform (const ClutterFixed m[],
/* Help macros to scale from OpenGL <-1,1> coordinates system to our
* X-window based <0,window-size> coordinates
*/
#define MTX_GL_SCALE_X(x,w,v1,v2) (COGL_FIXED_MUL (((COGL_FIXED_DIV ((x), (w)) + COGL_FIXED_1) >> 1), (v1)) + (v2))
#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - COGL_FIXED_MUL (((COGL_FIXED_DIV ((y), (w)) + COGL_FIXED_1) >> 1), (v1)) + (v2))
#define MTX_GL_SCALE_X(x,w,v1,v2) (CLUTTER_FIXED_MUL (((CLUTTER_FIXED_DIV ((x), (w)) + 1.0) >> 1), (v1)) + (v2))
#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - CLUTTER_FIXED_MUL (((CLUTTER_FIXED_DIV ((y), (w)) + 1.0) >> 1), (v1)) + (v2))
#define MTX_GL_SCALE_Z(z,w,v1,v2) (MTX_GL_SCALE_X ((z), (w), (v1), (v2)))
/* transforms a 4-tuple of coordinates using @matrix and
......@@ -1024,7 +1024,7 @@ clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
x = CLUTTER_UNITS_TO_FIXED (vertex->x);
y = CLUTTER_UNITS_TO_FIXED (vertex->y);
z = CLUTTER_UNITS_TO_FIXED (vertex->z);
w = COGL_FIXED_1;
w = 1.0;
/* First we tranform the point using the OpenGL modelview matrix */
clutter_actor_transform_point_relative (self, ancestor, &x, &y, &z, &w);
......@@ -1035,9 +1035,9 @@ clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
* The w[3] parameter should always be 1.0 here, so we ignore it; otherwise
* we would have to divide the original verts with it.
*/
tmp.x = COGL_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (x) + COGL_FIXED_0_5, v[2]);
tmp.y = COGL_FIXED_MUL (COGL_FIXED_0_5 - CLUTTER_UNITS_TO_FIXED (y), v[3]);
tmp.z = COGL_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (z) + COGL_FIXED_0_5, v[2]);
tmp.x = CLUTTER_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (x) + 0.5, v[2]);
tmp.y = CLUTTER_FIXED_MUL (0.5 - CLUTTER_UNITS_TO_FIXED (y), v[3]);
tmp.z = CLUTTER_FIXED_MUL (CLUTTER_UNITS_TO_FIXED (z) + 0.5, v[2]);
tmp.w = 0;
fixed_vertex_to_units (&tmp, vertex);
......@@ -1119,10 +1119,10 @@ clutter_actor_transform_vertices_relative (ClutterActor *self,
cogl_get_modelview_matrix (mtx);
fixed_vertex_transform (mtx, 0, 0, 0, COGL_FIXED_1, &vertices[0]);
fixed_vertex_transform (mtx, width, 0, 0, COGL_FIXED_1, &vertices[1]);
fixed_vertex_transform (mtx, 0, height, 0, COGL_FIXED_1, &vertices[2]);
fixed_vertex_transform (mtx, width, height, 0, COGL_FIXED_1, &vertices[3]);
fixed_vertex_transform (mtx, 0, 0, 0, 1.0, &vertices[0]);
fixed_vertex_transform (mtx, width, 0, 0, 1.0, &vertices[1]);
fixed_vertex_transform (mtx, 0, height, 0, 1.0, &vertices[2]);
fixed_vertex_transform (mtx, width, height, 0, 1.0, &vertices[3]);
cogl_pop_matrix();
}
......@@ -1171,10 +1171,10 @@ clutter_actor_transform_and_project_box (ClutterActor *self,
cogl_get_modelview_matrix (mtx);
fixed_vertex_transform (mtx, 0, 0, 0, COGL_FIXED_1, &vertices[0]);
fixed_vertex_transform (mtx, width, 0, 0, COGL_FIXED_1, &vertices[1]);
fixed_vertex_transform (mtx, 0, height, 0, COGL_FIXED_1, &vertices[2]);
fixed_vertex_transform (mtx, width, height, 0, COGL_FIXED_1, &vertices[3]);
fixed_vertex_transform (mtx, 0, 0, 0, 1.0, &vertices[0]);
fixed_vertex_transform (mtx, width, 0, 0, 1.0, &vertices[1]);
fixed_vertex_transform (mtx, 0, height, 0, 1.0, &vertices[2]);
fixed_vertex_transform (mtx, width, height, 0, 1.0, &vertices[3]);
cogl_pop_matrix();
......@@ -1261,24 +1261,24 @@ clutter_actor_get_allocation_vertices (ClutterActor *self,
* The w[3] parameter should always be 1.0 here, so we ignore it;
* otherwise we would have to divide the original verts with it.
*/
tmp.x = COGL_FIXED_MUL ((vertices[0].x + COGL_FIXED_0_5), v[2]);
tmp.y = COGL_FIXED_MUL ((COGL_FIXED_0_5 - vertices[0].y), v[3]);
tmp.z = COGL_FIXED_MUL ((vertices[0].z + COGL_FIXED_0_5), v[2]);
tmp.x = CLUTTER_FIXED_MUL ((vertices[0].x + 0.5), v[2]);
tmp.y = CLUTTER_FIXED_MUL ((0.5 - vertices[0].y), v[3]);
tmp.z = CLUTTER_FIXED_MUL ((vertices[0].z + 0.5), v[2]);
fixed_vertex_to_units (&tmp, &verts[0]);
tmp.x = COGL_FIXED_MUL ((vertices[1].x + COGL_FIXED_0_5), v[2]);
tmp.y = COGL_FIXED_MUL ((COGL_FIXED_0_5 - vertices[1].y), v[3]);
tmp.z = COGL_FIXED_MUL ((vertices[1].z + COGL_FIXED_0_5), v[2]);
tmp.x = CLUTTER_FIXED_MUL ((vertices[1].x + 0.5), v[2]);
tmp.y = CLUTTER_FIXED_MUL ((0.5 - vertices[1].y), v[3]);
tmp.z = CLUTTER_FIXED_MUL ((vertices[1].z + 0.5), v[2]);
fixed_vertex_to_units (&tmp, &verts[1]);
tmp.x = COGL_FIXED_MUL ((vertices[2].x + COGL_FIXED_0_5), v[2]);
tmp.y = COGL_FIXED_MUL ((COGL_FIXED_0_5 - vertices[2].y), v[3]);
tmp.z = COGL_FIXED_MUL ((vertices[2].z + COGL_FIXED_0_5), v[2]);
tmp.x = CLUTTER_FIXED_MUL ((vertices[2].x + 0.5), v[2]);
tmp.y = CLUTTER_FIXED_MUL ((0.5 - vertices[2].y), v[3]);
tmp.z = CLUTTER_FIXED_MUL ((vertices[2].z + 0.5), v[2]);
fixed_vertex_to_units (&tmp, &verts[2]);
tmp.x = COGL_FIXED_MUL ((vertices[3].x + COGL_FIXED_0_5), v[2]);
tmp.y = COGL_FIXED_MUL ((COGL_FIXED_0_5 - vertices[3].y), v[3]);
tmp.z = COGL_FIXED_MUL ((vertices[3].z + COGL_FIXED_0_5), v[2]);
tmp.x = CLUTTER_FIXED_MUL ((vertices[3].x + 0.5), v[2]);
tmp.y = CLUTTER_FIXED_MUL ((0.5 - vertices[3].y), v[3]);
tmp.z = CLUTTER_FIXED_MUL ((vertices[3].z + 0.5), v[2]);
fixed_vertex_to_units (&tmp, &verts[3]);
}
......@@ -1355,7 +1355,7 @@ _clutter_actor_apply_modelview_transform (ClutterActor *self)
* the translations included in the rotation are not scaled and so the
* entire object will move on the screen as a result of rotating it).
*/
if (priv->scale_x != COGL_FIXED_1 || priv->scale_y != COGL_FIXED_1)
if (priv->scale_x != 1.0 || priv->scale_y != 1.0)
cogl_scale (priv->scale_x, priv->scale_y);
if (priv->rzang)
......@@ -1364,7 +1364,7 @@ _clutter_actor_apply_modelview_transform (ClutterActor *self)
CLUTTER_UNITS_TO_FIXED (priv->rzy),
0);
cogl_rotatex (priv->rzang, 0, 0, COGL_FIXED_1);
cogl_rotatex (priv->rzang, 0, 0, 1.0);
cogl_translatex (CLUTTER_UNITS_TO_FIXED (-priv->rzx),
CLUTTER_UNITS_TO_FIXED (-priv->rzy),
......@@ -1377,7 +1377,7 @@ _clutter_actor_apply_modelview_transform (ClutterActor *self)
0,
CLUTTER_UNITS_TO_FIXED (priv->z + priv->ryz));
cogl_rotatex (priv->ryang, 0, COGL_FIXED_1, 0);
cogl_rotatex (priv->ryang, 0, 1.0, 0);
cogl_translatex (CLUTTER_UNITS_TO_FIXED (-priv->ryx),
0,
......@@ -1390,7 +1390,7 @@ _clutter_actor_apply_modelview_transform (ClutterActor *self)
CLUTTER_UNITS_TO_FIXED (priv->rxy),
CLUTTER_UNITS_TO_FIXED (priv->z + priv->rxz));
cogl_rotatex (priv->rxang, COGL_FIXED_1, 0, 0);
cogl_rotatex (priv->rxang, 1.0, 0, 0);
cogl_translatex (0,
CLUTTER_UNITS_TO_FIXED (-priv->rxy),
......@@ -1656,14 +1656,14 @@ clutter_actor_set_property (GObject *object,
case PROP_SCALE_X:
clutter_actor_set_scalex
(actor,
COGL_FIXED_FROM_FLOAT (g_value_get_double (value)),
CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value)),
priv->scale_y);
break;
case PROP_SCALE_Y:
clutter_actor_set_scalex
(actor,
priv->scale_x,
COGL_FIXED_FROM_FLOAT (g_value_get_double (value)));
CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value)));
break;
case PROP_CLIP:
{
......@@ -1681,7 +1681,7 @@ clutter_actor_set_property (GObject *object,
{
ClutterFixed angle;
angle = COGL_FIXED_FROM_FLOAT (g_value_get_double (value));
angle = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
clutter_actor_set_rotation_internal (actor,
CLUTTER_X_AXIS,
angle,
......@@ -1694,7 +1694,7 @@ clutter_actor_set_property (GObject *object,
{
ClutterFixed angle;
angle = COGL_FIXED_FROM_FLOAT (g_value_get_double (value));
angle = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
clutter_actor_set_rotation_internal (actor,
CLUTTER_Y_AXIS,
angle,
......@@ -1707,7 +1707,7 @@ clutter_actor_set_property (GObject *object,
{
ClutterFixed angle;
angle = COGL_FIXED_FROM_FLOAT (g_value_get_double (value));
angle = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
clutter_actor_set_rotation_internal (actor,
CLUTTER_Z_AXIS,
angle,
......@@ -1877,22 +1877,22 @@ clutter_actor_get_property (GObject *object,
}
break;
case PROP_SCALE_X:
g_value_set_double (value, COGL_FIXED_TO_DOUBLE (priv->scale_x));
g_value_set_double (value, CLUTTER_FIXED_TO_DOUBLE (priv->scale_x));
break;
case PROP_SCALE_Y:
g_value_set_double (value, COGL_FIXED_TO_DOUBLE (priv->scale_y));
g_value_set_double (value, CLUTTER_FIXED_TO_DOUBLE (priv->scale_y));
break;
case PROP_REACTIVE:
g_value_set_boolean (value, clutter_actor_get_reactive (actor));
break;
case PROP_ROTATION_ANGLE_X:
g_value_set_double (value, COGL_FIXED_TO_DOUBLE (priv->rxang));
g_value_set_double (value, CLUTTER_FIXED_TO_DOUBLE (priv->rxang));
break;
case PROP_ROTATION_ANGLE_Y:
g_value_set_double (value, COGL_FIXED_TO_DOUBLE (priv->ryang));
g_value_set_double (value, CLUTTER_FIXED_TO_DOUBLE (priv->ryang));
break;
case PROP_ROTATION_ANGLE_Z:
g_value_set_double (value, COGL_FIXED_TO_DOUBLE (priv->rzang));
g_value_set_double (value, CLUTTER_FIXED_TO_DOUBLE (priv->rzang));
break;
case PROP_ROTATION_CENTER_X:
{
......@@ -3020,8 +3020,8 @@ clutter_actor_init (ClutterActor *self)
priv->has_clip = FALSE;
priv->opacity = 0xff;
priv->id = clutter_id_pool_add (CLUTTER_CONTEXT()->id_pool, self);
priv->scale_x = COGL_FIXED_1;
priv->scale_y = COGL_FIXED_1;
priv->scale_x = 1.0;
priv->scale_y = 1.0;
priv->shader_data = NULL;
priv->show_on_set_parent = TRUE;
......@@ -4916,8 +4916,8 @@ clutter_actor_set_scale (ClutterActor *self,
g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_set_scalex (self,
COGL_FIXED_FROM_FLOAT (scale_x),
COGL_FIXED_FROM_FLOAT (scale_y));
CLUTTER_FLOAT_TO_FIXED (scale_x),
CLUTTER_FLOAT_TO_FIXED (scale_y));
}
/**
......@@ -4964,10 +4964,10 @@ clutter_actor_get_scale (ClutterActor *self,
g_return_if_fail (CLUTTER_IS_ACTOR (self));
if (scale_x)
*scale_x = COGL_FIXED_TO_FLOAT (self->priv->scale_x);
*scale_x = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_x);
if (scale_y)
*scale_y = COGL_FIXED_TO_FLOAT (self->priv->scale_y);
*scale_y = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_y);
}
/**
......@@ -5224,7 +5224,7 @@ clutter_actor_set_rotationu (ClutterActor *self,
g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_set_rotation_internal (self, axis,
COGL_FIXED_FROM_FLOAT (angle),
CLUTTER_FLOAT_TO_FIXED (angle),
x, y, z);
}
......@@ -5294,7 +5294,7 @@ clutter_actor_set_rotation (ClutterActor *self,
g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_set_rotationx (self, axis,
COGL_FIXED_FROM_FLOAT (angle),
CLUTTER_FLOAT_TO_FIXED (angle),
x, y, z);
}
......@@ -5335,7 +5335,7 @@ clutter_actor_get_rotationu (ClutterActor *self,
switch (axis)
{
case CLUTTER_X_AXIS:
retval = COGL_FIXED_TO_DOUBLE (priv->rxang);
retval = CLUTTER_FIXED_TO_DOUBLE (priv->rxang);
if (y)
*y = priv->rxy;
if (z)
......@@ -5343,7 +5343,7 @@ clutter_actor_get_rotationu (ClutterActor *self,
break;
case CLUTTER_Y_AXIS:
retval = COGL_FIXED_TO_DOUBLE (priv->ryang);
retval = CLUTTER_FIXED_TO_DOUBLE (priv->ryang);
if (x)
*x = priv->ryx;
if (z)
......@@ -5351,7 +5351,7 @@ clutter_actor_get_rotationu (ClutterActor *self,
break;
case CLUTTER_Z_AXIS:
retval = COGL_FIXED_TO_DOUBLE (priv->rzang);
retval = CLUTTER_FIXED_TO_DOUBLE (priv->rzang);
if (x)
*x = priv->rzx;
if (y)
......@@ -5450,7 +5450,7 @@ clutter_actor_get_rotation (ClutterActor *self,
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.0);
return COGL_FIXED_TO_FLOAT (clutter_actor_get_rotationx (self,
return CLUTTER_FIXED_TO_FLOAT (clutter_actor_get_rotationx (self,
axis,
x, y, z));
}
......@@ -6612,7 +6612,7 @@ parse_rotation_array (ClutterActor *actor,
/* angle */
element = json_array_get_element (array, 0);
if (JSON_NODE_TYPE (element) == JSON_NODE_VALUE)
info->angle = COGL_FIXED_FROM_FLOAT (json_node_get_double (element));
info->angle = CLUTTER_FLOAT_TO_FIXED (json_node_get_double (element));
else
return FALSE;
......@@ -6918,12 +6918,12 @@ clutter_actor_transform_stage_point (ClutterActor *self,
if (!du || !dv)
return FALSE;
#define FP2FX COGL_FIXED_FROM_FLOAT
#define FX2FP COGL_FIXED_TO_DOUBLE
#define FP2FX CLUTTER_FLOAT_TO_FIXED
#define FX2FP CLUTTER_FIXED_TO_DOUBLE
#define UX2FP CLUTTER_UNITS_TO_FLOAT
#define UX2FX CLUTTER_UNITS_TO_FIXED
#define FP2INT CLUTTER_FLOAT_TO_INT
#define DET2X(a,b,c,d) (COGL_FIXED_MUL ((a), (d)) - COGL_FIXED_MUL ((b), (c)))
#define DET2X(a,b,c,d) ((a * d) - (b * c))
#define DET2FP(a,b,c,d) ((a) * (d) - (b) * (c))
/*
......@@ -6946,7 +6946,7 @@ clutter_actor_transform_stage_point (ClutterActor *self,
RQ[2][1] = UX2FX (v[0].y);
RQ[0][2] = 0;
RQ[1][2] = 0;
RQ[2][2] = COGL_FIXED_1;
RQ[2][2] = 1.0;
}
else
{
......@@ -6976,16 +6976,16 @@ clutter_actor_transform_stage_point (ClutterActor *self,
RQ[0][2] = FP2FX (DET2FP (UX2FP (px), dx2, UX2FP (py), dy2) / del);
RQ[1][2] = FP2FX (DET2FP (dx1, UX2FP (px), dy1, UX2FP (py)) / del);
RQ[1][2] = FP2FX (DET2FP (dx1, UX2FP (px), dy1, UX2FP (py)) / del);
RQ[2][2] = COGL_FIXED_1;
RQ[2][2] = 1.0;
RQ[0][0] = UX2FX (v[1].x - v[0].x)
+ COGL_FIXED_MUL (RQ[0][2], UX2FX (v[1].x));
+ CLUTTER_FIXED_MUL (RQ[0][2], UX2FX (v[1].x));
RQ[1][0] = UX2FX (v[2].x - v[0].x)
+ COGL_FIXED_MUL (RQ[1][2], UX2FX (v[2].x));
+ CLUTTER_FIXED_MUL (RQ[1][2], UX2FX (v[2].x));
RQ[2][0] = UX2FX (v[0].x);
RQ[0][1] = UX2FX (v[1].y - v[0].y)
+ COGL_FIXED_MUL (RQ[0][2], UX2FX (v[1].y));
+ CLUTTER_FIXED_MUL (RQ[0][2], UX2FX (v[1].y));
RQ[1][1] = UX2FX (v[2].y - v[0].y)
+ COGL_FIXED_MUL (RQ[1][2], UX2FX (v[2].y));
+ CLUTTER_FIXED_MUL (RQ[1][2], UX2FX (v[2].y));
RQ[2][1] = UX2FX (v[0].y);
}
......@@ -7017,9 +7017,9 @@ clutter_actor_transform_stage_point (ClutterActor *self,
/*
* Check the resutling martix is OK.
*/
det = COGL_FIXED_MUL (RQ[0][0], ST[0][0])
+ COGL_FIXED_MUL (RQ[0][1], ST[0][1])
+ COGL_FIXED_MUL (RQ[0][2], ST[0][2]);
det = CLUTTER_FIXED_MUL (RQ[0][0], ST[0][0])
+ CLUTTER_FIXED_MUL (RQ[0][1], ST[0][1])
+ CLUTTER_FIXED_MUL (RQ[0][2], ST[0][2]);
if (!det)
return FALSE;
......@@ -7481,7 +7481,7 @@ clutter_actor_is_scaled (ClutterActor *self)
priv = self->priv;
if (priv->scale_x != COGL_FIXED_1 || priv->scale_y != COGL_FIXED_1)
if (priv->scale_x != 1.0 || priv->scale_y != 1.0)
return TRUE;
return FALSE;
......
......@@ -699,12 +699,12 @@ clutter_ramp_func (ClutterAlpha *alpha,
static guint32
sincx1024_func (ClutterAlpha *alpha,
ClutterAngle angle,
float angle,
ClutterFixed offset)
{
ClutterTimeline *timeline;
gint current_frame_num, n_frames;
ClutterAngle x;
float x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
......@@ -716,7 +716,7 @@ sincx1024_func (ClutterAlpha *alpha,
x -= (512 * 512 / angle);
sine = ((cogl_angle_sin (x) + offset) / 2)
sine = ((sinf (x * (G_PI/180.0)) + offset) / 2)
* CLUTTER_ALPHA_MAX_ALPHA;
sine = sine >> COGL_FIXED_Q;
......@@ -744,14 +744,14 @@ sincx_func (ClutterAlpha *alpha,
n_frames = clutter_timeline_get_n_frames (timeline);
x = angle * current_frame_num / n_frames;
x = COGL_FIXED_FAST_MUL (x, COGL_FIXED_PI)
- COGL_FIXED_FAST_DIV (COGL_FIXED_PI, angle);
x = CLUTTER_FIXED_MUL (x, CFX_PI)
- CLUTTER_FIXED_DIV (CFX_PI, angle);
sine = (cogl_fixed_sin (x) + offset) / 2;
sine = (sinf (x) + offset) / 2;
CLUTTER_NOTE (ALPHA, "sine: %2f\n", COGL_FIXED_TO_DOUBLE (sine));
CLUTTER_NOTE (ALPHA, "sine: %2f\n", CLUTTER_FIXED_TO_DOUBLE (sine));
return COGL_FIXED_TO_INT (sine * CLUTTER_ALPHA_MAX_ALPHA);
return (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/* NB: angle is not in radians but in muliples of PI, i.e., 2.0
......@@ -810,7 +810,7 @@ clutter_sine_func (ClutterAlpha *alpha,
return sinc_func (alpha, 2.0, 1.0);
#else
/* 2.0 above represents full circle */
return sincx1024_func (alpha, 1024, COGL_FIXED_1);
return sincx1024_func (alpha, 1024, 1.0);
#endif
}
......@@ -842,7 +842,7 @@ clutter_sine_inc_func (ClutterAlpha *alpha,
ClutterTimeline * timeline;
gint frame;
gint n_frames;
ClutterAngle x;
float x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
......@@ -851,7 +851,7 @@ clutter_sine_inc_func (ClutterAlpha *alpha,
x = 256 * frame / n_frames;
sine = cogl_angle_sin (x) * CLUTTER_ALPHA_MAX_ALPHA;
sine = sinf (x * (G_PI/180.0)) * CLUTTER_ALPHA_MAX_ALPHA;
return ((guint32) sine) >> COGL_FIXED_Q;
}
......@@ -884,7 +884,7 @@ clutter_sine_dec_func (ClutterAlpha *alpha,
ClutterTimeline * timeline;
gint frame;
gint n_frames;
ClutterAngle x;
float x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
......@@ -893,7 +893,7 @@ clutter_sine_dec_func (ClutterAlpha *alpha,
x = 256 * frame / n_frames + 256;
sine = cogl_angle_sin (x) * CLUTTER_ALPHA_MAX_ALPHA;
sine = sinf (x * (G_PI/180.0)) * CLUTTER_ALPHA_MAX_ALPHA;
return ((guint32) sine) >> COGL_FIXED_Q;
}
......@@ -926,7 +926,7 @@ clutter_sine_half_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
ClutterAngle x;
float x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
......@@ -935,7 +935,7 @@ clutter_sine_half_func (ClutterAlpha *alpha,
x = 512 * frame / n_frames;
sine = cogl_angle_sin (x) * CLUTTER_ALPHA_MAX_ALPHA;
sine = sinf (x * (G_PI/180.0)) * CLUTTER_ALPHA_MAX_ALPHA;
return ((guint32) sine) >> COGL_FIXED_Q;
}
......@@ -962,7 +962,7 @@ clutter_sine_in_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
ClutterAngle x;
float x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
......@@ -972,7 +972,7 @@ clutter_sine_in_func (ClutterAlpha *alpha,
/* XXX- if we use 768 we overflow */
x = 256 * frame / n_frames + 767;
sine = (cogl_angle_sin (x) + 1) * CLUTTER_ALPHA_MAX_ALPHA;
sine = (sinf (x * (G_PI/180.0)) + 1) * CLUTTER_ALPHA_MAX_ALPHA;
return ((guint32) sine) >> COGL_FIXED_Q;
}
......@@ -998,7 +998,7 @@ clutter_sine_out_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
ClutterAngle x;
float x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
......@@ -1007,7 +1007,7 @@ clutter_sine_out_func (ClutterAlpha *alpha,
x = 256 * frame / n_frames;
sine = cogl_angle_sin (x) * CLUTTER_ALPHA_MAX_ALPHA;
sine = sinf (x * (G_PI/180.0)) * CLUTTER_ALPHA_MAX_ALPHA;
return ((guint32) sine) >> COGL_FIXED_Q;
}
......@@ -1034,7 +1034,7 @@ clutter_sine_in_out_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
ClutterAngle x;
float x;
ClutterFixed sine;
timeline = clutter_alpha_get_timeline (alpha);
......@@ -1043,7 +1043,7 @@ clutter_sine_in_out_func (ClutterAlpha *alpha,
x = -256 * frame / n_frames + 256;
sine = (cogl_angle_sin (x) + 1) / 2 * CLUTTER_ALPHA_MAX_ALPHA;
sine = (sinf (x * (G_PI/180.0)) + 1) / 2 * CLUTTER_ALPHA_MAX_ALPHA;
return ((guint32) sine) >> COGL_FIXED_Q;
}
......@@ -1129,7 +1129,7 @@ clutter_smoothstep_inc_func (ClutterAlpha *alpha,
/*
* Convert x to 8.24 for next step.
*/
x = COGL_FIXED_FAST_DIV (frame, n_frames) << 8;
x = CLUTTER_FIXED_DIV (frame, n_frames) << 8;
/*
* f(x) = -2x^3 + 3x^2
......@@ -1138,7 +1138,7 @@ clutter_smoothstep_inc_func (ClutterAlpha *alpha,
*/
r = ((x >> 12) * (x >> 12) * 3 - (x >> 15) * (x >> 16) * (x >> 16)) >> 8;
return COGL_FIXED_TO_INT (r * CLUTTER_ALPHA_MAX_ALPHA);
return (r * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
......@@ -1214,7 +1214,7 @@ clutter_exp_inc_func (ClutterAlpha *alpha,
x = x_alpha_max * frame / n_frames;
result = CLAMP (cogl_fixed_pow2 (x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
result = CLAMP (pow2f (x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
return result;
}
......@@ -1265,7 +1265,7 @@ clutter_exp_dec_func (ClutterAlpha *alpha,
x = (x_alpha_max * (n_frames - frame)) / n_frames;
result = CLAMP (cogl_fixed_pow2 (x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
result = CLAMP (pow2f (x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
return result;
}
......
......@@ -416,7 +416,7 @@ clutter_backend_set_resolution (ClutterBackend *backend,
priv = backend->priv;
fixed_dpi = COGL_FIXED_FROM_FLOAT (dpi);
fixed_dpi = CLUTTER_FLOAT_TO_FIXED (dpi);
if (priv->resolution != fixed_dpi)
priv->resolution = fixed_dpi;
......@@ -443,7 +443,7 @@ clutter_backend_get_resolution (ClutterBackend *backend)
{
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), -1.0);
return COGL_FIXED_TO_FLOAT (backend->priv->resolution);
return CLUTTER_FIXED_TO_FLOAT (backend->priv->resolution);
}
/**
......
......@@ -83,9 +83,9 @@ clutter_behaviour_depth_alpha_notify (ClutterBehaviour *behaviour,
priv = CLUTTER_BEHAVIOUR_DEPTH (behaviour)->priv;
/* Need to create factor as to avoid borking signedness */
factor = COGL_FIXED_FROM_INT (alpha_value) / CLUTTER_ALPHA_MAX_ALPHA;
factor = (float)(alpha_value) / CLUTTER_ALPHA_MAX_ALPHA;
depth = priv->depth_start
+ COGL_FIXED_TO_INT (factor * (priv->depth_end - priv->depth_start));
+ (factor * (priv->depth_end - priv->depth_start));
CLUTTER_NOTE (BEHAVIOUR, "alpha: %d, depth: %d", alpha_value, depth);
......
......@@ -86,11 +86,11 @@ struct _ClutterBehaviourEllipsePrivate
gint a;
gint b;
ClutterAngle angle_start;
ClutterAngle angle_end;
ClutterAngle angle_tilt_x;
ClutterAngle angle_tilt_y;
ClutterAngle angle_tilt_z;
float angle_start;
float angle_end;
float angle_tilt_x;
float angle_tilt_y;
float angle_tilt_z;
ClutterRotateDirection direction;
};
......@@ -104,14 +104,14 @@ typedef struct _knot3d
static void
clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
ClutterAngle angle,
float angle,
knot3d *knot)
{
ClutterBehaviourEllipsePrivate *priv = e->priv;
gint x, y, z;
x = COGL_FIXED_TO_INT (priv->a * cogl_angle_cos (angle));
y = COGL_FIXED_TO_INT (priv->b * cogl_angle_sin (angle));
x = (priv->a * cosf (angle * (G_PI/180.0)));
y = (priv->b * sinf (angle * (G_PI/180.0)));
z = 0;
if (priv->angle_tilt_z)
......@@ -126,40 +126,40 @@ clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
*/
ClutterFixed x2, y2;
x2 = x * cogl_angle_cos (priv->angle_tilt_z)
- y * cogl_angle_sin (priv->angle_tilt_z);
x2 = x * cosf (priv->angle_tilt_z * (G_PI/180.0))
- y * sinf (priv->angle_tilt_z * (G_PI/180.0));
y2 = y * cogl_angle_cos (priv->angle_tilt_z)
+ x * cogl_angle_sin (priv->angle_tilt_z);
y2 = y * cosf (priv->angle_tilt_z * (G_PI/180.0))
+ x * sinf (priv->angle_tilt_z * (G_PI/180.0));