Whitespace fixes
This commit is contained in:
parent
2d5eeba5d8
commit
578e83e463
@ -132,7 +132,8 @@ clutter_frame_source_add (guint fps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clutter_frame_source_prepare (GSource *source, gint *delay)
|
clutter_frame_source_prepare (GSource *source,
|
||||||
|
gint *delay)
|
||||||
{
|
{
|
||||||
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
ClutterFrameSource *frame_source = (ClutterFrameSource *) source;
|
||||||
GTimeVal current_time;
|
GTimeVal current_time;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
void
|
void
|
||||||
_clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
|
_clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
|
||||||
guint fps)
|
guint fps)
|
||||||
{
|
{
|
||||||
g_get_current_time (&interval->start_time);
|
g_get_current_time (&interval->start_time);
|
||||||
interval->fps = fps;
|
interval->fps = fps;
|
||||||
@ -40,21 +40,24 @@ _clutter_timeout_interval_init (ClutterTimeoutInterval *interval,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
_clutter_timeout_interval_get_ticks (const GTimeVal *current_time,
|
_clutter_timeout_interval_get_ticks (const GTimeVal *current_time,
|
||||||
ClutterTimeoutInterval *interval)
|
ClutterTimeoutInterval *interval)
|
||||||
{
|
{
|
||||||
return ((current_time->tv_sec - interval->start_time.tv_sec) * 1000
|
return ((current_time->tv_sec - interval->start_time.tv_sec) * 1000
|
||||||
+ (current_time->tv_usec - interval->start_time.tv_usec) / 1000);
|
+ (current_time->tv_usec - interval->start_time.tv_usec) / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_timeout_interval_prepare (const GTimeVal *current_time,
|
_clutter_timeout_interval_prepare (const GTimeVal *current_time,
|
||||||
ClutterTimeoutInterval *interval,
|
ClutterTimeoutInterval *interval,
|
||||||
gint *delay)
|
gint *delay)
|
||||||
{
|
{
|
||||||
guint elapsed_time
|
guint elapsed_time, new_frame_num;
|
||||||
= _clutter_timeout_interval_get_ticks (current_time, interval);
|
|
||||||
guint new_frame_num = elapsed_time * interval->fps / 1000;
|
elapsed_time = _clutter_timeout_interval_get_ticks (current_time,
|
||||||
|
interval);
|
||||||
|
new_frame_num = elapsed_time * interval->fps
|
||||||
|
/ 1000;
|
||||||
|
|
||||||
/* If time has gone backwards or the time since the last frame is
|
/* If time has gone backwards or the time since the last frame is
|
||||||
greater than the two frames worth then reset the time and do a
|
greater than the two frames worth then reset the time and do a
|
||||||
@ -67,6 +70,7 @@ _clutter_timeout_interval_prepare (const GTimeVal *current_time,
|
|||||||
|
|
||||||
/* Reset the start time */
|
/* Reset the start time */
|
||||||
interval->start_time = *current_time;
|
interval->start_time = *current_time;
|
||||||
|
|
||||||
/* Move the start time as if one whole frame has elapsed */
|
/* Move the start time as if one whole frame has elapsed */
|
||||||
g_time_val_add (&interval->start_time, -(gint) frame_time * 1000);
|
g_time_val_add (&interval->start_time, -(gint) frame_time * 1000);
|
||||||
|
|
||||||
@ -74,19 +78,22 @@ _clutter_timeout_interval_prepare (const GTimeVal *current_time,
|
|||||||
|
|
||||||
if (delay)
|
if (delay)
|
||||||
*delay = 0;
|
*delay = 0;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (new_frame_num > interval->frame_count)
|
else if (new_frame_num > interval->frame_count)
|
||||||
{
|
{
|
||||||
if (delay)
|
if (delay)
|
||||||
*delay = 0;
|
*delay = 0;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (delay)
|
if (delay)
|
||||||
*delay = ((interval->frame_count + 1) * 1000 / interval->fps
|
*delay = ((interval->frame_count + 1) * 1000 / interval->fps
|
||||||
- elapsed_time);
|
- elapsed_time);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,10 +106,11 @@ _clutter_timeout_interval_dispatch (ClutterTimeoutInterval *interval,
|
|||||||
if ((* callback) (user_data))
|
if ((* callback) (user_data))
|
||||||
{
|
{
|
||||||
interval->frame_count++;
|
interval->frame_count++;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
@ -115,12 +123,12 @@ _clutter_timeout_interval_compare_expiration (const ClutterTimeoutInterval *a,
|
|||||||
gint comparison;
|
gint comparison;
|
||||||
|
|
||||||
b_difference = ((a->start_time.tv_sec - b->start_time.tv_sec) * 1000
|
b_difference = ((a->start_time.tv_sec - b->start_time.tv_sec) * 1000
|
||||||
+ (a->start_time.tv_usec - b->start_time.tv_usec) / 1000);
|
+ (a->start_time.tv_usec - b->start_time.tv_usec) / 1000);
|
||||||
|
|
||||||
comparison = ((gint) ((a->frame_count + 1) * a_delay)
|
comparison = ((gint) ((a->frame_count + 1) * a_delay)
|
||||||
- (gint) ((b->frame_count + 1) * b_delay + b_difference));
|
- (gint) ((b->frame_count + 1) * b_delay + b_difference));
|
||||||
|
|
||||||
return (comparison < 0 ? -1
|
return (comparison < 0 ? -1
|
||||||
: comparison > 0 ? 1
|
: comparison > 0 ? 1
|
||||||
: 0);
|
: 0);
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,8 @@ clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
|
|||||||
clutter_timeout_find_by_id)))
|
clutter_timeout_find_by_id)))
|
||||||
{
|
{
|
||||||
clutter_timeout_unref (l->data);
|
clutter_timeout_unref (l->data);
|
||||||
pool->dispatched_timeouts
|
|
||||||
= g_list_delete_link (pool->dispatched_timeouts, l);
|
pool->dispatched_timeouts =
|
||||||
|
g_list_delete_link (pool->dispatched_timeouts, l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user