Removes the fixed-to-float scripts and patches

Now that the conversion has been applied the scripts aren't needed any more
This commit is contained in:
Robert Bragg 2009-01-20 18:52:15 +00:00
parent 3014d4ff8a
commit 4bc1e567fc
26 changed files with 0 additions and 2833 deletions

View File

@ -1,27 +0,0 @@
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 1e481cd..9cbee04 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -806,7 +806,7 @@ static inline void
mtx_transform (const ClutterFixed m[],
fixed_vertex_t *vertex)
{
- ClutterFixed _x, _y, _z, _w;
+ float _x, _y, _z, _w;
_x = vertex->x;
_y = vertex->y;
@@ -846,8 +846,11 @@ 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) (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)))
/* transforms a 4-tuple of coordinates using @matrix and

View File

@ -1,306 +0,0 @@
diff --git a/clutter/clutter-alpha.c b/clutter/clutter-alpha.c
index 60ef0d3..dda0f6c 100644
--- a/clutter/clutter-alpha.c
+++ b/clutter/clutter-alpha.c
@@ -697,6 +697,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,
float angle,
@@ -716,7 +721,7 @@ sincx1024_func (ClutterAlpha *alpha,
x -= (512 * 512 / angle);
- sine = ((sinf (x * (G_PI/180.0)) + offset) / 2)
+ sine = ((cogl_angle_sin (x) + offset) / 2)
* CLUTTER_ALPHA_MAX_ALPHA;
sine = sine >> COGL_FIXED_Q;
@@ -724,11 +729,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,
@@ -747,7 +747,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));
@@ -806,9 +806,28 @@ 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);
+
+ /* shift from range [-1, 1] -> [0, 1] */
+ sine = (sine + 1.0) / 2.0;
+
+ CLUTTER_NOTE (ALPHA, "sine: %2f\n", sine);
+
+ return 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
@@ -842,18 +861,17 @@ clutter_sine_inc_func (ClutterAlpha *alpha,
ClutterTimeline * timeline;
gint frame;
gint n_frames;
- float 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 * (G_PI/180.0)) * 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);
}
/**
@@ -884,18 +902,17 @@ clutter_sine_dec_func (ClutterAlpha *alpha,
ClutterTimeline * timeline;
gint frame;
gint n_frames;
- float 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 * (G_PI/180.0)) * 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);
}
/**
@@ -926,18 +943,17 @@ clutter_sine_half_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- float 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 * (G_PI/180.0)) * CLUTTER_ALPHA_MAX_ALPHA;
-
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -962,19 +978,20 @@ clutter_sine_in_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- float 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;
+ radians = ((float)frame / n_frames) * (G_PI / 2);
+ sine = sinf (radians - (G_PI / 2));
- sine = (sinf (x * (G_PI/180.0)) + 1) * CLUTTER_ALPHA_MAX_ALPHA;
+ /* shift from range [-1, 0] -> [0, 1] */
+ sine = sine + 1.0;
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -998,18 +1015,17 @@ clutter_sine_out_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- float 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 * (G_PI/180.0)) * 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);
}
/**
@@ -1034,18 +1050,20 @@ clutter_sine_in_out_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- float 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));
- sine = (sinf (x * (G_PI/180.0)) + 1) / 2 * CLUTTER_ALPHA_MAX_ALPHA;
+ /* shift from range [-1, 1] -> [0, 1] */
+ sine = (sine + 1.0) / 2.0;
- return ((guint32) sine) >> COGL_FIXED_Q;
+ return (guint32) (sine * CLUTTER_ALPHA_MAX_ALPHA);
}
/**
@@ -1113,30 +1131,23 @@ clutter_smoothstep_inc_func (ClutterAlpha *alpha,
ClutterTimeline *timeline;
gint frame;
gint n_frames;
- guint32 r;
- guint32 x;
+ float r;
+ float x;
/*
* The smoothstep function uses f(x) = -2x^3 + 3x^2 where x is from <0,1>,
- * and precission is critical -- we use 8.24 fixed format for this operation.
- * The earlier operations involve division, which we cannot do in 8.24 for
- * numbers in <0,1> we use ClutterFixed.
+ * and precission is critical.
*/
timeline = clutter_alpha_get_timeline (alpha);
frame = clutter_timeline_get_current_frame (timeline);
n_frames = clutter_timeline_get_n_frames (timeline);
- /*
- * Convert x to 8.24 for next step.
- */
- x = CLUTTER_FIXED_DIV (frame, n_frames) << 8;
+ x = (float)frame / n_frames;
/*
* f(x) = -2x^3 + 3x^2
- *
- * Convert result to ClutterFixed to avoid overflow in next step.
*/
- r = ((x >> 12) * (x >> 12) * 3 - (x >> 15) * (x >> 16) * (x >> 16)) >> 8;
+ r = -2 * x * x * x + 3 * x * x;
return (r * CLUTTER_ALPHA_MAX_ALPHA);
}
@@ -1204,9 +1215,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);
@@ -1214,7 +1225,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;
}
@@ -1255,9 +1266,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);
@@ -1265,7 +1276,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

@ -1,13 +0,0 @@
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

