Commit a2cf7e4a authored by Robert Bragg's avatar Robert Bragg

[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.
parent e82f6565
......@@ -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
......@@ -1345,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);
/*
......@@ -1360,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
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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);