gdk_frame_clock_get_frame_time(): use gint64 for time
This commit is contained in:
@ -269,7 +269,7 @@ gdk_frame_clock_init (GdkFrameClock *clock)
|
|||||||
* Return value: a timestamp in microseconds, in the timescale of
|
* Return value: a timestamp in microseconds, in the timescale of
|
||||||
* of g_get_monotonic_time().
|
* of g_get_monotonic_time().
|
||||||
*/
|
*/
|
||||||
guint64
|
gint64
|
||||||
gdk_frame_clock_get_frame_time (GdkFrameClock *frame_clock)
|
gdk_frame_clock_get_frame_time (GdkFrameClock *frame_clock)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (frame_clock), 0);
|
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (frame_clock), 0);
|
||||||
|
@ -76,7 +76,7 @@ typedef enum {
|
|||||||
|
|
||||||
GType gdk_frame_clock_get_type (void) G_GNUC_CONST;
|
GType gdk_frame_clock_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
guint64 gdk_frame_clock_get_frame_time (GdkFrameClock *frame_clock);
|
gint64 gdk_frame_clock_get_frame_time (GdkFrameClock *frame_clock);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_3_8
|
GDK_AVAILABLE_IN_3_8
|
||||||
void gdk_frame_clock_request_phase (GdkFrameClock *frame_clock,
|
void gdk_frame_clock_request_phase (GdkFrameClock *frame_clock,
|
||||||
|
@ -37,9 +37,9 @@ struct _GdkFrameClockIdlePrivate
|
|||||||
{
|
{
|
||||||
GTimer *timer;
|
GTimer *timer;
|
||||||
/* timer_base is used to avoid ever going backward */
|
/* timer_base is used to avoid ever going backward */
|
||||||
guint64 timer_base;
|
gint64 timer_base;
|
||||||
guint64 frame_time;
|
gint64 frame_time;
|
||||||
guint64 min_next_frame_time;
|
gint64 min_next_frame_time;
|
||||||
gint64 sleep_serial;
|
gint64 sleep_serial;
|
||||||
|
|
||||||
guint flush_idle_id;
|
guint flush_idle_id;
|
||||||
@ -135,12 +135,12 @@ gdk_frame_clock_idle_finalize (GObject *object)
|
|||||||
G_OBJECT_CLASS (gdk_frame_clock_idle_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_frame_clock_idle_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint64
|
static gint64
|
||||||
compute_frame_time (GdkFrameClockIdle *idle)
|
compute_frame_time (GdkFrameClockIdle *idle)
|
||||||
{
|
{
|
||||||
GdkFrameClockIdlePrivate *priv = idle->priv;
|
GdkFrameClockIdlePrivate *priv = idle->priv;
|
||||||
guint64 computed_frame_time;
|
gint64 computed_frame_time;
|
||||||
guint64 elapsed;
|
gint64 elapsed;
|
||||||
|
|
||||||
elapsed = g_get_monotonic_time () + priv->timer_base;
|
elapsed = g_get_monotonic_time () + priv->timer_base;
|
||||||
if (elapsed < priv->frame_time)
|
if (elapsed < priv->frame_time)
|
||||||
@ -160,11 +160,11 @@ compute_frame_time (GdkFrameClockIdle *idle)
|
|||||||
return computed_frame_time;
|
return computed_frame_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint64
|
static gint64
|
||||||
gdk_frame_clock_idle_get_frame_time (GdkFrameClock *clock)
|
gdk_frame_clock_idle_get_frame_time (GdkFrameClock *clock)
|
||||||
{
|
{
|
||||||
GdkFrameClockIdlePrivate *priv = GDK_FRAME_CLOCK_IDLE (clock)->priv;
|
GdkFrameClockIdlePrivate *priv = GDK_FRAME_CLOCK_IDLE (clock)->priv;
|
||||||
guint64 computed_frame_time;
|
gint64 computed_frame_time;
|
||||||
|
|
||||||
/* can't change frame time during a paint */
|
/* can't change frame time during a paint */
|
||||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_NONE &&
|
if (priv->phase != GDK_FRAME_CLOCK_PHASE_NONE &&
|
||||||
@ -196,8 +196,8 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle)
|
|||||||
|
|
||||||
if (priv->min_next_frame_time != 0)
|
if (priv->min_next_frame_time != 0)
|
||||||
{
|
{
|
||||||
guint64 now = compute_frame_time (clock_idle);
|
gint64 now = compute_frame_time (clock_idle);
|
||||||
guint64 min_interval_us = MAX (priv->min_next_frame_time, now) - now;
|
gint64 min_interval_us = MAX (priv->min_next_frame_time, now) - now;
|
||||||
min_interval = (min_interval_us + 500) / 1000;
|
min_interval = (min_interval_us + 500) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct _GdkFrameClockClass
|
|||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
guint64 (* get_frame_time) (GdkFrameClock *clock);
|
gint64 (* get_frame_time) (GdkFrameClock *clock);
|
||||||
|
|
||||||
void (* request_phase) (GdkFrameClock *clock,
|
void (* request_phase) (GdkFrameClock *clock,
|
||||||
GdkFrameClockPhase phase);
|
GdkFrameClockPhase phase);
|
||||||
|
Reference in New Issue
Block a user