@ -1,380 +0,0 @@
diff --git a/clutter/clutter-behaviour-ellipse.c b/clutter/clutter-behaviour-ellipse.c
index 162a949..4212b95 100644
--- a/clutter/clutter-behaviour-ellipse.c
+++ b/clutter/clutter-behaviour-ellipse.c
@@ -190,17 +190,13 @@ actor_apply_knot_foreach (ClutterBehaviour *behave,
static inline float
clamp_angle (float a)
{
- float a1, a2;
gint 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;
+ rounds = a / 360;
+ if (a < 0)
+ rounds--;
- return a2;
+ return a - 360 * rounds;
}
static void
@@ -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);
}
/**
@@ -805,7 +788,7 @@ clutter_behaviour_ellipse_set_angle_startx (ClutterBehaviourEllipse *self,
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);
}
/**
@@ -891,7 +875,7 @@ clutter_behaviour_ellipse_set_angle_endx (ClutterBehaviourEllipse *self,
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);
}
/**
@@ -983,7 +967,7 @@ clutter_behaviour_ellipse_set_angle_tiltx (ClutterBehaviourEllipse *self,
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;
@@ -1100,9 +1084,9 @@ clutter_behaviour_ellipse_set_tilt (ClutterBehaviourEllipse *self,
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 = (float)angle_tilt_x;
+ new_angle_y = (float)angle_tilt_y;
+ new_angle_z = (float)angle_tilt_z;
priv = self->priv;
@@ -1154,9 +1138,9 @@ clutter_behaviour_ellipse_set_tiltx (ClutterBehaviourEllipse *self,
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 = CLUTTER_FIXED_TO_FLOAT (angle_tilt_x);
+ new_angle_y = CLUTTER_FIXED_TO_FLOAT (angle_tilt_y);
+ new_angle_z = CLUTTER_FIXED_TO_FLOAT (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

@ -1,13 +0,0 @@
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

@ -1,15 +0,0 @@
diff --git a/clutter/clutter-fixed.c b/clutter/clutter-fixed.c
index 3027a75..315fe32 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

@ -1,333 +0,0 @@
diff --git a/clutter/clutter-fixed.h b/clutter/clutter-fixed.h
index 3ae0916..61e2fd4 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 * (G_PI/180.0))
+#define clutter_tanx(a) tanf (a * (G_PI/180.0))
+#define clutter_atanx(a) atanf (a * (G_PI/180.0))
+#define clutter_atan2x(x,y) atan2f (x, y)
+#define clutter_cosx(a) cosf (a * (G_PI/180.0))
#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

@ -1,18 +0,0 @@
diff --git a/clutter/clutter-path.c b/clutter/clutter-path.c
index 6f93402..c459cdf 100644
--- a/clutter/clutter-path.c
+++ b/clutter/clutter-path.c
@@ -1217,11 +1217,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

@ -1,13 +0,0 @@
diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c
index b0b46e4..8a306e9 100644
--- a/clutter/clutter-texture.c
+++ b/clutter/clutter-texture.c
@@ -474,7 +474,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 = tanf (COGL_ANGLE_FROM_DEGX (perspective.fovy / 2 * (G_PI/180.0)));
+ tan_angle = tanf ((perspective.fovy / 2) * (G_PI/180.0));
near_size = CLUTTER_FIXED_MUL (perspective.z_near, tan_angle);
cogl_frustum (CLUTTER_FIXED_MUL (tx_min, near_size),

View File

@ -1,91 +0,0 @@
diff --git a/clutter/clutter-units.h b/clutter/clutter-units.h
index b85375a..1084095 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,16 +50,16 @@ 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)
-#define CLUTTER_UNITS_FORMAT "d"
+#define CLUTTER_UNITS_FORMAT "f"
/**
* CLUTTER_UNITS_FROM_DEVICE:
@@ -92,7 +92,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:
@@ -102,7 +102,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)
@@ -127,8 +127,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:
@@ -141,9 +140,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))
@@ -156,7 +152,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.8
*/
-#define CLUTTER_MAXUNIT (0x7fffffff)
+#define CLUTTER_MAXUNIT (G_MAXFLOAT)
/**
* CLUTTER_MINUNIT:
@@ -165,7 +161,7 @@ typedef gint32 ClutterUnit;
*
* Since: 0.8
*/
-#define CLUTTER_MINUNIT (0x80000000)
+#define CLUTTER_MINUNIT (-G_MAXFLOAT)
/**
* CLUTTER_VALUE_HOLDS_UNIT:

View File

@ -1,17 +0,0 @@
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

@ -1,23 +0,0 @@
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

@ -1,24 +0,0 @@
diff --git a/clutter/pango/cogl-pango-render.c b/clutter/pango/cogl-pango-render.c
index d8f87fb..3e23309 100644
--- a/clutter/pango/cogl-pango-render.c
+++ b/clutter/pango/cogl-pango-render.c
@@ -102,8 +102,6 @@ cogl_pango_renderer_draw_glyph (CoglPangoRenderer *priv,
*(p++) = cache_value->tx2; *(p++) = cache_value->ty2;
}
-#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,
@@ -439,8 +437,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

@ -1,12 +0,0 @@
diff --git a/clutter/cogl/common/cogl-primitives.c b/clutter/cogl/common/cogl-primitives.c
index 27e0e36..27834f7 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

@ -1,26 +0,0 @@
diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in
index cc26f88..f37d54d 100644
--- a/clutter/cogl/cogl.h.in
+++ b/clutter/cogl/cogl.h.in
@@ -271,9 +271,9 @@ void cogl_translate (gint x,
* rotation.
*/
void cogl_rotatex (float angle,
- gint x,
- gint y,
- gint z);
+ float x,
+ float y,
+ float z);
/**
* cogl_rotate:
@@ -442,7 +442,7 @@ void cogl_enable_backface_culling (gboolean setting);
* comparing with the value in @ref. The default function is CGL_ALWAYS the
* initial reference value is 1.0.
*/
-void cogl_alpha_func (COGLenum func,
+void cogl_alpha_func (COGLenum func,
float ref);
/**

View File

@ -1,12 +0,0 @@
diff --git a/clutter/cogl/gl/cogl-primitives.c b/clutter/cogl/gl/cogl-primitives.c
index dc5c5c6..8a0843d 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

@ -1,30 +0,0 @@
diff --git a/clutter/cogl/gl/cogl-texture.c b/clutter/cogl/gl/cogl-texture.c
index 5b7326c..1dac073 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

@ -1,172 +0,0 @@
diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c
index 7b61b63..d815e3b 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
@@ -231,12 +231,12 @@ cogl_translate (gint x, gint y, gint z)
}
void
-cogl_rotatex (float angle, gint x, gint y, gint z)
+cogl_rotatex (float angle, float x, float y, float 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) );
@@ -1166,73 +1160,19 @@ cogl_features_available (CoglFeatureFlags features)
void
cogl_get_modelview_matrix (float m[16])
{
- GLdouble md[16];
-
- glGetDoublev(GL_MODELVIEW_MATRIX, &md[0]);
-
-#define M(m,row,col) m[col*4+row]
- M(m,0,0) = (M(md,0,0));
- M(m,0,1) = (M(md,0,1));
- M(m,0,2) = (M(md,0,2));
- M(m,0,3) = (M(md,0,3));
-
- M(m,1,0) = (M(md,1,0));
- M(m,1,1) = (M(md,1,1));
- M(m,1,2) = (M(md,1,2));
- M(m,1,3) = (M(md,1,3));
-
- M(m,2,0) = (M(md,2,0));
- M(m,2,1) = (M(md,2,1));
- M(m,2,2) = (M(md,2,2));
- M(m,2,3) = (M(md,2,3));
-
- M(m,3,0) = (M(md,3,0));
- M(m,3,1) = (M(md,3,1));
- M(m,3,2) = (M(md,3,2));
- M(m,3,3) = (M(md,3,3));
-#undef M
+ glGetFloatv (GL_MODELVIEW_MATRIX, m);
}
void
cogl_get_projection_matrix (float m[16])
{
- GLdouble md[16];
-
- glGetDoublev(GL_PROJECTION_MATRIX, &md[0]);
-
-#define M(m,row,col) m[col*4+row]
- M(m,0,0) = (M(md,0,0));
- M(m,0,1) = (M(md,0,1));
- M(m,0,2) = (M(md,0,2));
- M(m,0,3) = (M(md,0,3));
-
- M(m,1,0) = (M(md,1,0));
- M(m,1,1) = (M(md,1,1));
- M(m,1,2) = (M(md,1,2));
- M(m,1,3) = (M(md,1,3));
-
- M(m,2,0) = (M(md,2,0));
- M(m,2,1) = (M(md,2,1));
- M(m,2,2) = (M(md,2,2));
- M(m,2,3) = (M(md,2,3));
-
- M(m,3,0) = (M(md,3,0));
- M(m,3,1) = (M(md,3,1));
- M(m,3,2) = (M(md,3,2));
- M(m,3,3) = (M(md,3,3));
-#undef M
+ glGetFloatv (GL_PROJECTION_MATRIX, m);
}
void
cogl_get_viewport (float v[4])
{
- GLdouble vd[4];
- glGetDoublev(GL_VIEWPORT, &vd[0]);
-
- v[0] = (vd[0]);
- v[1] = (vd[1]);
- v[2] = (vd[2]);
- v[3] = (vd[3]);
+ glGetFloatv (GL_VIEWPORT, v);
}
void

View File

@ -1,90 +0,0 @@
diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.c b/clutter/cogl/gles/cogl-gles2-wrapper.c
index b2e19eb..a7800c5 100644
--- a/clutter/cogl/gles/cogl-gles2-wrapper.c
+++ b/clutter/cogl/gles/cogl-gles2-wrapper.c
@@ -515,15 +515,6 @@ cogl_gles2_wrapper_update_matrix (CoglGles2Wrapper *wrapper, GLenum matrix_num)
}
void
-cogl_wrap_glClearColorx (GLclampx r, GLclampx g, GLclampx b, GLclampx a)
-{
- glClearColor ( (r),
- (g),
- (b),
- (a));
-}
-
-void
cogl_wrap_glPushMatrix ()
{
const float *src;
@@ -1143,13 +1134,9 @@ cogl_wrap_glAlphaFunc (GLenum func, GLclampf ref)
}
void
-cogl_wrap_glColor4f (GLclampx r, GLclampx g, GLclampx b, GLclampx a)
+cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a)
{
- glVertexAttrib4f (COGL_GLES2_WRAPPER_COLOR_ATTRIB,
- (r),
- (g),
- (b),
- (a));
+ glVertexAttrib4f (COGL_GLES2_WRAPPER_COLOR_ATTRIB, r, g, b, a);
}
void
@@ -1158,15 +1145,6 @@ cogl_wrap_glClipPlanex (GLenum plane, GLfloat *equation)
/* FIXME */
}
-static void
-cogl_gles2_float_array_to_fixed (int size,
- const GLfloat *floats,
- GLfloat *fixeds)
-{
- while (size-- > 0)
- *(fixeds++) = (*(floats++));
-}
-
void
cogl_wrap_glGetIntegerv (GLenum pname, GLint *params)
{
@@ -1185,31 +1163,24 @@ cogl_wrap_glGetIntegerv (GLenum pname, GLint *params)
}
void
-cogl_wrap_glGetFixedv (GLenum pname, GLfloat *params)
+cogl_wrap_glGetFloatv (GLenum pname, GLfloat *params)
{
_COGL_GET_GLES2_WRAPPER (w, NO_RETVAL);
switch (pname)
{
case GL_MODELVIEW_MATRIX:
- cogl_gles2_float_array_to_fixed (16, w->modelview_stack
- + w->modelview_stack_pos * 16,
- params);
+ memcpy (params, w->modelview_stack + w->modelview_stack_pos * 16,
+ sizeof (GLfloat) * 16);
break;
case GL_PROJECTION_MATRIX:
- cogl_gles2_float_array_to_fixed (16, w->projection_stack
- + w->projection_stack_pos * 16,
- params);
+ memcpy (params, w->projection_stack + w->projection_stack_pos * 16,
+ sizeof (GLfloat) * 16);
break;
case GL_VIEWPORT:
- {
- GLfloat v[4];
-
- glGetFloatv (GL_VIEWPORT, v);
- cogl_gles2_float_array_to_fixed (4, v, params);
- }
+ glGetFloatv (GL_VIEWPORT, params);
break;
}
}

