Move ClutterTimeline to CoglFixed

The ClutterTimeline::get_progressx() method should return a
CoglFixed, now that ClutterFixed is being deprecated.
This commit is contained in:
Emmanuele Bassi 2009-03-09 17:05:13 +00:00
parent 849e916d6f
commit 720341b301
2 changed files with 17 additions and 37 deletions

View File

@ -1380,9 +1380,13 @@ clutter_timeline_set_duration (ClutterTimeline *timeline,
gdouble gdouble
clutter_timeline_get_progress (ClutterTimeline *timeline) clutter_timeline_get_progress (ClutterTimeline *timeline)
{ {
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0.); ClutterTimelinePrivate *priv;
return CLUTTER_FIXED_TO_DOUBLE (clutter_timeline_get_progressx (timeline)); g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0.0);
priv = timeline->priv;
return (gdouble) priv->current_frame_num / (gdouble) priv->n_frames;
} }
/** /**
@ -1395,20 +1399,10 @@ clutter_timeline_get_progress (ClutterTimeline *timeline)
* *
* Since: 0.6 * Since: 0.6
*/ */
ClutterFixed CoglFixed
clutter_timeline_get_progressx (ClutterTimeline *timeline) clutter_timeline_get_progressx (ClutterTimeline *timeline)
{ {
ClutterTimelinePrivate *priv; return COGL_FIXED_FROM_DOUBLE (clutter_timeline_get_progress (timeline));
ClutterFixed progress;
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
priv = timeline->priv;
progress = CLUTTER_FIXED_DIV ((float)(priv->current_frame_num),
(float)(priv->n_frames));
return progress;
} }
/** /**
@ -1425,7 +1419,8 @@ clutter_timeline_get_progressx (ClutterTimeline *timeline)
ClutterTimelineDirection ClutterTimelineDirection
clutter_timeline_get_direction (ClutterTimeline *timeline) clutter_timeline_get_direction (ClutterTimeline *timeline)
{ {
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), CLUTTER_TIMELINE_FORWARD); g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline),
CLUTTER_TIMELINE_FORWARD);
return timeline->priv->direction; return timeline->priv->direction;
} }

View File

@ -33,27 +33,12 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define CLUTTER_TYPE_TIMELINE (clutter_timeline_get_type ()) #define CLUTTER_TYPE_TIMELINE (clutter_timeline_get_type ())
#define CLUTTER_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TIMELINE, ClutterTimeline))
#define CLUTTER_TIMELINE(obj) \ #define CLUTTER_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_TIMELINE, ClutterTimelineClass))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \ #define CLUTTER_IS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TIMELINE))
CLUTTER_TYPE_TIMELINE, ClutterTimeline)) #define CLUTTER_IS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_TIMELINE))
#define CLUTTER_TIMELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_TIMELINE, ClutterTimelineClass))
#define CLUTTER_TIMELINE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_TIMELINE, ClutterTimelineClass))
#define CLUTTER_IS_TIMELINE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_TIMELINE))
#define CLUTTER_IS_TIMELINE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_TIMELINE))
#define CLUTTER_TIMELINE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_TIMELINE, ClutterTimelineClass))
/** /**
* ClutterTimelineDirection: * ClutterTimelineDirection:
@ -134,7 +119,7 @@ void clutter_timeline_advance (ClutterTimeline *timeli
guint frame_num); guint frame_num);
gint clutter_timeline_get_current_frame (ClutterTimeline *timeline); gint clutter_timeline_get_current_frame (ClutterTimeline *timeline);
gdouble clutter_timeline_get_progress (ClutterTimeline *timeline); gdouble clutter_timeline_get_progress (ClutterTimeline *timeline);
ClutterFixed clutter_timeline_get_progressx (ClutterTimeline *timeline); CoglFixed clutter_timeline_get_progressx (ClutterTimeline *timeline);
void clutter_timeline_set_n_frames (ClutterTimeline *timeline, void clutter_timeline_set_n_frames (ClutterTimeline *timeline,
guint n_frames); guint n_frames);
guint clutter_timeline_get_n_frames (ClutterTimeline *timeline); guint clutter_timeline_get_n_frames (ClutterTimeline *timeline);