First cut at a fixed point to floating point conversion script + patches

This commit doesn't actually include any direct changes to source; you
have to run ./fixed-to-float.sh. Note: the script will make a number of
commits itself to your git repository a various stages of the script.
You will need to reset these if you want to re-run the script.

* NB: Be carefull about how you reset your tree, if you are making changes
to the script and patches, so you don't loose your changes *

This aims to remove all use of fixed point within Clutter and Cogl. It aims to
not break the Clutter API, including maintaining the CLUTTER_FIXED macros,
(though they now handle floats not 16.16 fixed)

It maintains cogl-fixed.[ch] as a utility API that can be used by applications
(and potentially for focused internal optimisations), but all Cogl interfaces
now accept floats in place of CoglFixed.

Note: the choice to to use single precision floats, not doubles is very
intentional. GPUs are basically all single precision; only this year have high
end cards started adding double precision - aimed mostly at the GPGPU market.
This means if you pass doubles into any GL[ES] driver, you can expect those
numbers to be cast to a float. (Certainly this is true of Mesa wich casts
most things to floats internally) It can be a noteable performance issue to
cast from double->float frequently, and if we were to have an api defined in
terms of doubles, that would imply a *lot* of unneeded casting. One of the
noteable issues with fixed point was the amount of casting required, so I
don't want to overshoot the mark and require just as much casting still. Double
precision arithmatic is also slower, so it usually makes sense to minimize its
use if the extra precision isn't needed. In the same way that the fast/low
precision fixed API can be used sparingly for optimisations; if needs be in
certain situations we can promote to doubles internally for higher precision.

E.g.
quoting Brian Paul (talking about performance optimisations for GL programmers):
"Avoid double precision valued functions
    Mesa does all internal floating point computations in single precision
    floating point. API functions which take double precision floating point
    values must convert them to single precision. This can be expensive in the
    case of glVertex, glNormal, etc. "
This commit is contained in:
Robert Bragg 2008-12-19 21:55:35 +00:00
parent 6a980793c6
commit e8915fcb12
20 changed files with 1652 additions and 0 deletions

View File