View File

@ -1,76 +0,0 @@
diff --git a/clutter/cogl/gles/cogl-gles2-wrapper.h b/clutter/cogl/gles/cogl-gles2-wrapper.h
index cb700cc..f126993 100644
--- a/clutter/cogl/gles/cogl-gles2-wrapper.h
+++ b/clutter/cogl/gles/cogl-gles2-wrapper.h
@@ -203,8 +203,6 @@ struct _CoglGles2WrapperShader
void cogl_gles2_wrapper_init (CoglGles2Wrapper *wrapper);
void cogl_gles2_wrapper_deinit (CoglGles2Wrapper *wrapper);
-void cogl_wrap_glClearColorx (GLclampx r, GLclampx g, GLclampx b, GLclampx a);
-
void cogl_wrap_glPushMatrix ();
void cogl_wrap_glPopMatrix ();
void cogl_wrap_glMatrixMode (GLenum mode);
@@ -239,12 +237,12 @@ void cogl_wrap_glDisableClientState (GLenum array);
void cogl_wrap_glAlphaFunc (GLenum func, GLclampf ref);
-void cogl_wrap_glColor4f (GLclampx r, GLclampx g, GLclampx b, GLclampx a);
+void cogl_wrap_glColor4f (GLclampf r, GLclampf g, GLclampf b, GLclampf a);
void cogl_wrap_glClipPlanef (GLenum plane, GLfloat *equation);
void cogl_wrap_glGetIntegerv (GLenum pname, GLint *params);
-void cogl_wrap_glGetFixedv (GLenum pname, GLfloat *params);
+void cogl_wrap_glGetFloatv (GLenum pname, GLfloat *params);
void cogl_wrap_glFogf (GLenum pname, GLfloat param);
void cogl_wrap_glFogfv (GLenum pname, const GLfloat *params);
@@ -273,35 +271,34 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
/* If we're not using GL ES 2 then just use the GL functions
directly */
-#define cogl_wrap_glClearColorx glClearColorx
#define cogl_wrap_glDrawArrays glDrawArrays
#define cogl_wrap_glDrawElements glDrawElements
#define cogl_wrap_glPushMatrix glPushMatrix
#define cogl_wrap_glPopMatrix glPopMatrix
#define cogl_wrap_glMatrixMode glMatrixMode
#define cogl_wrap_glLoadIdentity glLoadIdentity
-#define cogl_wrap_glMultMatrixf glMultMatrixx
-#define cogl_wrap_glFrustumf glFrustumx
-#define cogl_wrap_glScalef glScalex
-#define cogl_wrap_glTranslatef glTranslatex
-#define cogl_wrap_glRotatef glRotatex
-#define cogl_wrap_glOrthof glOrthox
+#define cogl_wrap_glMultMatrixf glMultMatrixf
+#define cogl_wrap_glFrustumf glFrustumf
+#define cogl_wrap_glScalef glScalef
+#define cogl_wrap_glTranslatef glTranslatef
+#define cogl_wrap_glRotatef glRotatef
+#define cogl_wrap_glOrthof glOrthof
#define cogl_wrap_glEnable glEnable
#define cogl_wrap_glDisable glDisable
#define cogl_wrap_glTexCoordPointer glTexCoordPointer
#define cogl_wrap_glVertexPointer glVertexPointer
#define cogl_wrap_glColorPointer glColorPointer
#define cogl_wrap_glNormalPointer glNormalPointer
-#define cogl_wrap_glTexEnvf glTexEnvx
+#define cogl_wrap_glTexEnvf glTexEnvf
#define cogl_wrap_glEnableClientState glEnableClientState
#define cogl_wrap_glDisableClientState glDisableClientState
#define cogl_wrap_glAlphaFunc glAlphaFunc
-#define cogl_wrap_glColor4f glColor4x
-#define cogl_wrap_glClipPlanef glClipPlanex
+#define cogl_wrap_glColor4f glColor4f
+#define cogl_wrap_glClipPlanef glClipPlanef
#define cogl_wrap_glGetIntegerv glGetIntegerv
-#define cogl_wrap_glGetFixedv glGetFixedv
-#define cogl_wrap_glFogf glFogx
-#define cogl_wrap_glFogfv glFogxv
+#define cogl_wrap_glGetFloatv glGetFloatv
+#define cogl_wrap_glFogf glFogf
+#define cogl_wrap_glFogfv glFogfv
#define cogl_wrap_glTexParameteri glTexParameteri
/* The extra third parameter of the bind texture wrapper isn't needed

View File

@ -1,12 +0,0 @@
diff --git a/clutter/cogl/gles/cogl-primitives.c b/clutter/cogl/gles/cogl-primitives.c
index 901fa5d..d8fe121 100644
--- a/clutter/cogl/gles/cogl-primitives.c
+++ b/clutter/cogl/gles/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

@ -1,30 +0,0 @@
diff --git a/clutter/cogl/gles/cogl-texture.c b/clutter/cogl/gles/cogl-texture.c
index ca48a33..e054d84 100644
--- a/clutter/cogl/gles/cogl-texture.c
+++ b/clutter/cogl/gles/cogl-texture.c
@@ -39,6 +39,7 @@
#include <string.h>
#include <stdlib.h>
+#include <math.h>
#define glVertexPointer cogl_wrap_glVertexPointer
#define glTexCoordPointer cogl_wrap_glTexCoordPointer
@@ -768,7 +769,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
@@ -813,7 +814,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

@ -1,102 +0,0 @@
diff --git a/clutter/cogl/gles/cogl.c b/clutter/cogl/gles/cogl.c
index 422d8b6..cb7aa8e 100644
--- a/clutter/cogl/gles/cogl.c
+++ b/clutter/cogl/gles/cogl.c
@@ -37,6 +37,7 @@
#include "cogl-context.h"
#include "cogl-gles2-wrapper.h"
+#include <math.h>
/* GL error to string conversion */
#if COGL_DEBUG
@@ -92,10 +93,10 @@ cogl_paint_init (const CoglColor *color)
fprintf(stderr, "\n ============== Paint Start ================ \n");
#endif
- cogl_wrap_glClearColorx (cogl_color_get_red (color),
- cogl_color_get_green (color),
- cogl_color_get_blue (color),
- 0);
+ glClearColor (cogl_color_get_red (color),
+ cogl_color_get_green (color),
+ cogl_color_get_blue (color),
+ 0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
cogl_wrap_glDisable (GL_LIGHTING);
@@ -365,9 +366,8 @@ set_clip_plane (GLint plane_num,
/* Calculate the angle between the axes and the line crossing the
two points */
- angle = (atan2f (vertex_b[1] - vertex_a[1] *
- vertex_b[0] - vertex_a[0]),
- COGL_RADIANS_TO_DEGREES);
+ angle = atan2f (vertex_b[1] - vertex_a[1],
+ vertex_b[0] - vertex_a[0]) * (180.0/G_PI);
GE( cogl_wrap_glPushMatrix () );
/* Load the identity matrix and multiply by the reverse of the
@@ -405,8 +405,8 @@ _cogl_set_clip_planes (float x_offset,
float vertex_br[4] = { x_offset + width, y_offset + height,
0, 1.0 };
- GE( cogl_wrap_glGetFixedv (GL_MODELVIEW_MATRIX, modelview) );
- GE( cogl_wrap_glGetFixedv (GL_PROJECTION_MATRIX, projection) );
+ GE( cogl_wrap_glGetFloatv (GL_MODELVIEW_MATRIX, modelview) );
+ GE( cogl_wrap_glGetFloatv (GL_PROJECTION_MATRIX, projection) );
project_vertex (modelview, projection, vertex_tl);
project_vertex (modelview, projection, vertex_tr);
@@ -558,15 +558,13 @@ cogl_perspective (float fovy,
* 2) When working with small numbers, we can 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 = (-((2 * zFar * zNear)) / (zFar - zNear));
+ d = (-(2 * zFar) * zNear) / (zFar - zNear);
#define M(row,col) m[col*4+row]
M(0,0) = x;
@@ -671,13 +669,13 @@ cogl_setup_viewport (guint w,
if (fovy != 60.0)
{
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( cogl_wrap_glTranslatef (-1 << 15, -1 << 15, -z_camera) );
+
+ GE( cogl_wrap_glTranslatef (-0.5f, -0.5f, -z_camera) );
GE( cogl_wrap_glScalef ( 1.0 / width,
-1.0 / height,
@@ -737,13 +735,13 @@ cogl_features_available (CoglFeatureFlags features)
void
cogl_get_modelview_matrix (float m[16])
{
- cogl_wrap_glGetFixedv(GL_MODELVIEW_MATRIX, &m[0]);
+ cogl_wrap_glGetFloatv (GL_MODELVIEW_MATRIX, m);
}
void
cogl_get_projection_matrix (float m[16])
{
- cogl_wrap_glGetFixedv(GL_PROJECTION_MATRIX, &m[0]);
+ cogl_wrap_glGetFloatv (GL_PROJECTION_MATRIX, m);
}
void

View File

@ -1,735 +0,0 @@
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 9cbee04..e0903fe 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -1348,8 +1348,8 @@ _clutter_actor_apply_modelview_transform (ClutterActor *self)
gboolean is_stage = CLUTTER_IS_STAGE (self);
if (!is_stage)
- cogl_translatex (CLUTTER_UNITS_TO_FIXED (priv->allocation.x1),
- CLUTTER_UNITS_TO_FIXED (priv->allocation.y1),
+ cogl_translate (CLUTTER_UNITS_TO_FLOAT (priv->allocation.x1),
+ CLUTTER_UNITS_TO_FLOAT (priv->allocation.y1),
0);
/*
@@ -1363,50 +1363,50 @@ _clutter_actor_apply_modelview_transform (ClutterActor *self)
if (priv->rzang)
{
- cogl_translatex (CLUTTER_UNITS_TO_FIXED (priv->rzx),
- CLUTTER_UNITS_TO_FIXED (priv->rzy),
+ cogl_translate (CLUTTER_UNITS_TO_FLOAT (priv->rzx),
+ CLUTTER_UNITS_TO_FLOAT (priv->rzy),
0);
- cogl_rotatex (priv->rzang, 0, 0, 1.0);
+ cogl_rotate (priv->rzang, 0, 0, 1.0);
- cogl_translatex (CLUTTER_UNITS_TO_FIXED (-priv->rzx),
- CLUTTER_UNITS_TO_FIXED (-priv->rzy),
+ cogl_translate (CLUTTER_UNITS_TO_FLOAT (-priv->rzx),
+ CLUTTER_UNITS_TO_FLOAT (-priv->rzy),
0);
}
if (priv->ryang)
{
- cogl_translatex (CLUTTER_UNITS_TO_FIXED (priv->ryx),
+ cogl_translate (CLUTTER_UNITS_TO_FLOAT (priv->ryx),
0,
- CLUTTER_UNITS_TO_FIXED (priv->z + priv->ryz));
+ CLUTTER_UNITS_TO_FLOAT (priv->z + priv->ryz));
- cogl_rotatex (priv->ryang, 0, 1.0, 0);
+ cogl_rotate (priv->ryang, 0, 1.0, 0);
- cogl_translatex (CLUTTER_UNITS_TO_FIXED (-priv->ryx),
+ cogl_translate (CLUTTER_UNITS_TO_FLOAT (-priv->ryx),
0,
- CLUTTER_UNITS_TO_FIXED (-(priv->z + priv->ryz)));
+ CLUTTER_UNITS_TO_FLOAT (-(priv->z + priv->ryz)));
}
if (priv->rxang)
{
- cogl_translatex (0,
- CLUTTER_UNITS_TO_FIXED (priv->rxy),
- CLUTTER_UNITS_TO_FIXED (priv->z + priv->rxz));
+ cogl_translate (0,
+ CLUTTER_UNITS_TO_FLOAT (priv->rxy),
+ CLUTTER_UNITS_TO_FLOAT (priv->z + priv->rxz));
- cogl_rotatex (priv->rxang, 1.0, 0, 0);
+ cogl_rotate (priv->rxang, 1.0, 0, 0);
- cogl_translatex (0,
- CLUTTER_UNITS_TO_FIXED (-priv->rxy),
- CLUTTER_UNITS_TO_FIXED (-(priv->z + priv->rxz)));
+ cogl_translate (0,
+ CLUTTER_UNITS_TO_FLOAT (-priv->rxy),
+ CLUTTER_UNITS_TO_FLOAT (-(priv->z + priv->rxz)));
}
if (!is_stage && (priv->anchor_x || priv->anchor_y))
- cogl_translatex (CLUTTER_UNITS_TO_FIXED (-priv->anchor_x),
- CLUTTER_UNITS_TO_FIXED (-priv->anchor_y),
+ cogl_translate (CLUTTER_UNITS_TO_FLOAT (-priv->anchor_x),
+ CLUTTER_UNITS_TO_FLOAT (-priv->anchor_y),
0);
if (priv->z)
- cogl_translatex (0, 0, priv->z);
+ cogl_translate (0, 0, priv->z);
}
/* Recursively applies the transforms associated with this actor and
diff --git a/clutter/cogl/cogl-color.h b/clutter/cogl/cogl-color.h
index 6cdf52b..05650d3 100644
--- a/clutter/cogl/cogl-color.h
+++ b/clutter/cogl/cogl-color.h
@@ -68,7 +68,7 @@ void cogl_color_set_from_4d (CoglColor *dest,
gdouble alpha);
/**
- * cogl_color_set_from_4x:
+ * cogl_color_set_from_4f:
* @dest: return location for a #CoglColor
* @red: value of the red channel, between 0 and %1.0
* @green: value of the green channel, between 0 and %1.0
@@ -79,7 +79,7 @@ void cogl_color_set_from_4d (CoglColor *dest,
*
* Since: 1.0
*/
-void cogl_color_set_from_4x (CoglColor *dest,
+void cogl_color_set_from_4f (CoglColor *dest,
float red,
float green,
float blue,
@@ -248,7 +248,7 @@ float cogl_color_get_alpha (const CoglColor *color);
* Sets the source color using normalized values for each component.
* This color will be used for any subsequent drawing operation.
*
- * See also cogl_set_source_color4ub() and cogl_set_source_color4x()
+ * See also cogl_set_source_color4ub() and cogl_set_source_color4f()
* if you already have the color components.
*
* Since: 1.0
@@ -276,7 +276,7 @@ void cogl_set_source_color4ub (guint8 red,
guint8 alpha);
/**
- * cogl_set_source_color4x:
+ * cogl_set_source_color4f:
* @red: value of the red channel, between 0 and %1.0
* @green: value of the green channel, between 0 and %1.0
* @blue: value of the blue channel, between 0 and %1.0
@@ -291,7 +291,7 @@ void cogl_set_source_color4ub (guint8 red,
*
* Since: 1.0
*/
-void cogl_set_source_color4x (float red,
+void cogl_set_source_color4f (float red,
float green,
float blue,
float alpha);
diff --git a/clutter/cogl/cogl-path.h b/clutter/cogl/cogl-path.h
index 0d29829..aa37864 100644
--- a/clutter/cogl/cogl-path.h
+++ b/clutter/cogl/cogl-path.h
@@ -60,24 +60,10 @@ G_BEGIN_DECLS
* Fills a rectangle at the given coordinates with the current
* drawing color in a highly optimizied fashion.
**/
-void cogl_rectangle (gint x,
- gint y,
- guint width,
- guint height);
-
-/**
- * cogl_rectanglex:
- * @x: X coordinate of the top-left corner
- * @y: Y coordinate of the top-left corner
- * @width: Width of the rectangle
- * @height: Height of the rectangle
- *
- * A fixed-point version of cogl_fast_fill_rectangle.
- **/
-void cogl_rectanglex (float x,
- float y,
- float width,
- float height);
+void cogl_rectangle (float x,
+ float y,
+ float width,
+ float height);
/**
* cogl_path_fill:
diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in
index f37d54d..f8d5745 100644
--- a/clutter/cogl/cogl.h.in
+++ b/clutter/cogl/cogl.h.in
@@ -231,7 +231,7 @@ void cogl_scale (float x,
float y);
/**
- * cogl_translatex:
+ * cogl_translate:
* @x: Distance to translate along the x-axis
* @y: Distance to translate along the y-axis
* @z: Distance to translate along the z-axis
@@ -239,26 +239,12 @@ void cogl_scale (float x,
* Multiplies the current model-view matrix by one that translates the
* model along all three axes according to the given values.
*/
-void cogl_translatex (float x,
- float y,
- float z);
-
-/**
- * cogl_translate:
- * @x: Distance to translate along the x-axis
- * @y: Distance to translate along the y-axis
- * @z: Distance to translate along the z-axis
- *
- * Integer version of cogl_translatex(). Multiplies the current
- * model-view matrix by one that translates the model along all three
- * axes according to the given values.
- */
-void cogl_translate (gint x,
- gint y,
- gint z);
+void cogl_translate (float x,
+ float y,
+ float z);
/**
- * cogl_rotatex:
+ * cogl_rotate:
* @angle: Angle in degrees to rotate.
* @x: X-component of vertex to rotate around.
* @y: Y-component of vertex to rotate around.
@@ -270,26 +256,10 @@ void cogl_translate (gint x,
* degrees about the vertex (0, 0, 1) causes a small counter-clockwise
* rotation.
*/
-void cogl_rotatex (float angle,
- float x,
- float y,
- float z);
-
-/**
- * cogl_rotate:
- * @angle: Angle in degrees to rotate.
- * @x: X-component of vertex to rotate around.
- * @y: Y-component of vertex to rotate around.
- * @z: Z-component of vertex to rotate around.
- *
- * Integer version of cogl_rotatex(). Multiplies the current
- * model-view matrix by one that rotates the model around the vertex
- * specified by @x, @y and @z.
- */
-void cogl_rotate (gint angle,
- gint x,
- gint y,
- gint z);
+void cogl_rotate (float angle,
+ float x,
+ float y,
+ float z);
/**
* cogl_get_modelview_matrix:
diff --git a/clutter/cogl/common/cogl-color.c b/clutter/cogl/common/cogl-color.c
index dac3584..e4b74c6 100644
--- a/clutter/cogl/common/cogl-color.c
+++ b/clutter/cogl/common/cogl-color.c
@@ -58,7 +58,7 @@ cogl_color_set_from_4d (CoglColor *dest,
}
void
-cogl_color_set_from_4x (CoglColor *dest,
+cogl_color_set_from_4f (CoglColor *dest,
float red,
float green,
float blue,
@@ -157,13 +157,13 @@ cogl_set_source_color4ub (guint8 red,
}
void
-cogl_set_source_color4x (float red,
+cogl_set_source_color4f (float red,
float green,
float blue,
float alpha)
{
CoglColor c = { 0, };
- cogl_color_set_from_4x (&c, red, green, blue, alpha);
+ cogl_color_set_from_4f (&c, red, green, blue, alpha);
cogl_set_source_color (&c);
}
diff --git a/clutter/cogl/common/cogl-primitives.c b/clutter/cogl/common/cogl-primitives.c
index 27834f7..7e9b1b9 100644
--- a/clutter/cogl/common/cogl-primitives.c
+++ b/clutter/cogl/common/cogl-primitives.c
@@ -43,19 +43,15 @@ void _cogl_path_add_node (gboolean new_sub_path,
float y);
void _cogl_path_fill_nodes ();
void _cogl_path_stroke_nodes ();
-void _cogl_rectangle (gint x,
- gint y,
- guint width,
- guint height);
-void _cogl_rectanglex (float x,
- float y,
- float width,
- float height);
+void _cogl_rectangle (float x,
+ float y,
+ float width,
+ float height);
void
-cogl_rectangle (gint x,
- gint y,
- guint width,
- guint height)
+cogl_rectangle (float x,
+ float y,
+ float width,
+ float height)
{
cogl_clip_ensure ();
@@ -63,18 +59,6 @@ cogl_rectangle (gint x,
}
void
-cogl_rectanglex (float x,
- float y,
- float width,
- float height)
-{
- cogl_clip_ensure ();
-
- _cogl_rectanglex (x, y, width, height);
-}
-
-
-void
cogl_path_fill (void)
{
cogl_path_fill_preserve ();
diff --git a/clutter/cogl/gl/cogl-primitives.c b/clutter/cogl/gl/cogl-primitives.c
index 8a0843d..e445657 100644
--- a/clutter/cogl/gl/cogl-primitives.c
+++ b/clutter/cogl/gl/cogl-primitives.c
@@ -39,35 +39,17 @@
#define _COGL_MAX_BEZ_RECURSE_DEPTH 16
void
-_cogl_rectangle (gint x,
- gint y,
- guint width,
- guint height)
+_cogl_rectangle (float x,
+ float y,
+ float width,
+ float height)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_enable (ctx->color_alpha < 255
? COGL_ENABLE_BLEND : 0);
- GE( glRecti (x, y, x + width, y + height) );
-}
-
-
-void
-_cogl_rectanglex (float x,
- float y,
- float width,
- float height)
-{
- _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
- cogl_enable (ctx->color_alpha < 255
- ? COGL_ENABLE_BLEND : 0);
-
- GE( glRectf ( (x),
- (y),
- (x + width),
- (y + height)) );
+ GE( glRectf (x, y, x + width, y + height) );
}
void
@@ -132,17 +114,15 @@ _cogl_path_stroke_nodes ()
static void
_cogl_path_get_bounds (floatVec2 nodes_min,
floatVec2 nodes_max,
- gint *bounds_x,
- gint *bounds_y,
- guint *bounds_w,
- guint *bounds_h)
+ float *bounds_x,
+ float *bounds_y,
+ float *bounds_w,
+ float *bounds_h)
{
- *bounds_x = floorf (nodes_min.x);
- *bounds_y = floorf (nodes_min.y);
- *bounds_w = ceilf (nodes_max.x
- - (float)(*bounds_x));
- *bounds_h = ceilf (nodes_max.y
- - (float)(*bounds_y));
+ *bounds_x = nodes_min.x;
+ *bounds_y = nodes_min.y;
+ *bounds_w = nodes_max.x - *bounds_x;
+ *bounds_h = nodes_max.y - *bounds_y;
}
void
@@ -154,10 +134,10 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
{
guint path_start = 0;
guint sub_path_num = 0;
- gint bounds_x;
- gint bounds_y;
- guint bounds_w;
- guint bounds_h;
+ float bounds_x;
+ float bounds_y;
+ float bounds_w;
+ float bounds_h;
_cogl_path_get_bounds (nodes_min, nodes_max,
&bounds_x, &bounds_y, &bounds_w, &bounds_h);
@@ -239,10 +219,10 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
void
_cogl_path_fill_nodes ()
{
- gint bounds_x;
- gint bounds_y;
- guint bounds_w;
- guint bounds_h;
+ float bounds_x;
+ float bounds_y;
+ float bounds_w;
+ float bounds_h;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
diff --git a/clutter/cogl/gl/cogl.c b/clutter/cogl/gl/cogl.c
index d815e3b..aa0ec78 100644
--- a/clutter/cogl/gl/cogl.c
+++ b/clutter/cogl/gl/cogl.c
@@ -217,32 +217,15 @@ cogl_scale (float x, float y)
}
void
-cogl_translatex (float x, float y, float z)
+cogl_translate (float x, float y, float z)
{
- glTranslatef ((float)(x),
- (float)(y),
- (float)(z));
+ glTranslatef (x, y, z);
}
void
-cogl_translate (gint x, gint y, gint z)
+cogl_rotate (float angle, float x, float y, float z)
{
- glTranslatef ((float)x, (float)y, (float)z);
-}
-
-void
-cogl_rotatex (float angle, float x, float y, float z)
-{
- glRotatef ((float)(angle),
- (float)(x),
- (float)(y),
- (float)(z));
-}
-
-void
-cogl_rotate (gint angle, gint x, gint y, gint z)
-{
- glRotatef ((float)angle, (float)x, (float)y, (float)z);
+ glRotatef (angle, x, y, z);
}
static inline gboolean
diff --git a/clutter/cogl/gles/cogl-primitives.c b/clutter/cogl/gles/cogl-primitives.c
index d8fe121..1a58805 100644
--- a/clutter/cogl/gles/cogl-primitives.c
+++ b/clutter/cogl/gles/cogl-primitives.c
@@ -39,55 +39,26 @@
#define _COGL_MAX_BEZ_RECURSE_DEPTH 16
void
-_cogl_rectangle (gint x,
- gint y,
- guint width,
- guint height)
+_cogl_rectangle (float x,
+ float y,
+ float width,
+ float height)
{
- /* 32-bit integers are not supported as coord types
- in GLES . Fixed type has got 16 bits left of the
- point which is equal to short anyway. */
-
- GLshort rect_verts[8] = {
- (GLshort) x, (GLshort) y,
- (GLshort) (x + width), (GLshort) y,
- (GLshort) x, (GLshort) (y + height),
- (GLshort) (x + width), (GLshort) (y + height)
+ GLfloat rect_verts[8] = {
+ (GLfloat) x, (GLfloat) y,
+ (GLfloat) (x + width), (GLfloat) y,
+ (GLfloat) x, (GLfloat) (y + height),
+ (GLfloat) (x + width), (GLfloat) (y + height)
};
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_enable (COGL_ENABLE_VERTEX_ARRAY
| (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0));
- GE ( cogl_wrap_glVertexPointer (2, GL_SHORT, 0, rect_verts ) );
+ GE ( cogl_wrap_glVertexPointer (2, GL_FLOAT, 0, rect_verts ) );
GE ( cogl_wrap_glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) );
}
-
-void
-_cogl_rectanglex (float x,
- float y,
- float width,
- float height)
-{
- GLfloat rect_verts[8] = {
- x, y,
- x + width, y,
- x, y + height,
- x + width, y + height
- };
-
- _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
- cogl_enable (COGL_ENABLE_VERTEX_ARRAY
- | (ctx->color_alpha < 255
- ? COGL_ENABLE_BLEND : 0));
-
- GE( cogl_wrap_glVertexPointer (2, GL_FIXED, 0, rect_verts) );
- GE( cogl_wrap_glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) );
-
-}
-
void
_cogl_path_add_node (gboolean new_sub_path,
float x,
@@ -150,17 +121,15 @@ _cogl_path_stroke_nodes ()
static void
_cogl_path_get_bounds (floatVec2 nodes_min,
floatVec2 nodes_max,
- gint *bounds_x,
- gint *bounds_y,
- guint *bounds_w,
- guint *bounds_h)
+ float *bounds_x,
+ float *bounds_y,
+ float *bounds_w,
+ float *bounds_h)
{
- *bounds_x = floorf (nodes_min.x);
- *bounds_y = floorf (nodes_min.y);
- *bounds_w = ceilf (nodes_max.x
- - (float)(*bounds_x));
- *bounds_h = ceilf (nodes_max.y
- - (float)(*bounds_y));
+ *bounds_x = nodes_min.x;
+ *bounds_y = nodes_min.y;
+ *bounds_w = nodes_max.x - *bounds_x;
+ *bounds_h = nodes_max.y - *bounds_y;
}
static gint compare_ints (gconstpointer a,
@@ -178,10 +147,10 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
{
guint path_start = 0;
guint sub_path_num = 0;
- gint bounds_x;
- gint bounds_y;
- guint bounds_w;
- guint bounds_h;
+ float bounds_x;
+ float bounds_y;
+ float bounds_w;
+ float bounds_h;
_cogl_path_get_bounds (nodes_min, nodes_max,
&bounds_x, &bounds_y, &bounds_w, &bounds_h);
@@ -245,12 +214,8 @@ _cogl_add_path_to_stencil_buffer (floatVec2 nodes_min,
GE( cogl_wrap_glMatrixMode (GL_PROJECTION) );
GE( cogl_wrap_glPushMatrix () );
GE( cogl_wrap_glLoadIdentity () );
- cogl_rectanglex (-1.0, -1.0,
- (float)(2),
- (float)(2));
- cogl_rectanglex (-1.0, -1.0,
- (float)(2),
- (float)(2));
+ cogl_rectangle (-1.0, -1.0, 2, 2);
+ cogl_rectangle (-1.0, -1.0, 2, 2);
GE( cogl_wrap_glPopMatrix () );
GE( cogl_wrap_glMatrixMode (GL_MODELVIEW) );
GE( cogl_wrap_glPopMatrix () );
@@ -436,10 +401,10 @@ _cogl_path_fill_nodes_scanlines (CoglPathNode *path,
void
_cogl_path_fill_nodes ()
{
- gint bounds_x;
- gint bounds_y;
- guint bounds_w;
- guint bounds_h;
+ float bounds_x;
+ float bounds_y;
+ float bounds_w;
+ float bounds_h;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
diff --git a/clutter/cogl/gles/cogl.c b/clutter/cogl/gles/cogl.c
index f8c5413..997f24a 100644
--- a/clutter/cogl/gles/cogl.c
+++ b/clutter/cogl/gles/cogl.c
@@ -123,35 +123,15 @@ cogl_scale (float x, float y)
}
void
-cogl_translatex (float x, float y, float z)
+cogl_translate (float x, float y, float z)
{
GE( cogl_wrap_glTranslatef (x, y, z) );
}
void
-cogl_translate (gint x, gint y, gint z)
+cogl_rotate (float angle, float x, float y, float z)
{
- GE( cogl_wrap_glTranslatef ((float)(x),
- (float)(y),
- (float)(z)) );
-}
-
-void
-cogl_rotatex (float angle,
- float x,
- float y,
- float z)
-{
- GE( cogl_wrap_glRotatef (angle,x,y,z) );
-}
-
-void
-cogl_rotate (gint angle, gint x, gint y, gint z)
-{
- GE( cogl_wrap_glRotatef ((float)(angle),
- (float)(x),
- (float)(y),
- (float)(z)) );
+ GE( cogl_wrap_glRotatef (angle, x, y, z) );
}
static inline gboolean
@@ -457,7 +437,7 @@ _cogl_add_stencil_clip (float x_offset,
GE( glStencilFunc (GL_NEVER, 0x1, 0x1) );
GE( glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE) );
- cogl_rectanglex (x_offset, y_offset, width, height);
+ cogl_rectangle (x_offset, y_offset, width, height);
}
else
{
@@ -465,7 +445,7 @@ _cogl_add_stencil_clip (float x_offset,
rectangle */
GE( glStencilFunc (GL_NEVER, 0x1, 0x3) );
GE( glStencilOp (GL_INCR, GL_INCR, GL_INCR) );
- cogl_rectanglex (x_offset, y_offset, width, height);
+ cogl_rectangle (x_offset, y_offset, width, height);
/* Subtract one from all pixels in the stencil buffer so that
only pixels where both the original stencil buffer and the
@@ -476,9 +456,7 @@ _cogl_add_stencil_clip (float x_offset,
GE( cogl_wrap_glMatrixMode (GL_PROJECTION) );
GE( cogl_wrap_glPushMatrix () );
GE( cogl_wrap_glLoadIdentity () );
- cogl_rectanglex (-1.0, -1.0,
- (float)(2),
- (float)(2));
+ cogl_rectangle (-1.0, -1.0, 2, 2);
GE( cogl_wrap_glPopMatrix () );
GE( cogl_wrap_glMatrixMode (GL_MODELVIEW) );
GE( cogl_wrap_glPopMatrix () );
diff --git a/clutter/pango/cogl-pango-render.c b/clutter/pango/cogl-pango-render.c
index 3e23309..3cafc81 100644
--- a/clutter/pango/cogl-pango-render.c
+++ b/clutter/pango/cogl-pango-render.c
@@ -461,7 +461,7 @@ cogl_pango_renderer_draw_rectangle (PangoRenderer *renderer,
x + width, y + height,
&x2, &y2);
- cogl_rectanglex (x1, y1, x2 - x1, y2 - y1);
+ cogl_rectangle (x1, y1, x2 - x1, y2 - y1);
}
static void
diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt
index dcd7c93..db4e16a 100644
--- a/doc/reference/cogl/cogl-sections.txt
+++ b/doc/reference/cogl/cogl-sections.txt
@@ -89,7 +89,7 @@ cogl_path_stroke
cogl_path_stroke_preserve
cogl_set_source_color
cogl_set_source_color4ub
-cogl_set_source_color4x
+cogl_set_source_color4f
<SUBSECTION>
cogl_rectangle
@@ -257,7 +257,7 @@ cogl_color_copy
cogl_color_free
cogl_color_set_from_4ub
cogl_color_set_from_4d
-cogl_color_set_from_4x
+cogl_color_set_from_4f
<SUBSECTION>
cogl_color_get_red
diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c
index 50c19fd..6303949 100644
--- a/tests/conform/test-backface-culling.c
+++ b/tests/conform/test-backface-culling.c
@@ -121,7 +121,7 @@ on_paint (ClutterActor *actor, TestState *state)
/* Set the color to white so that all the textures will be drawn
at their own color */
- cogl_set_source_color4x (1.0, 1.0,
+ cogl_set_source_color4f (1.0, 1.0,
1.0, 1.0);
x2 = x1 + (float)(TEXTURE_SIZE);
@@ -173,7 +173,7 @@ on_paint (ClutterActor *actor, TestState *state)
x2 = x1 + (float)(TEXTURE_SIZE);
/* Draw a regular rectangle (this should always show) */
- cogl_set_source_color4x (1.0, 0, 0, 1.0);
+ cogl_set_source_color4f (1.0, 0, 0, 1.0);
cogl_rectangle ( (x1), (y1),
(x2 - x1), (y2 - y1));

View File

@ -1,24 +0,0 @@
diff --git a/tests/interactive/test-cogl-tex-tile.c b/tests/interactive/test-cogl-tex-tile.c
index 5063dff..177d60e 100644
--- a/tests/interactive/test-cogl-tex-tile.c
+++ b/tests/interactive/test-cogl-tex-tile.c
@@ -90,14 +90,14 @@ 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 (priv->frame);
+ cos_frame = clutter_cosx (priv->frame);
pingpong_frame = (priv->frame <= 180 ? priv->frame : 360 - priv->frame);
frac_frame = (CLUTTER_INT_TO_FIXED (pingpong_frame) /
- CLUTTER_INT_TO_FIXED (180));
- frac_frame += (1.0 >> 1);
- frac_frame <<= 1;
+ CLUTTER_INT_TO_FIXED (180));
+ frac_frame += 0.5;
+ frac_frame *= 2;
for (t=0; t<4; t+=2)
{

View File

@ -1,239 +0,0 @@
#!/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 ./tests -maxdepth 1 -iname '*.c' -exec sed -i \
-e 's/COGL_FIXED_MUL/CLUTTER_FIXED_MUL/g' \
-e 's/COGL_FIXED_DIV/CLUTTER_FIXED_DIV/g' \
-e 's/COGL_FIXED_FAST_MUL/CLUTTER_FIXED_MUL/g' \
-e 's/COGL_FIXED_FAST_DIV/CLUTTER_FIXED_DIV/g' \
-e 's/COGL_FIXED_FROM_FLOAT/CLUTTER_FLOAT_TO_FIXED/g' \
-e 's/COGL_FIXED_TO_FLOAT/CLUTTER_FIXED_TO_FLOAT/g' \
-e 's/COGL_FIXED_TO_DOUBLE/CLUTTER_FIXED_TO_DOUBLE/g' \
-e '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: The following three assume 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
#
# XXX: (Note in the third regexp 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 ./tests -iname '*.[ch]' -exec sed -i -r \
-e 's/COGL_FIXED_MUL (.*),/\1 */g' \
-e 's|COGL_FIXED_FAST_DIV (.*),|\1 /|g' \
-e '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
find ./clutter/cogl/gles -iname '*.[ch]' -exec sed -i 's/GLfixed/GLfloat/g' {} \;
#we get some redundant brackets like this, but C's automatic type promotion
#works out fine for most cases...
find ./clutter ./tests -iname '*.[ch]' -exec sed -r -i \
-e 's/COGL_FIXED_TO_INT//g' \
-e 's/COGL_FIXED_FROM_INT /(float)/g' \
-e 's/COGL_FIXED_FROM_INT/(float)/g' \
-e 's/COGL_FIXED_TO_FLOAT//g' \
-e 's/COGL_FIXED_FROM_FLOAT//g' \
-e 's/COGL_FIXED_TO_DOUBLE /(double)/g' \
\
-e 's/COGL_FIXED_FLOOR/floorf/g' \
-e 's/COGL_FIXED_CEIL/ceilf/g' \
-e 's/COGL_FIXED_360/360.0/g' \
-e 's/COGL_FIXED_240/240.0/g' \
-e 's/COGL_FIXED_255/255.0/g' \
-e 's/COGL_FIXED_180/180.0/g' \
-e 's/COGL_FIXED_120/120.0/g' \
-e 's/COGL_FIXED_60/60.0/g' \
-e 's/COGL_FIXED_1/1.0/g' \
-e 's/COGL_FIXED_0_5/0.5/g' \
-e 's/COGL_FIXED_PI/G_PI/g' \
\
-e 's/COGL_ANGLE_FROM_DEG \((.*)\),/\1,/g' \
{} \; \
\
-exec perl -p -i \
-e "s|cogl_angle_cos \((.*?)\)|cosf (\1 * (G_PI/180.0))|;" \
-e "s|cogl_angle_sin \((.*?)\)|sinf (\1 * (G_PI/180.0))|;" \
-e "s|cogl_angle_tan \((.*?)\)|tanf (\1 * (G_PI/180.0))|;" \
{} \;
#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 ./tests -iname '*.[ch]' -exec sed -i -r \
-e 's|cogl_fixed_div (.*),|\1 /|g' \
-e 's|cogl_fixed_mul (.*),|\1 *|g' \
-e 's/cogl_fixed_pow2/pow2f/g' \
-e 's/cogl_fixed_pow/powf/g' \
-e 's/cogl_fixed_log2/log2f/g' \
-e 's/cogl_fixed_sqrt/sqrtf/g' \
-e 's/cogl_fixed_cos/cosf/g' \
-e 's/cogl_fixed_sin/sinf/g' \
-e 's/cogl_fixed_atan2/atan2f/g' \
-e 's/cogl_fixed_atan/atanf/g' \
-e '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 -e 's|>> 1|/ 2|g' -e 's|<< 1|* 2|g' \
./clutter/cogl/common/cogl-primitives.c
#find ./clutter -iname '*.[ch]' -exec sed -i 's|<< 1|* 2|g' {} \;
find ./clutter ./tests -iname '*.[ch]' \
-exec sed -i 's/CoglFixed/float/g' {} \;
#XXX: This might need changing later...
find ./clutter ./tests -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
find ./clutter ./tests -iname '*.[ch]' -exec sed -i 's/CoglAngle/float/g' {} \;
# maintain the existing CoglAngle code as utility code for applications:
sed -i 's/float:/CoglAngle:/g' clutter/cogl/cogl-types.h
sed -i 's/gint32 float/gint32 CoglAngle/g' clutter/cogl/cogl-types.h
git-checkout clutter/cogl/cogl-fixed.h clutter/cogl/common/cogl-fixed.c
find ./clutter ./tests -iname '*.[ch]' ! -iname 'clutter-fixed.h' \
-exec sed -i 's/ClutterAngle/float/g' {} \;
# use the floating point names for GL ES functions instead of the
# fixed. These get #define'd to the float versions in one of the
# patches anyway but the names should be fixed up to avoid confusion
find ./clutter/cogl -iname '*.[ch]' -exec perl -p -i -e \
's/\b(cogl_wrap_(?:glMultMatrix|glFrustum|glScale|glTranslate
|glRotate|glOrtho|glTexEnv|glClipPlane|glFog|glColor4))x(v?)\b/$1f$2/gx' {} \;
echo "Cogl API to remove/replace with float versions:"
find ./clutter/ ./tests -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/ ./tests -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...
#
cat > log_message <<EOF
[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.
EOF
git-commit -a -F log_message --no-verify
patch -p1<fixed-to-float-patches/gl-cogl-texture.c.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.0.patch
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
patch -p1<fixed-to-float-patches/gles-cogl.c.0.patch
patch -p1<fixed-to-float-patches/gles-cogl-gles2-wrapper.h.0.patch
patch -p1<fixed-to-float-patches/gles-cogl-gles2-wrapper.c.0.patch
patch -p1<fixed-to-float-patches/gles-cogl-primitives.c.0.patch
patch -p1<fixed-to-float-patches/gles-cogl-texture.c.0.patch
patch -p1<fixed-to-float-patches/cogl.h.in.0.patch
# Finally remove any cogl_blahx Cogl interfaces that used to take CoglFixed
# params. The corresponding interfaces that take integer params are also
# patched to take floats instead:
patch -p1<fixed-to-float-patches/remove_cogl_apis_taking_fixed_params.0.patch
#XXX: COGL_PANGO_UNIT_TO_FIXED
cat > log_message <<EOF
[Automatic fixed-to-float.sh change] Applies a number fixed to float patches
To deal with all the corner cases that couldn't be scripted a number of patches
were written for the remaining 10% of the effort.
Note: again no API changes were made in Clutter, only in Cogl.
EOF
git-commit -a -F log_message --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
cat > log_message <<EOF
[Automatic fixed-to-float.sh change] Hand coded changes for clutter-{fixed,units}
To avoid clashing with all the scripted changes, clutter-fixed.h and
clutter-units.h were manually converted to internally use floats instead of
16.16 fixed numbers.
Note: again no API changes were made in Clutter.
EOF
git-commit -a -F log_message --no-verify