@ -0,0 +1,40 @@
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index ac9a2f6..42da2a5 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -866,8 +866,11 @@ clutter_actor_transform_point (ClutterActor *actor,
/* 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) (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_X(x,w,v1,v2) \
+ (CLUTTER_FIXED_MUL (((CLUTTER_FIXED_DIV ((x), (w)) + 1.0) / 2), (v1)) + (v2))
+#define MTX_GL_SCALE_Y(y,w,v1,v2) \
+ ((v1) - CLUTTER_FIXED_MUL (((CLUTTER_FIXED_DIV ((y), (w)) + 1.0) / 2), \
+ (v1)) + (v2))
#define MTX_GL_SCALE_Z(z,w,v1,v2) (MTX_GL_SCALE_X ((z), (w), (v1), (v2)))
/**
@@ -3213,8 +3214,8 @@ clutter_actor_get_preferred_width (ClutterActor *self,
if (natural_width < min_width)
{
- g_warning ("Actor of type %s reported a natural width of %d (%d px) "
- "lower than min width %d (%d px)",
+ g_warning ("Actor of type %s reported a natural width of %f (%d px) "
+ "lower than min width %f (%d px)",
G_OBJECT_TYPE_NAME (self),
natural_width, CLUTTER_UNITS_TO_DEVICE (natural_width),
min_width, CLUTTER_UNITS_TO_DEVICE (min_width));
@@ -3283,8 +3284,8 @@ clutter_actor_get_preferred_height (ClutterActor *self,
if (natural_height < min_height)
{
- g_warning ("Actor of type %s reported a natural height of %d "
- "(%d px) lower than min height %d (%d px)",
+ g_warning ("Actor of type %s reported a natural height of %f "
+ "(%d px) lower than min height %f (%d px)",
G_OBJECT_TYPE_NAME (self),
natural_height, CLUTTER_UNITS_TO_DEVICE (natural_height),
min_height, CLUTTER_UNITS_TO_DEVICE (min_height));

View File

@ -0,0 +1,263 @@
diff --git a/clutter/clutter-alpha.c b/clutter/clutter-alpha.c
index 3e4df4d..74a5c7a 100644
--- a/clutter/clutter-alpha.c
+++ b/clutter/clutter-alpha.c
@@ -694,6 +694,11 @@ clutter_ramp_func (ClutterAlpha *alpha,
}
}
+#if 0
+/*
+ * The following three functions are left in place for reference
+ * purposes.
+ */
static guint32
sincx1024_func (ClutterAlpha *alpha,
ClutterAngle angle,
@@ -713,7 +718,7 @@ sincx1024_func (ClutterAlpha *alpha,
x -= (512 * 512 / angle);
- sine = ((sinf (x) + offset) / 2)
+ sine = ((cogl_angle_sin (x) + offset) / 2)
* CLUTTER_ALPHA_MAX_ALPHA;
sine = sine >> COGL_FIXED_Q;
@@ -721,11 +726,6 @@ sincx1024_func (ClutterAlpha *alpha,
return sine;
}
-#if 0
-/*
- * The following two functions are left in place for reference
- * purposes.
- */
static guint32
sincx_func (ClutterAlpha *alpha,
ClutterFixed angle,
@@ -744,7 +744,7 @@ sincx_func (ClutterAlpha *alpha,
x = CLUTTER_FIXED_MUL (x, CFX_PI)
- CLUTTER_FIXED_DIV (CFX_PI, angle);
- sine = (sinf (x) + offset) / 2;
+ sine = (cogl_angle_sin (x) + offset) / 2;
CLUTTER_NOTE (ALPHA, "sine: %2f\n", CLUTTER_FIXED_TO_DOUBLE (sine));
@@ -803,9 +803,25 @@ guint32
clutter_sine_func (ClutterAlpha *alpha,
gpointer dummy)
{
-#if 0
+#if 1
+ ClutterTimeline *timeline;
+ gint current_frame_num, n_frames;
+ float radians, sine;
+
+ timeline = clutter_alpha_get_timeline (alpha);
+
+ current_frame_num = clutter_timeline_get_current_frame (timeline);
+ n_frames = clutter_timeline_get_n_frames (timeline);
+
+ radians = ((float)current_frame_num / n_frames) * (2.0 * G_PI);
+ sine = sinf (radians);
+
+ CLUTTER_NOTE (ALPHA, "sine: %2f\n", sine);
+
+ return COGL_FLOAT_TO_INT ((sine * CLUTTER_ALPHA_MAX_ALPHA));
+#elif 0
return sinc_func (alpha, 2.0, 1.0);
-#else
+#elif 0
/* 2.0 above represents full circle */
return sincx1024_func (alpha, 1024, 1.0);
#endif
@@ -839,18 +855,17 @@ clutter_sine_inc_func (ClutterAlpha *alpha,
ClutterTimeline * timeline;
gint frame;
gint n_frames;
- ClutterAngle x;
- ClutterFixed sine;
+ float radians;
+ float sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
- x = 256 * frame / n_frames;
-
- sine = sinf (x) * CLUTTER_ALPHA_MAX_ALPHA;
+ radians = ((float)frame / n_frames) * (G_PI / 2);
+ sine = sinf (radians);
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -881,18 +896,17 @@ clutter_sine_dec_func (ClutterAlpha *alpha,
ClutterTimeline * timeline;
gint frame;
gint n_frames;
- ClutterAngle x;
- ClutterFixed sine;
+ float radians;
+ float sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
- x = 256 * frame / n_frames + 256;
-
- sine = sinf (x) * CLUTTER_ALPHA_MAX_ALPHA;
+ radians = ((float)frame / n_frames) * (G_PI / 2);
+ sine = sinf (radians + (G_PI / 2));
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -923,18 +937,17 @@ clutter_sine_half_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- ClutterAngle x;
- ClutterFixed sine;
+ float radians;
+ float sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
- x = 512 * frame / n_frames;
+ radians = ((float)frame / n_frames) * G_PI;
+ sine = sinf (radians);
- sine = sinf (x) * CLUTTER_ALPHA_MAX_ALPHA;
-
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -959,19 +972,17 @@ clutter_sine_in_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- ClutterAngle x;
- ClutterFixed sine;
+ float radians;
+ float sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
- /* XXX- if we use 768 we overflow */
- x = 256 * frame / n_frames + 767;
-
- sine = (sinf (x) + 1) * CLUTTER_ALPHA_MAX_ALPHA;
+ radians = ((float)frame / n_frames) * (G_PI / 2);
+ sine = sinf (radians - (G_PI / 2)) + 1.0;
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -995,18 +1006,17 @@ clutter_sine_out_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- ClutterAngle x;
- ClutterFixed sine;
+ float radians;
+ float sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
- x = 256 * frame / n_frames;
-
- sine = sinf (x) * CLUTTER_ALPHA_MAX_ALPHA;
+ radians = ((float)frame / n_frames) * (G_PI / 2);
+ sine = sinf (radians);
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -1031,18 +1041,17 @@ clutter_sine_in_out_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- ClutterAngle x;
- ClutterFixed sine;
+ float radians;
+ float sine;
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
- x = -256 * frame / n_frames + 256;
+ radians = ((float)frame / n_frames) * G_PI;
+ sine = (sinf (radians - (G_PI / 2)) + 1.0) / 2.0;
- sine = (sinf (x) + 1) / 2 * CLUTTER_ALPHA_MAX_ALPHA;
-
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -1201,9 +1210,9 @@ clutter_exp_inc_func (ClutterAlpha *alpha,
*
* (2^x_alpha_max) - 1 == CLUTTER_ALPHA_MAX_ALPHA
*/
-#if CLUTTER_ALPHA_MAX_ALPHA != 0xffff
-#error Adjust x_alpha_max to match CLUTTER_ALPHA_MAX_ALPHA
-#endif
+ /* XXX: If this fails:
+ * Adjust x_alpha_max to match CLUTTER_ALPHA_MAX_ALPHA */
+ g_assert (CLUTTER_ALPHA_MAX_ALPHA == 65535.0);
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
@@ -1211,7 +1220,7 @@ clutter_exp_inc_func (ClutterAlpha *alpha,
x = x_alpha_max * frame / n_frames;
- result = CLAMP (pow2f (x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
+ result = CLAMP (powf (2, x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
return result;
}
@@ -1252,9 +1261,9 @@ clutter_exp_dec_func (ClutterAlpha *alpha,
*
* (2^x_alpha_max) - 1 == CLUTTER_ALPHA_MAX_ALPHA
*/
-#if CLUTTER_ALPHA_MAX_ALPHA != 0xffff
-#error Adjust x_alpha_max to match CLUTTER_ALPHA_MAX_ALPHA
-#endif
+ /* XXX: If this fails:
+ * Adjust x_alpha_max to match CLUTTER_ALPHA_MAX_ALPHA */
+ g_assert (CLUTTER_ALPHA_MAX_ALPHA == 65535.0);
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
@@ -1262,7 +1271,7 @@ clutter_exp_dec_func (ClutterAlpha *alpha,
x = (x_alpha_max * (n_frames - frame)) / n_frames;
- result = CLAMP (pow2f (x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
+ result = CLAMP (powf (2, x) - 1, 0, CLUTTER_ALPHA_MAX_ALPHA);
return result;
}

View File

@ -0,0 +1,13 @@
diff --git a/clutter/clutter-alpha.h b/clutter/clutter-alpha.h
index eba9e3f..e409d77 100644
--- a/clutter/clutter-alpha.h
+++ b/clutter/clutter-alpha.h
@@ -106,7 +106,7 @@ struct _ClutterAlphaClass
*
* Since: 0.2
*/
-#define CLUTTER_ALPHA_MAX_ALPHA (0xffff)
+#define CLUTTER_ALPHA_MAX_ALPHA (65535.0f)
GType clutter_alpha_get_type (void) G_GNUC_CONST;

View File

@ -0,0 +1,445 @@
diff --git a/clutter/clutter-behaviour-ellipse.c b/clutter/clutter-behaviour-ellipse.c
index b9f493b..5524032 100644
--- a/clutter/clutter-behaviour-ellipse.c
+++ b/clutter/clutter-behaviour-ellipse.c
@@ -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,7 +104,7 @@ typedef struct _knot3d
static void
clutter_behaviour_ellipse_advance (ClutterBehaviourEllipse *e,
- ClutterAngle angle,
+ float angle,
knot3d *knot)
{
ClutterBehaviourEllipsePrivate *priv = e->priv;
@@ -187,20 +187,16 @@ actor_apply_knot_foreach (ClutterBehaviour *behave,
clutter_actor_set_depth (actor, knot->z);
}
-static inline ClutterAngle
-clamp_angle (ClutterAngle a)
+static float
+clamp_angle (float a)
{
- ClutterAngle a1, a2;
gint rounds;
+
+ rounds = a / 360;
+ if (a < 0)
+ rounds--;
- /* Need to add the 256 offset here, since the user space 0 maps to our
- * -256
- */
- rounds = (a + 256) / 1024;
- a1 = rounds * 1024;
- a2 = a - a1;
-
- return a2;
+ return a - 360 * rounds;
}
static void
@@ -209,7 +205,7 @@ clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
{
ClutterBehaviourEllipse *self = CLUTTER_BEHAVIOUR_ELLIPSE (behave);
ClutterBehaviourEllipsePrivate *priv = self->priv;
- ClutterAngle start, end;
+ float start, end;
knot3d knot;
ClutterAngle angle = 0;
@@ -218,11 +214,11 @@ clutter_behaviour_ellipse_alpha_notify (ClutterBehaviour *behave,
if (priv->direction == CLUTTER_ROTATE_CW && start >= end)
{
- end += 1024;
+ end += 360;
}
else if (priv->direction == CLUTTER_ROTATE_CCW && start <= end)
{
- end -= 1024;
+ end -= 360;
}
angle = (end - start) * alpha / CLUTTER_ALPHA_MAX_ALPHA + start;
@@ -247,30 +243,25 @@ clutter_behaviour_ellipse_set_property (GObject *gobject,
switch (prop_id)
{
case PROP_ANGLE_START:
- priv->angle_start =
- COGL_ANGLE_FROM_DEG (g_value_get_double (value)) - 256;
+ priv->angle_start = g_value_get_double (value);
break;
case PROP_ANGLE_END:
- priv->angle_end =
- COGL_ANGLE_FROM_DEG (g_value_get_double (value)) - 256;
+ priv->angle_end = g_value_get_double (value);
break;
case PROP_ANGLE_TILT_X:
- priv->angle_tilt_x =
- COGL_ANGLE_FROM_DEG (g_value_get_double (value));
+ priv->angle_tilt_x = g_value_get_double (value);
break;
case PROP_ANGLE_TILT_Y:
- priv->angle_tilt_y =
- COGL_ANGLE_FROM_DEG (g_value_get_double (value));
+ priv->angle_tilt_y = g_value_get_double (value);
break;
case PROP_ANGLE_TILT_Z:
- priv->angle_tilt_z =
- COGL_ANGLE_FROM_DEG (g_value_get_double (value));
+ priv->angle_tilt_z = g_value_get_double (value);
break;
case PROP_WIDTH:
- priv->a = g_value_get_int (value) >> 1;
+ priv->a = g_value_get_int (value) / 2;
break;
case PROP_HEIGHT:
- priv->b = g_value_get_int (value) >> 1;
+ priv->b = g_value_get_int (value) / 2;
break;
case PROP_CENTER:
{
@@ -301,30 +292,25 @@ clutter_behaviour_ellipse_get_property (GObject *gobject,
switch (prop_id)
{
case PROP_ANGLE_START:
- g_value_set_double (value,
- COGL_ANGLE_TO_DEG (priv->angle_start + 256));
+ g_value_set_double (value, priv->angle_start);
break;
case PROP_ANGLE_END:
- g_value_set_double (value,
- COGL_ANGLE_TO_DEG (priv->angle_end + 256));
+ g_value_set_double (value, priv->angle_end);
break;
case PROP_ANGLE_TILT_X:
- g_value_set_double (value,
- COGL_ANGLE_TO_DEG (priv->angle_tilt_x));
+ g_value_set_double (value, priv->angle_tilt_x);
break;
case PROP_ANGLE_TILT_Y:
- g_value_set_double (value,
- COGL_ANGLE_TO_DEG (priv->angle_tilt_y));
+ g_value_set_double (value, priv->angle_tilt_y);
break;
case PROP_ANGLE_TILT_Z:
- g_value_set_double (value,
- COGL_ANGLE_TO_DEG (priv->angle_tilt_z));
+ g_value_set_double (value, priv->angle_tilt_z);
break;
case PROP_WIDTH:
- g_value_set_int (value, (priv->a << 1));
+ g_value_set_int (value, (priv->a * 2));
break;
case PROP_HEIGHT:
- g_value_set_int (value, (priv->b << 1));
+ g_value_set_int (value, (priv->b * 2));
break;
case PROP_CENTER:
g_value_set_boxed (value, &priv->center);
@@ -513,12 +499,8 @@ clutter_behaviour_ellipse_init (ClutterBehaviourEllipse * self)
priv->direction = CLUTTER_ROTATE_CW;
- /* The inital values have to reflect the 90 degree offset between the normal
- * mathematical space and the clutter clock-based space; the default end
- * value of 360 is clamped to 0.
- */
- priv->angle_start = -256;
- priv->angle_end = -256;
+ priv->angle_start = 0;
+ priv->angle_end = 0;
}
/**
@@ -611,8 +593,8 @@ clutter_behaviour_ellipse_newx (ClutterAlpha * alpha,
"width", width,
"height", height,
"direction", direction,
- "angle-start", COGL_ANGLE_FROM_DEGX (start),
- "angle-end", COGL_ANGLE_FROM_DEGX (end),
+ "angle-start", (double)CLUTTER_FIXED_TO_FLOAT (start),
+ "angle-end", (double)CLUTTER_FIXED_TO_FLOAT (end),
NULL);
}
@@ -695,9 +677,9 @@ clutter_behaviour_ellipse_set_width (ClutterBehaviourEllipse * self,
priv = self->priv;
- if (priv->a != width >> 1)
+ if (priv->a != width / 2)
{
- priv->a = width >> 1;
+ priv->a = width / 2;
g_object_notify (G_OBJECT (self), "width");
}
@@ -718,7 +700,7 @@ clutter_behaviour_ellipse_get_width (ClutterBehaviourEllipse *self)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
- return self->priv->a << 1;
+ return self->priv->a * 2;
}
/**
@@ -740,9 +722,9 @@ clutter_behaviour_ellipse_set_height (ClutterBehaviourEllipse *self,
priv = self->priv;
- if (priv->b != height >> 1)
+ if (priv->b != height / 2)
{
- priv->b = height >> 1;
+ priv->b = height / 2;
g_object_notify (G_OBJECT (self), "height");
}
@@ -763,7 +745,7 @@ clutter_behaviour_ellipse_get_height (ClutterBehaviourEllipse *self)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
- return self->priv->b << 1;
+ return self->priv->b * 2;
}
/**
@@ -780,10 +762,11 @@ void
clutter_behaviour_ellipse_set_angle_start (ClutterBehaviourEllipse *self,
gdouble angle_start)
{
+ ClutterFixed new_angle = CLUTTER_FLOAT_TO_FIXED (angle_start);
+
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- clutter_behaviour_ellipse_set_angle_startx (self,
- CLUTTER_FLOAT_TO_FIXED (angle_start));
+ clutter_behaviour_ellipse_set_angle_startx (self, new_angle);
}
/**
@@ -802,10 +785,10 @@ clutter_behaviour_ellipse_set_angle_startx (ClutterBehaviourEllipse *self,
ClutterFixed angle_start)
{
ClutterBehaviourEllipsePrivate *priv;
- ClutterAngle new_angle;
+ float new_angle;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- new_angle = clamp_angle (COGL_ANGLE_FROM_DEGX (angle_start) - 256);
+ new_angle = clamp_angle (CLUTTER_FIXED_TO_FLOAT (angle_start));
priv = self->priv;
if (priv->angle_start != new_angle)
@@ -830,7 +813,7 @@ clutter_behaviour_ellipse_get_angle_start (ClutterBehaviourEllipse *self)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
- return COGL_ANGLE_TO_DEG (self->priv->angle_start + 256);
+ return (double)self->priv->angle_start;
}
/**
@@ -848,7 +831,7 @@ clutter_behaviour_ellipse_get_angle_startx (ClutterBehaviourEllipse *self)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
- return COGL_ANGLE_TO_DEGX (self->priv->angle_start);
+ return CLUTTER_FLOAT_TO_FIXED (self->priv->angle_start);
}
/**
@@ -865,10 +848,11 @@ void
clutter_behaviour_ellipse_set_angle_end (ClutterBehaviourEllipse *self,
gdouble angle_end)
{
+ ClutterFixed new_angle = CLUTTER_FLOAT_TO_FIXED (angle_end);
+
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- clutter_behaviour_ellipse_set_angle_endx (self,
- CLUTTER_FLOAT_TO_FIXED (angle_end));
+ clutter_behaviour_ellipse_set_angle_endx (self, new_angle);
}
/**
@@ -887,11 +871,11 @@ clutter_behaviour_ellipse_set_angle_endx (ClutterBehaviourEllipse *self,
ClutterFixed angle_end)
{
ClutterBehaviourEllipsePrivate *priv;
- ClutterAngle new_angle;
+ float new_angle;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- new_angle = clamp_angle (COGL_ANGLE_FROM_DEGX (angle_end) - 256);
+ new_angle = clamp_angle (CLUTTER_FIXED_TO_FLOAT (angle_end));
priv = self->priv;
@@ -918,7 +902,7 @@ clutter_behaviour_ellipse_get_angle_end (ClutterBehaviourEllipse *self)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0.0);
- return COGL_ANGLE_TO_DEG (self->priv->angle_end + 256);
+ return self->priv->angle_end;
}
/**
@@ -936,7 +920,7 @@ clutter_behaviour_ellipse_get_angle_endx (ClutterBehaviourEllipse *self)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self), 0);
- return COGL_ANGLE_TO_DEGX (self->priv->angle_end);
+ return CLUTTER_FLOAT_TO_FIXED (self->priv->angle_end);
}
/**
@@ -955,11 +939,11 @@ clutter_behaviour_ellipse_set_angle_tilt (ClutterBehaviourEllipse *self,
ClutterRotateAxis axis,
gdouble angle_tilt)
{
+ ClutterFixed new_angle = CLUTTER_FLOAT_TO_FIXED (angle_tilt);
+
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- clutter_behaviour_ellipse_set_angle_tiltx (self,
- axis,
- CLUTTER_FLOAT_TO_FIXED (angle_tilt));
+ clutter_behaviour_ellipse_set_angle_tiltx (self, axis, new_angle);
}
/**
@@ -979,11 +963,11 @@ clutter_behaviour_ellipse_set_angle_tiltx (ClutterBehaviourEllipse *self,
ClutterFixed angle_tilt)
{
ClutterBehaviourEllipsePrivate *priv;
- ClutterAngle new_angle;
+ float new_angle;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- new_angle = COGL_ANGLE_FROM_DEGX (angle_tilt);
+ new_angle = CLUTTER_FIXED_TO_FLOAT (angle_tilt);
priv = self->priv;
@@ -1038,11 +1022,11 @@ clutter_behaviour_ellipse_get_angle_tilt (ClutterBehaviourEllipse *self,
switch (axis)
{
case CLUTTER_X_AXIS:
- return COGL_ANGLE_TO_DEG (self->priv->angle_tilt_x);
+ return self->priv->angle_tilt_x;
case CLUTTER_Y_AXIS:
- return COGL_ANGLE_TO_DEG (self->priv->angle_tilt_y);
+ return self->priv->angle_tilt_y;
case CLUTTER_Z_AXIS:
- return COGL_ANGLE_TO_DEG (self->priv->angle_tilt_z);
+ return self->priv->angle_tilt_z;
}
return 0;
@@ -1068,11 +1052,11 @@ clutter_behaviour_ellipse_get_angle_tiltx (ClutterBehaviourEllipse *self,
switch (axis)
{
case CLUTTER_X_AXIS:
- return COGL_ANGLE_TO_DEGX (self->priv->angle_tilt_x);
+ return CLUTTER_FLOAT_TO_FIXED (self->priv->angle_tilt_x);
case CLUTTER_Y_AXIS:
- return COGL_ANGLE_TO_DEGX (self->priv->angle_tilt_y);
+ return CLUTTER_FLOAT_TO_FIXED (self->priv->angle_tilt_y);
case CLUTTER_Z_AXIS:
- return COGL_ANGLE_TO_DEGX (self->priv->angle_tilt_z);
+ return CLUTTER_FLOAT_TO_FIXED (self->priv->angle_tilt_z);
}
return 0;
@@ -1096,13 +1080,13 @@ clutter_behaviour_ellipse_set_tilt (ClutterBehaviourEllipse *self,
gdouble angle_tilt_z)
{
ClutterBehaviourEllipsePrivate *priv;
- ClutterAngle new_angle_x, new_angle_y, new_angle_z;
+ float new_angle_x, new_angle_y, new_angle_z;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- new_angle_x = COGL_ANGLE_FROM_DEG (angle_tilt_x);
- new_angle_y = COGL_ANGLE_FROM_DEG (angle_tilt_y);
- new_angle_z = COGL_ANGLE_FROM_DEG (angle_tilt_z);
+ new_angle_x = angle_tilt_x;
+ new_angle_y = angle_tilt_y;
+ new_angle_z = angle_tilt_z;
priv = self->priv;
@@ -1150,13 +1134,13 @@ clutter_behaviour_ellipse_set_tiltx (ClutterBehaviourEllipse *self,
ClutterFixed angle_tilt_z)
{
ClutterBehaviourEllipsePrivate *priv;
- ClutterAngle new_angle_x, new_angle_y, new_angle_z;
+ float new_angle_x, new_angle_y, new_angle_z;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ELLIPSE (self));
- new_angle_x = COGL_ANGLE_FROM_DEGX (angle_tilt_x);
- new_angle_y = COGL_ANGLE_FROM_DEGX (angle_tilt_y);
- new_angle_z = COGL_ANGLE_FROM_DEGX (angle_tilt_z);
+ new_angle_x = angle_tilt_x;
+ new_angle_y = angle_tilt_y;
+ new_angle_z = angle_tilt_z;
priv = self->priv;
@@ -1210,13 +1194,13 @@ clutter_behaviour_ellipse_get_tilt (ClutterBehaviourEllipse *self,
priv = self->priv;
if (angle_tilt_x)
- *angle_tilt_x = COGL_ANGLE_TO_DEG (priv->angle_tilt_x);
+ *angle_tilt_x = priv->angle_tilt_x;
if (angle_tilt_y)
- *angle_tilt_y = COGL_ANGLE_TO_DEG (priv->angle_tilt_y);
+ *angle_tilt_y = priv->angle_tilt_y;
if (angle_tilt_z)
- *angle_tilt_z = COGL_ANGLE_TO_DEG (priv->angle_tilt_z);
+ *angle_tilt_z = priv->angle_tilt_z;
}
/**
@@ -1246,13 +1230,13 @@ clutter_behaviour_ellipse_get_tiltx (ClutterBehaviourEllipse *self,
priv = self->priv;
if (angle_tilt_x)
- *angle_tilt_x = COGL_ANGLE_TO_DEGX (priv->angle_tilt_x);
+ *angle_tilt_x = priv->angle_tilt_x;
if (angle_tilt_y)
- *angle_tilt_y = COGL_ANGLE_TO_DEGX (priv->angle_tilt_y);
+ *angle_tilt_y = priv->angle_tilt_y;
if (angle_tilt_z)
- *angle_tilt_z = COGL_ANGLE_TO_DEGX (priv->angle_tilt_z);
+ *angle_tilt_z = priv->angle_tilt_z;
}
/**

View File

@ -0,0 +1,13 @@
diff --git a/clutter/clutter-bezier.c b/clutter/clutter-bezier.c
index 6a47626..66c4ddf 100644
--- a/clutter/clutter-bezier.c
+++ b/clutter/clutter-bezier.c
@@ -252,7 +252,7 @@ _clutter_bezier_init (ClutterBezier *b,
int x = _clutter_bezier_t2x (b, t);
int y = _clutter_bezier_t2y (b, t);
- guint l = clutter_sqrti ((y - yp)*(y - yp) + (x - xp)*(x - xp));
+ guint l = cogl_sqrti ((y - yp)*(y - yp) + (x - xp)*(x - xp));
l += length[i-1];

View File

@ -0,0 +1,15 @@
diff --git a/clutter/clutter-fixed.c b/clutter/clutter-fixed.c
index 89f43c2..6d5bf01 100644
--- a/clutter/clutter-fixed.c
+++ b/clutter/clutter-fixed.c
@@ -251,8 +251,8 @@ param_fixed_init (GParamSpec *pspec)
{
ClutterParamSpecFixed *fspec = CLUTTER_PARAM_SPEC_FIXED (pspec);
- fspec->minimum = COGL_FIXED_MIN;
- fspec->maximum = COGL_FIXED_MAX;
+ fspec->minimum = CLUTTER_MAXFIXED;
+ fspec->maximum = CLUTTER_MINFIXED;
fspec->default_value = 0;
}

View File

@ -0,0 +1,333 @@
diff --git a/clutter/clutter-fixed.h b/clutter/clutter-fixed.h
index 3ae0916..5d150da 100644
--- a/clutter/clutter-fixed.h
+++ b/clutter/clutter-fixed.h
@@ -39,126 +39,118 @@ G_BEGIN_DECLS
*
* Fixed point number (16.16)
*/
-typedef CoglFixed ClutterFixed;
+typedef float ClutterFixed;
/**
* ClutterAngle:
*
- * Integer representation of an angle such that 1024 corresponds to
- * full circle (i.e., 2*Pi).
+ * An abstract representation of an angle.
*/
-typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
+typedef float ClutterAngle;
-#define CLUTTER_ANGLE_FROM_DEG(x) (COGL_ANGLE_FROM_DEG (x))
-#define CLUTTER_ANGLE_FROM_DEGX(x) (COGL_ANGLE_FROM_DEGX (x))
-#define CLUTTER_ANGLE_TO_DEG(x) (COGL_ANGLE_TO_DEG (x))
-#define CLUTTER_ANGLE_TO_DEGX(x) (COGL_ANGLE_TO_DEGX (x))
+#define CLUTTER_ANGLE_FROM_DEG(x) ((float)(x))
+#define CLUTTER_ANGLE_FROM_DEGX(x) (CLUTTER_FIXED_TO_FLOAT (x))
+#define CLUTTER_ANGLE_TO_DEG(x) ((float)(x))
+#define CLUTTER_ANGLE_TO_DEGX(x) (CLUTTER_FLOAT_TO_FIXED (x))
/*
* some commonly used constants
*/
/**
- * CFX_Q:
- *
- * Size in bits of decimal part of floating point value.
- */
-#define CFX_Q COGL_FIXED_Q
-
-/**
* CFX_ONE:
*
* 1.0 represented as a fixed point value.
*/
-#define CFX_ONE COGL_FIXED_1
+#define CFX_ONE 1.0
/**
* CFX_HALF:
*
* 0.5 represented as a fixed point value.
*/
-#define CFX_HALF COGL_FIXED_0_5
+#define CFX_HALF 0.5
/**
* CFX_MAX:
*
* Maximum fixed point value.
*/
-#define CFX_MAX COGL_FIXED_MAX
+#define CFX_MAX G_MAXFLOAT
/**
* CFX_MIN:
*
* Minimum fixed point value.
*/
-#define CFX_MIN COGL_FIXED_MIN
+#define CFX_MIN (-G_MAXFLOAT)
/**
* CFX_PI:
*
* Fixed point representation of Pi
*/
-#define CFX_PI COGL_FIXED_PI
+#define CFX_PI G_PI
/**
* CFX_2PI:
*
* Fixed point representation of Pi*2
*/
-#define CFX_2PI COGL_FIXED_2_PI
+#define CFX_2PI (G_PI * 2)
/**
* CFX_PI_2:
*
* Fixed point representation of Pi/2
*/
-#define CFX_PI_2 COGL_FIXED_PI_2
+#define CFX_PI_2 (G_PI / 2)
/**
* CFX_PI_4:
*
* Fixed point representation of Pi/4
*/
-#define CFX_PI_4 COGL_FIXED_PI_4
+#define CFX_PI_4 (G_PI / 4)
/**
* CFX_360:
*
* Fixed point representation of the number 360
*/
-#define CFX_360 COGL_FIXED_360
+#define CFX_360 360.0
/**
* CFX_240:
*
* Fixed point representation of the number 240
*/
-#define CFX_240 COGL_FIXED_240
+#define CFX_240 240.0
/**
* CFX_180:
*
* Fixed point representation of the number 180
*/
-#define CFX_180 COGL_FIXED_180
+#define CFX_180 180.0
/**
* CFX_120:
*
* Fixed point representation of the number 120
*/
-#define CFX_120 COGL_FIXED_120
+#define CFX_120 120.0
/**
* CFX_60:
*
* Fixed point representation of the number 60
*/
-#define CFX_60 COGL_FIXED_60
+#define CFX_60 60.0
/**
* CFX_RADIANS_TO_DEGREES:
*
* Fixed point representation of the number 180 / pi
*/
-#define CFX_RADIANS_TO_DEGREES COGL_RADIANS_TO_DEGREES
+#define CFX_RADIANS_TO_DEGREES (180.0 / G_PI)
/**
* CFX_255:
*
* Fixed point representation of the number 255
*/
-#define CFX_255 COGL_FIXED_255
+#define CFX_255 255.0
/**
* CLUTTER_FIXED_TO_FLOAT:
@@ -166,7 +158,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Convert a fixed point value to float.
*/
-#define CLUTTER_FIXED_TO_FLOAT(x) COGL_FIXED_TO_FLOAT ((x))
+#define CLUTTER_FIXED_TO_FLOAT(x) (x)
/**
* CLUTTER_FIXED_TO_DOUBLE:
@@ -174,7 +166,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Convert a fixed point value to double.
*/
-#define CLUTTER_FIXED_TO_DOUBLE(x) COGL_FIXED_TO_DOUBLE ((x))
+#define CLUTTER_FIXED_TO_DOUBLE(x) ((double)(x))
/**
* CLUTTER_FLOAT_TO_FIXED:
@@ -182,7 +174,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Convert a float value to fixed.
*/
-#define CLUTTER_FLOAT_TO_FIXED(x) COGL_FIXED_FROM_FLOAT ((x))
+#define CLUTTER_FLOAT_TO_FIXED(x) ((x))
/**
* CLUTTER_FLOAT_TO_INT:
@@ -190,7 +182,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Convert a float value to int.
*/
-#define CLUTTER_FLOAT_TO_INT(x) COGL_FLOAT_TO_INT ((x))
+#define CLUTTER_FLOAT_TO_INT(x) ((int)(x))
/**
* CLUTTER_FLOAT_TO_UINT:
@@ -198,7 +190,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Convert a float value to unsigned int.
*/
-#define CLUTTER_FLOAT_TO_UINT(x) COGL_FLOAT_TO_UINT ((x))
+#define CLUTTER_FLOAT_TO_UINT(x) ((unsigned int)(x))
/**
* CLUTTER_INT_TO_FIXED:
@@ -206,7 +198,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Convert an integer value to fixed point.
*/
-#define CLUTTER_INT_TO_FIXED(x) COGL_FIXED_FROM_INT ((x))
+#define CLUTTER_INT_TO_FIXED(x) ((float)(x))
/**
* CLUTTER_FIXED_TO_INT:
@@ -216,7 +208,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Since: 0.6
*/
-#define CLUTTER_FIXED_TO_INT(x) COGL_FIXED_TO_INT ((x))
+#define CLUTTER_FIXED_TO_INT(x) ((int)(x))
/**
* CLUTTER_FIXED_FRACTION:
@@ -224,7 +216,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Retrieves the fractionary part of a fixed point value
*/
-#define CLUTTER_FIXED_FRACTION(x) COGL_FIXED_FRACTION ((x))
+#define CLUTTER_FIXED_FRACTION(x) ((x)-floorf (x))
/**
* CLUTTER_FIXED_FLOOR:
@@ -232,7 +224,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Round down a fixed point value to an integer.
*/
-#define CLUTTER_FIXED_FLOOR(x) COGL_FIXED_FLOOR ((x))
+#define CLUTTER_FIXED_FLOOR(x) (floorf (x))
/**
* CLUTTER_FIXED_CEIL:
@@ -240,7 +232,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Round up a fixed point value to an integer.
*/
-#define CLUTTER_FIXED_CEIL(x) COGL_FIXED_CEIL ((x))
+#define CLUTTER_FIXED_CEIL(x) (ceilf (x))
/**
* CLUTTER_FIXED_MUL:
@@ -249,7 +241,7 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Multiply two fixed point values
*/
-#define CLUTTER_FIXED_MUL(x,y) COGL_FIXED_MUL ((x), (y))
+#define CLUTTER_FIXED_MUL(x,y) ((x) * (y))
/**
* CLUTTER_FIXED_DIV:
@@ -258,54 +250,16 @@ typedef CoglAngle ClutterAngle; /* angle such that 1024 == 2*PI */
*
* Divide two fixed point values
*/
-#define CLUTTER_FIXED_DIV(x,y) COGL_FIXED_DIV ((x), (y))
-
-#define clutter_qmulx(x,y) cogl_fixed_mul ((x), (y))
-#define clutter_qdivx(x,y) cogl_fixed_div ((x), (y))
-
-#define clutter_sinx(a) cogl_fixed_sin ((a))
-#define clutter_sini(a) cogl_angle_sin ((a))
-#define clutter_tani(a) cogl_angle_tan ((a))
-#define clutter_atani(a) cogl_fixed_atan ((a))
-#define clutter_atan2i(x,y) cogl_fixed_atan2 ((x), (y))
-#define clutter_cosx(a) cogl_fixed_cos ((a))
-#define clutter_cosi(a) cogl_angle_cos ((a))
-
-/**
- * CLUTTER_SQRTI_ARG_MAX
- *
- * Maximum argument that can be passed to #clutter_sqrti function.
- *
- * Since: 0.6
- */
-#define CLUTTER_SQRTI_ARG_MAX COGL_SQRTI_ARG_MAX
-
-/**
- * CLUTTER_SQRTI_ARG_5_PERCENT
- *
- * Maximum argument that can be passed to #clutter_sqrti for which the
- * resulting error is < 5%
- *
- * Since: 0.6
- */
-#define CLUTTER_SQRTI_ARG_5_PERCENT COGL_SQRTI_ARG_5_PERCENT
-
-/**
- * CLUTTER_SQRTI_ARG_10_PERCENT
- *
- * Maximum argument that can be passed to #clutter_sqrti for which the
- * resulting error is < 10%
- *
- * Since: 0.6
- */
-#define CLUTTER_SQRTI_ARG_10_PERCENT COGL_SQRTI_ARG_10_PERCENT
+#define CLUTTER_FIXED_DIV(x,y) ((x) / (y))
-#define clutter_sqrtx(x) cogl_fixed_sqrt ((x))
-#define clutter_sqrti(x) cogl_sqrti ((x))
+#define clutter_qmulx(x,y) ((x) * (y))
+#define clutter_qdivx(x,y) ((x) / (y))
-#define clutter_log2x(x) cogl_fixed_log2 ((x))
-#define clutter_pow2x(x) cogl_fixed_pow2 ((x))
-#define clutter_powx(x,y) cogl_fixed_pow ((x), (y))
+#define clutter_sinx(a) sinf (a)
+#define clutter_tanx(a) tanf (a)
+#define clutter_atanx(a) atanf (a)
+#define clutter_atan2x(x,y) atan2f (x, y)
+#define clutter_cosx(a) cosf (a)
#define CLUTTER_TYPE_FIXED (clutter_fixed_get_type ())
#define CLUTTER_TYPE_PARAM_FIXED (clutter_param_fixed_get_type ())
@@ -331,7 +285,7 @@ typedef struct _ClutterParamSpecFixed ClutterParamSpecFixed;
*
* Since: 0.8
*/
-#define CLUTTER_MAXFIXED COGL_FIXED_MAX
+#define CLUTTER_MAXFIXED G_MAXFLOAT
/**
* CLUTTER_MINFIXED:
@@ -340,7 +294,7 @@ typedef struct _ClutterParamSpecFixed ClutterParamSpecFixed;
*
* Since: 0.8
*/
-#define CLUTTER_MINFIXED COGL_FIXED_MIN
+#define CLUTTER_MINFIXED (-G_MAXFLOAT)
/**
* ClutterParamSpecFixed

View File

@ -0,0 +1,18 @@
diff --git a/clutter/clutter-path.c b/clutter/clutter-path.c
index 973d861..d3eff11 100644
--- a/clutter/clutter-path.c
+++ b/clutter/clutter-path.c
@@ -1081,11 +1081,11 @@ clutter_path_node_distance (const ClutterKnot *start,
* If we are using limited precision sqrti implementation, fallback on
* clib sqrt if the precission would be less than 10%
*/
-#if INT_MAX > CLUTTER_SQRTI_ARG_10_PERCENT
+#if INT_MAX > COGL_SQRTI_ARG_10_PERCENT
if (t <= COGL_SQRTI_ARG_10_PERCENT)
return cogl_sqrti (t);
else
- return COGL_FLOAT_TO_INT (sqrt(t));
+ return COGL_FLOAT_TO_INT (sqrtf(t));
#else
return cogl_sqrti (t);
#endif

View File

@ -0,0 +1,13 @@
diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c
index fc5541b..0f1a77e 100644
--- a/clutter/clutter-texture.c
+++ b/clutter/clutter-texture.c
@@ -457,7 +457,7 @@ clutter_texture_set_fbo_projection (ClutterActor *self)
/* Set up a projection matrix so that the actor will be projected as
if it was drawn at its original location */
- tan_angle = clutter_tani (CLUTTER_ANGLE_FROM_DEGX (perspective.fovy / 2));
+ tan_angle = clutter_tanx (perspective.fovy / 2);
near_size = CLUTTER_FIXED_MUL (perspective.z_near, tan_angle);
cogl_frustum (CLUTTER_FIXED_MUL (x_min, near_size),

View File

@ -0,0 +1,85 @@
diff --git a/clutter/clutter-units.h b/clutter/clutter-units.h
index 8337d19..2a8ef65 100644
--- a/clutter/clutter-units.h
+++ b/clutter/clutter-units.h
@@ -42,7 +42,7 @@ G_BEGIN_DECLS
*
* Since: 0.4
*/
-typedef gint32 ClutterUnit;
+typedef float ClutterUnit;
/*
* Currently CLUTTER_UNIT maps directly onto ClutterFixed. Nevertheless, the
@@ -50,11 +50,11 @@ typedef gint32 ClutterUnit;
* decide to change this relationship in the future.
*/
-#define CLUTTER_UNITS_FROM_INT(x) (COGL_FIXED_FROM_INT ((x)))
-#define CLUTTER_UNITS_TO_INT(x) (COGL_FIXED_TO_INT ((x)))
+#define CLUTTER_UNITS_FROM_INT(x) ((float)(x))
+#define CLUTTER_UNITS_TO_INT(x) ((int)(x))
-#define CLUTTER_UNITS_FROM_FLOAT(x) (COGL_FIXED_FROM_FLOAT ((x)))
-#define CLUTTER_UNITS_TO_FLOAT(x) (COGL_FIXED_TO_FLOAT ((x)))
+#define CLUTTER_UNITS_FROM_FLOAT(x) (x)
+#define CLUTTER_UNITS_TO_FLOAT(x) (x)
#define CLUTTER_UNITS_FROM_FIXED(x) (x)
#define CLUTTER_UNITS_TO_FIXED(x) (x)
@@ -90,7 +90,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.6
*/
-#define CLUTTER_UNITS_FROM_PANGO_UNIT(x) ((x) << 6)
+#define CLUTTER_UNITS_FROM_PANGO_UNIT(x) ((float)(x / 1024))
/**
* CLUTTER_UNITS_TO_PANGO_UNIT:
@@ -100,7 +100,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.6
*/
-#define CLUTTER_UNITS_TO_PANGO_UNIT(x) ((x) >> 6)
+#define CLUTTER_UNITS_TO_PANGO_UNIT(x) ((int)(x * 1024))
#define CLUTTER_UNITS_FROM_STAGE_WIDTH_PERCENTAGE(x) \
((clutter_actor_get_widthu (clutter_stage_get_default ()) * x) / 100)
@@ -125,8 +125,7 @@ typedef gint32 ClutterUnit;
#define CLUTTER_UNITS_FROM_MM(x) \
(CLUTTER_UNITS_FROM_FLOAT ((((x) * clutter_stage_get_resolution ((ClutterStage *) clutter_stage_get_default ())) / 25.4)))
-#define CLUTTER_UNITS_FROM_MMX(x) \
- (CFX_DIV (CFX_MUL ((x), clutter_stage_get_resolutionx ((ClutterStage *) clutter_stage_get_default ())), 0x196666))
+#define CLUTTER_UNITS_FROM_MMX(x) CLUTTER_UNITS_FROM_MM
/**
* CLUTTER_UNITS_FROM_POINTS:
@@ -139,9 +138,6 @@ typedef gint32 ClutterUnit;
#define CLUTTER_UNITS_FROM_POINTS(x) \
CLUTTER_UNITS_FROM_FLOAT ((((x) * clutter_stage_get_resolution ((ClutterStage *) clutter_stage_get_default ())) / 72.0))
-#define CLUTTER_UNITS_FROM_POINTSX(x) \
- (CFX_MUL ((x), clutter_stage_get_resolutionx ((ClutterStage *) clutter_stage_get_default ())) / 72)
-
#define CLUTTER_TYPE_UNIT (clutter_unit_get_type ())
#define CLUTTER_TYPE_PARAM_UNIT (clutter_param_unit_get_type ())
#define CLUTTER_PARAM_SPEC_UNIT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), CLUTTER_TYPE_PARAM_UNIT, ClutterParamSpecUnit))
@@ -154,7 +150,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.8
*/
-#define CLUTTER_MAXUNIT (0x7fffffff)
+#define CLUTTER_MAXUNIT (G_MAXFLOAT)
/**
* CLUTTER_MINUNIT:
@@ -163,7 +159,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.8
*/
-#define CLUTTER_MINUNIT (0x80000000)
+#define CLUTTER_MINUNIT (-G_MAXFLOAT)
/**
* CLUTTER_VALUE_HOLDS_UNIT:

View File

@ -0,0 +1,17 @@
diff --git a/clutter/cogl/common/cogl-fixed.c b/clutter/cogl/common/cogl-fixed.c
index 348d2ce..2e27da1 100644
--- a/clutter/cogl/common/cogl-fixed.c
+++ b/clutter/cogl/common/cogl-fixed.c
@@ -482,6 +482,12 @@ cogl_angle_sin (CoglAngle angle)
}
CoglFixed
+cogl_fixed_tan (CoglFixed angle)
+{
+ return cogl_angle_tan (COGL_ANGLE_FROM_DEGX (angle));
+}
+
+CoglFixed
cogl_angle_tan (CoglAngle angle)
{
int sign = 1;

View File

@ -0,0 +1,23 @@
diff --git a/clutter/cogl/cogl-fixed.h b/clutter/cogl/cogl-fixed.h
index a521074..8d7c9e9 100644
--- a/clutter/cogl/cogl-fixed.h
+++ b/clutter/cogl/cogl-fixed.h
@@ -456,6 +456,18 @@ G_BEGIN_DECLS
CoglFixed cogl_fixed_sin (CoglFixed angle);
/**
+ * cogl_fixed_tan:
+ * @angle: a #CoglFixed number
+ *
+ * Computes the tangent of @angle.
+ *
+ * Return value: the tangent of the passed angle, in fixed point notation
+ *
+ * Since: 1.0
+ */
+CoglFixed cogl_fixed_tan (CoglFixed angle);
+
+/**
* cogl_fixed_cos:
* @angle: a #CoglFixed number
*

View File

@ -0,0 +1,24 @@
diff --git a/clutter/pango/cogl-pango-render.c b/clutter/pango/cogl-pango-render.c
index 9d1da77..12dfe72 100644
--- a/clutter/pango/cogl-pango-render.c
+++ b/clutter/pango/cogl-pango-render.c
@@ -58,8 +58,6 @@ struct _CoglPangoRendererClass
PangoRendererClass class_instance;
};
-#define COGL_PANGO_UNIT_TO_FIXED(x) ((x) << (COGL_FIXED_Q - 10))
-
static void cogl_pango_renderer_finalize (GObject *object);
static void cogl_pango_renderer_draw_glyphs (PangoRenderer *renderer,
PangoFont *font,
@@ -393,8 +391,8 @@ cogl_pango_renderer_get_device_units (PangoRenderer *renderer,
}
else
{
- *xout = COGL_PANGO_UNIT_TO_FIXED (xin);
- *yout = COGL_PANGO_UNIT_TO_FIXED (yin);
+ *xout = PANGO_PIXELS (xin);
+ *yout = PANGO_PIXELS (yin);
}
}

View File

@ -0,0 +1,12 @@
diff --git a/clutter/cogl/common/cogl-primitives.c b/clutter/cogl/common/cogl-primitives.c
index 7dfc78e..c9578db 100644
--- a/clutter/cogl/common/cogl-primitives.c
+++ b/clutter/cogl/common/cogl-primitives.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <gmodule.h>
+#include <math.h>
#define _COGL_MAX_BEZ_RECURSE_DEPTH 16

View File

@ -0,0 +1,12 @@
diff --git a/clutter/cogl/gl/cogl-primitives.c b/clutter/cogl/gl/cogl-primitives.c
index 98d247a..ec9593b 100644
--- a/clutter/cogl/gl/cogl-primitives.c
+++ b/clutter/cogl/gl/cogl-primitives.c
@@ -34,6 +34,7 @@
#include <string.h>
#include <gmodule.h>
+#include <math.h>
#define _COGL_MAX_BEZ_RECURSE_DEPTH 16

View File

@ -0,0 +1,30 @@
diff --git a/clutter/cogl/gl/cogl-texture.c b/clutter/cogl/gl/cogl-texture.c
index 1bbaaa4..612c417 100644
--- a/clutter/cogl/gl/cogl-texture.c
+++ b/clutter/cogl/gl/cogl-texture.c
@@ -37,6 +37,7 @@
#include <string.h>
#include <stdlib.h>
+#include <math.h>
/*
#define COGL_DEBUG 1
@@ -555,7 +556,7 @@ _cogl_texture_upload_subregion_to_gl (CoglTexture *tex,
guint wx, wy;
src = source_bmp->data
- + (src_y + (y_iter.intersect_start)
+ + (src_y + ((int)y_iter.intersect_start)
- dst_y)
* source_bmp->rowstride
+ (src_x + x_span->start + x_span->size - x_span->waste
@@ -600,7 +601,7 @@ _cogl_texture_upload_subregion_to_gl (CoglTexture *tex,
guint copy_width;
src = source_bmp->data
- + (src_x + (x_iter.intersect_start)
+ + (src_x + ((int)x_iter.intersect_start)
- dst_x)
* bpp
+ (src_y + y_span->start + y_span->size - y_span->waste

View File

@ -0,0 +1,92 @@
diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c
index 7b61b63..dcded98 100644
--- a/clutter/cogl/gl/cogl.c
+++ b/clutter/cogl/gl/cogl.c
@@ -211,17 +211,17 @@ cogl_pop_matrix (void)
void
cogl_scale (float x, float y)
{
- glScaled ((double)(x),
- (double)(y),
+ glScalef ((float)(x),
+ (float)(y),
1.0);
}
void
cogl_translatex (float x, float y, float z)
{
- glTranslated ((double)(x),
- (double)(y),
- (double)(z));
+ glTranslatef ((float)(x),
+ (float)(y),
+ (float)(z));
}
void
@@ -233,10 +233,10 @@ cogl_translate (gint x, gint y, gint z)
void
cogl_rotatex (float angle, gint x, gint y, gint z)
{
- glRotated ((double)(angle),
- (double)(x),
- (double)(y),
- (double)(z));
+ glRotatef ((float)(angle),
+ (float)(x),
+ (float)(y),
+ (float)(z));
}
void
@@ -645,17 +645,13 @@ cogl_perspective (float fovy,
* 2) When working with small numbers, we are loosing significant
* precision
*/
- ymax =
- (zNear *
- (sinf (fovy_rad_half) /
- cosf (fovy_rad_half)));
-
+ ymax = (zNear * (sinf (fovy_rad_half) / cosf (fovy_rad_half)));
xmax = (ymax * aspect);
x = (zNear / xmax);
y = (zNear / ymax);
c = (-(zFar + zNear) / ( zFar - zNear));
- d = cogl_fixed_mul_div (-(2 * zFar), zNear, (zFar - zNear));
+ d = (-(2 * zFar) * zNear) / (zFar - zNear);
#define M(row,col) m[col*4+row]
M(0,0) = (x);
@@ -696,12 +692,12 @@ cogl_frustum (float left,
GE( glMatrixMode (GL_PROJECTION) );
GE( glLoadIdentity () );
- GE( glFrustum ((double)(left),
- (double)(right),
- (double)(bottom),
- (double)(top),
- (double)(z_near),
- (double)(z_far)) );
+ GE( glFrustum ((GLdouble)(left),
+ (GLdouble)(right),
+ (GLdouble)(bottom),
+ (GLdouble)(top),
+ (GLdouble)(z_near),
+ (GLdouble)(z_far)) );
GE( glMatrixMode (GL_MODELVIEW) );
@@ -773,9 +769,7 @@ cogl_setup_viewport (guint width,
{
float fovy_rad = (fovy * G_PI) / 180;
- z_camera =
- ((sinf (fovy_rad) /
- cosf (fovy_rad)) >> 1);
+ z_camera = ((sinf (fovy_rad) / cosf (fovy_rad)) / 2);
}
GE( glTranslatef (-0.5f, -0.5f, -z_camera) );

View File

@ -0,0 +1,19 @@
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index cc56310..4c89c0f 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -781,11 +781,10 @@ clutter_actor_real_allocate (ClutterActor *self,
/* Transform point (x,y,z) by matrix */
static void
-mtx_transform (ClutterFixed m[16],
- ClutterFixed *x, ClutterFixed *y, ClutterFixed *z,
- ClutterFixed *w)
+mtx_transform (float m[16],
+ float *x, float *y, float *z, float *w)
{
- ClutterFixed _x, _y, _z, _w;
+ float _x, _y, _z, _w;
_x = *x;
_y = *y;
_z = *z;

View File

@ -0,0 +1,35 @@
diff --git a/tests/interactive/test-cogl-tex-tile.c b/tests/interactive/test-cogl-tex-tile.c
index fe7138a..5be6dd5 100644
--- a/tests/interactive/test-cogl-tex-tile.c
+++ b/tests/interactive/test-cogl-tex-tile.c
@@ -90,22 +90,22 @@ test_coglbox_paint(ClutterActor *self)
ClutterFixed sin_frame, cos_frame;
ClutterFixed frac_frame;
gint t;
- sin_frame = clutter_sini (CLUTTER_ANGLE_FROM_DEG (priv->frame));
- cos_frame = clutter_cosi (CLUTTER_ANGLE_FROM_DEG (priv->frame));
+ sin_frame = clutter_sinx (CLUTTER_INT_TO_FIXED (priv->frame));
+ cos_frame = clutter_cosx (CLUTTER_INT_TO_FIXED (priv->frame));
pingpong_frame = (priv->frame <= 180 ? priv->frame : 360 - priv->frame);
- frac_frame = COGL_FIXED_DIV (CLUTTER_INT_TO_FIXED (pingpong_frame),
- CLUTTER_INT_TO_FIXED (180));
- frac_frame += (COGL_FIXED_1 >> 1);
- frac_frame <<= 1;
+ frac_frame = CLUTTER_FIXED_DIV (CLUTTER_INT_TO_FIXED (pingpong_frame),
+ CLUTTER_INT_TO_FIXED (180));
+ frac_frame += 0.5;
+ frac_frame *= 2;
for (t=0; t<4; t+=2)
{
texcoords[t] += cos_frame;
texcoords[t+1] += sin_frame;
- texcoords[t] = COGL_FIXED_MUL (texcoords[t], frac_frame);
- texcoords[t+1] = COGL_FIXED_MUL (texcoords[t+1], frac_frame);
+ texcoords[t] = CLUTTER_FIXED_MUL (texcoords[t], frac_frame);
+ texcoords[t+1] = CLUTTER_FIXED_MUL (texcoords[t+1], frac_frame);
}
priv = TEST_COGLBOX_GET_PRIVATE (self);

150
fixed-to-float.sh Executable file
View File

@ -0,0 +1,150 @@
#!/bin/sh
# The ClutterFixed type and macros now use floats, but we are keeping the
# CoglFixed type + macros using fixed point so now we convert all uses of
# the Cogl fixed point macros within Clutter proper to use the ClutterFixed
# macros instead.
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_MUL/CLUTTER_FIXED_MUL/g' {} \;
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_DIV/CLUTTER_FIXED_DIV/g' {} \;
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_FAST_MUL/CLUTTER_FIXED_MUL/g' {} \;
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_FAST_DIV/CLUTTER_FIXED_DIV/g' {} \;
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_FROM_FLOAT/CLUTTER_FLOAT_TO_FIXED/g' {} \;
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_TO_FLOAT/CLUTTER_FIXED_TO_FLOAT/g' {} \;
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_TO_DOUBLE/CLUTTER_FIXED_TO_DOUBLE/g' {} \;
find ./clutter -maxdepth 1 -iname '*.c' -exec sed -i 's/COGL_FIXED_PI/CFX_PI/g' {} \;
# All remaining uses of the Cogl fixed point API now get expanded out to simply
# use float calculations... (we will restore the cogl-fixed code itself later)
# XXX: This assumes that no nested function - with multiple arguments - is ever
# found as the RHS argument to COGL_FIXED_MUL. This is because we simply replace
# the last ',' with the * operator. If you want to double check that's still true:
# $ grep -r --include=*.c COGL_FIXED_MUL *|less
find ./clutter -iname '*.[ch]' -exec sed -i -r 's/COGL_FIXED_MUL (.*),/\1 */g' {} \;
# XXX: We use the same assumption here...
find ./clutter -iname '*.[ch]' -exec sed -i -r 's|COGL_FIXED_FAST_DIV (.*),|\1 /|g' {} \;
# XXX: And again here. (Note in this case there were examples of COGL_FIXED_MUL
# being used as the RHS argument, but since we have already replaced instances
# of COGL_FIXED_MUL, that works out ok.
find ./clutter -iname '*.[ch]' -exec sed -i -r 's|COGL_FIXED_DIV (.*),|\1 /|g' {} \;
# A fix due to the assumptions used above
sed -i 's/#define DET2X(a,b,c,d).*/#define DET2X(a,b,c,d) ((a * d) - (b * c))/g' ./clutter/clutter-actor.c
#we get some redundant brackets like this, but C's automatic type promotion
#works out fine for most cases...
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_TO_INT//g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_FROM_INT//g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_TO_FLOAT//g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_FROM_FLOAT//g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_TO_DOUBLE /(double)/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_FLOOR/floorf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_CEIL/ceilf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_360/360.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_240/240.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_255/255.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_180/180.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_120/120.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_60/60.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_1/1.0/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_0_5/0.5/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/COGL_FIXED_PI/G_PI/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_angle_cos/cosf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_angle_sin/sinf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_angle_tan/tanf/g' {} \;
#XXX: NB: cogl_fixed_div must be done before mul since there is a case were they
#are nested which would otherwise break the assumption used here that the last
#coma of the line can simply be replaced with the corresponding operator
find ./clutter -iname '*.[ch]' -exec sed -i -r 's|cogl_fixed_div (.*),|\1 /|g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i -r 's|cogl_fixed_mul (.*),|\1 *|g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_pow2/pow2f/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_pow/powf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_log2/log2f/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_sqrt/sqrtf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_cos/cosf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_sin/sinf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_atan2/atan2f/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_atan/atanf/g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/cogl_fixed_tan/tanf/g' {} \;
#TODO: fixup gles/cogl.c set_clip_plane
cat clutter/cogl/common/cogl-primitives.c| \
grep -v '#define CFX_MUL2'| \
grep -v '#undef CFX_MUL2'| \
grep -v '#define CFX_MUL3'| \
grep -v '#undef CFX_MUL3'| \
grep -v '#define CFX_SQ'| \
grep -v '#undef CFX_SQ'| \
sed -r 's/CFX_MUL2 \((.{7})\)/(\1 * 2)/g' | \
sed -r 's/CFX_MUL3 \((.{7})\)/(\1 * 3)/g' | \
sed -r 's/CFX_SQ \((.{7})\)/(\1 * \1)/g' \
>./tmp
mv ./tmp clutter/cogl/common/cogl-primitives.c
#this has too many false positives...
#find ./clutter -iname '*.[ch]' -exec sed -i 's|>> 1|/ 2|g' {} \;
#find ./clutter -iname '*.[ch]' -exec sed -i 's|<< 1|* 2|g' {} \;
sed -i 's|>> 1|/ 2|g' ./clutter/cogl/common/cogl-primitives.c
sed -i 's|<< 1|* 2|g' ./clutter/cogl/common/cogl-primitives.c
#find ./clutter -iname '*.[ch]' -exec sed -i 's|<< 1|* 2|g' {} \;
find ./clutter -iname '*.[ch]' -exec sed -i 's/CoglFixed/float/g' {} \;
#XXX: This might need changing later...
find ./clutter -iname '*.[ch]' -exec sed -i 's/CoglFixedVec2/CoglVec2/g' {} \;
sed -i 's/CoglFixed/float/g' ./clutter/cogl/cogl.h.in
# maintain the existing CoglFixed code as utility code for applications:
sed -i 's/float:/CoglFixed:/g' clutter/cogl/cogl-types.h
sed -i 's/gint32 float/gint32 CoglFixed/g' clutter/cogl/cogl-types.h
git-checkout clutter/cogl/cogl-fixed.h clutter/cogl/common/cogl-fixed.c
echo "Cogl API to remove/replace with float versions:"
find ./clutter/ -iname '*.c' -exec grep '^cogl_[a-zA-Z_]*x ' {} \; | cut -d' ' -f1|grep -v 'box$'|grep -v 'matrix$'
echo "Clutter API to remove/replace with float versions:"
find ./clutter/ -iname '*.c' -exec grep '^clutter_[a-zA-Z_]*x ' {} \; | cut -d' ' -f1|grep -v 'box$'|grep -v 'matrix$'|grep -v '_x$'
#
# Now the last mile is dealt with manually with a bunch of patches...
#
git-commit -a -m "[By fixed-to-float.sh] Fixed to Float automatic changes" --no-verify
patch -p1<fixed-to-float-patches/gl-cogl-texture.c.0.patch
patch -p1<fixed-to-float-patches/mtx_transform.0.patch
patch -p1<fixed-to-float-patches/clutter-actor.c.0.patch
patch -p1<fixed-to-float-patches/clutter-alpha.c.0.patch
patch -p1<fixed-to-float-patches/clutter-alpha.h.0.patch
patch -p1<fixed-to-float-patches/clutter-behaviour-ellipse.c.0.patch
patch -p1<fixed-to-float-patches/clutter-bezier.c.0.patch
patch -p1<fixed-to-float-patches/clutter-path.c.0.patch
patch -p1<fixed-to-float-patches/cogl-fixed.h.0.patch
patch -p1<fixed-to-float-patches/cogl-fixed.c.0.patch
patch -p1<fixed-to-float-patches/test-cogl-tex-tile.c.0.patch
patch -p1<fixed-to-float-patches/clutter-texture.c.0.patch
patch -p1<fixed-to-float-patches/clutter-fixed.c.0.patch
patch -p1<fixed-to-float-patches/gl-cogl.c
patch -p1<fixed-to-float-patches/cogl-pango-render.c.0.patch
patch -p1<fixed-to-float-patches/cogl-primitives.c.0.patch
patch -p1<fixed-to-float-patches/gl-cogl-primitives.c.0.patch
#XXX: COGL_PANGO_UNIT_TO_FIXED
git-commit -a -m "[By fixed-to-float.sh] Fixed to Float patches" --no-verify
# The fixes in these files are entirely handcoded, so to avoid clashes with the
# automatic stuff above the patches below are based against the pristine
# versions, and we don't want to commit any of the automatic changes here.
git-checkout HEAD~2 clutter/clutter-fixed.h
git-checkout HEAD~2 clutter/clutter-units.h
patch -p1<fixed-to-float-patches/clutter-fixed.h.0.patch
patch -p1<fixed-to-float-patches/clutter-units.h.0.patch
git-commit -a -m "[By fixed-to-float.sh] clutter-fixed.h and clutter-units.h changes" --no-verify