Merge GdkFrameHistory into GdkFrameClock

Now that GdkFrameClock is a  class, not interface, there's no real advantage
to splitting the frame history into an aggregate object, so directly
merge it into GdkFrameClock.
This commit is contained in:
Owen W. Taylor 2013-02-12 15:47:38 -05:00
parent 5f2d1654a5
commit 515e5f74aa
11 changed files with 180 additions and 306 deletions

View File

@ -75,7 +75,6 @@ gdk_public_h_sources = \
gdkdisplaymanager.h \
gdkdnd.h \
gdkevents.h \
gdkframehistory.h \
gdkframetimings.h \
gdkkeys.h \
gdkkeysyms.h \
@ -126,7 +125,6 @@ gdk_c_sources = \
gdkdisplaymanager.c \
gdkdnd.c \
gdkevents.c \
gdkframehistory.c \
gdkframetimings.c \
gdkglobals.c \
gdkkeys.c \

View File

@ -27,6 +27,7 @@
#include "config.h"
#include "gdkframeclockprivate.h"
#include "gdkinternals.h"
/**
* SECTION:frameclock
@ -90,17 +91,25 @@ enum {
static guint signals[LAST_SIGNAL];
#define FRAME_HISTORY_MAX_LENGTH 16
struct _GdkFrameClockPrivate
{
GdkFrameHistory *history;
gint64 frame_counter;
gint n_timings;
gint current;
GdkFrameTimings *timings[FRAME_HISTORY_MAX_LENGTH];
};
static void
gdk_frame_clock_finalize (GObject *object)
{
GdkFrameClockPrivate *priv = GDK_FRAME_CLOCK (object)->priv;
int i;
g_object_unref (priv->history);
for (i = 0; i < FRAME_HISTORY_MAX_LENGTH; i++)
if (priv->timings[i] != 0)
gdk_frame_timings_unref (priv->timings[i]);
G_OBJECT_CLASS (gdk_frame_clock_parent_class)->finalize (object);
}
@ -254,7 +263,8 @@ gdk_frame_clock_init (GdkFrameClock *clock)
GdkFrameClockPrivate);
priv = clock->priv;
priv->history = gdk_frame_history_new ();
priv->frame_counter = -1;
priv->current = FRAME_HISTORY_MAX_LENGTH - 1;
}
/**
@ -325,27 +335,6 @@ gdk_frame_clock_thaw (GdkFrameClock *clock)
GDK_FRAME_CLOCK_GET_CLASS (clock)->thaw (clock);
}
/**
* gdk_frame_clock_get_history:
* @clock: the clock
*
* Gets the #GdkFrameHistory for the frame clock.
*
* Since: 3.8
* Return value: (transfer none): the frame history object
*/
GdkFrameHistory *
gdk_frame_clock_get_history (GdkFrameClock *clock)
{
GdkFrameClockPrivate *priv;
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), NULL);
priv = clock->priv;
return priv->history;
}
/**
* gdk_frame_clock_get_requested:
* @clock: the clock
@ -388,19 +377,149 @@ gdk_frame_clock_get_frame_time_val (GdkFrameClock *clock,
timeval->tv_usec = (time_ms % 1000) * 1000;
}
GdkFrameTimings *
gdk_frame_clock_get_current_frame_timings (GdkFrameClock *clock)
gint64
gdk_frame_clock_get_frame_counter (GdkFrameClock *clock)
{
GdkFrameHistory *history;
gint64 frame_counter;
GdkFrameClockPrivate *priv;
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), 0);
history = gdk_frame_clock_get_history (clock);
frame_counter = gdk_frame_history_get_frame_counter (history);
return gdk_frame_history_get_timings (history, frame_counter);
priv = clock->priv;
return priv->frame_counter;
}
gint64
gdk_frame_clock_get_start (GdkFrameClock *clock)
{
GdkFrameClockPrivate *priv;
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), 0);
priv = clock->priv;
return priv->frame_counter + 1 - priv->n_timings;
}
void
_gdk_frame_clock_begin_frame (GdkFrameClock *clock)
{
GdkFrameClockPrivate *priv;
g_return_if_fail (GDK_IS_FRAME_CLOCK (clock));
priv = clock->priv;
priv->frame_counter++;
priv->current = (priv->current + 1) % FRAME_HISTORY_MAX_LENGTH;
if (priv->n_timings < FRAME_HISTORY_MAX_LENGTH)
priv->n_timings++;
else
{
gdk_frame_timings_unref(priv->timings[priv->current]);
}
priv->timings[priv->current] = gdk_frame_timings_new (priv->frame_counter);
}
GdkFrameTimings *
gdk_frame_clock_get_timings (GdkFrameClock *clock,
gint64 frame_counter)
{
GdkFrameClockPrivate *priv;
gint pos;
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), NULL);
priv = clock->priv;
if (frame_counter > priv->frame_counter)
return NULL;
if (frame_counter <= priv->frame_counter - priv->n_timings)
return NULL;
pos = (priv->current - (priv->frame_counter - frame_counter) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
return priv->timings[pos];
}
GdkFrameTimings *
gdk_frame_clock_get_current_frame_timings (GdkFrameClock *clock)
{
GdkFrameClockPrivate *priv;
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), 0);
priv = clock->priv;
return gdk_frame_clock_get_timings (clock, priv->frame_counter);
}
GdkFrameTimings *
gdk_frame_clock_get_last_complete (GdkFrameClock *clock)
{
GdkFrameClockPrivate *priv;
gint i;
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (clock), NULL);
priv = clock->priv;
for (i = 0; i < priv->n_timings; i++)
{
gint pos = ((priv->current - i) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
if (gdk_frame_timings_get_complete (priv->timings[pos]))
return priv->timings[pos];
}
return NULL;
}
#ifdef G_ENABLE_DEBUG
void
_gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
GdkFrameTimings *timings)
{
gint64 frame_counter = gdk_frame_timings_get_frame_counter (timings);
gint64 layout_start_time = _gdk_frame_timings_get_layout_start_time (timings);
gint64 paint_start_time = _gdk_frame_timings_get_paint_start_time (timings);
gint64 frame_end_time = _gdk_frame_timings_get_frame_end_time (timings);
gint64 frame_time = gdk_frame_timings_get_frame_time (timings);
gint64 presentation_time = gdk_frame_timings_get_presentation_time (timings);
gint64 predicted_presentation_time = gdk_frame_timings_get_predicted_presentation_time (timings);
gint64 refresh_interval = gdk_frame_timings_get_refresh_interval (timings);
gint64 previous_frame_time = 0;
gboolean slept_before = gdk_frame_timings_get_slept_before (timings);
GdkFrameTimings *previous_timings = gdk_frame_clock_get_timings (clock,
frame_counter - 1);
if (previous_timings != NULL)
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
g_print ("%5" G_GINT64_FORMAT ":", frame_counter);
if (previous_frame_time != 0)
{
g_print (" interval=%-4.1f", (frame_time - previous_frame_time) / 1000.);
g_print (slept_before ? " (sleep)" : " ");
}
if (layout_start_time != 0)
g_print (" layout_start=%-4.1f", (layout_start_time - frame_time) / 1000.);
if (paint_start_time != 0)
g_print (" paint_start=%-4.1f", (paint_start_time - frame_time) / 1000.);
if (frame_end_time != 0)
g_print (" frame_end=%-4.1f", (frame_end_time - frame_time) / 1000.);
if (presentation_time != 0)
g_print (" present=%-4.1f", (presentation_time - frame_time) / 1000.);
if (predicted_presentation_time != 0)
g_print (" predicted=%-4.1f", (predicted_presentation_time - frame_time) / 1000.);
if (refresh_interval != 0)
g_print (" refresh_interval=%-4.1f", refresh_interval / 1000.);
g_print ("\n");
}
#endif /* G_ENABLE_DEBUG */
#define DEFAULT_REFRESH_INTERVAL 16667 /* 16.7ms (1/60th second) */
#define MAX_HISTORY_AGE 150000 /* 150ms */
@ -411,13 +530,11 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *clock,
gint64 *refresh_interval_return,
gint64 *presentation_time_return)
{
GdkFrameHistory *history;
gint64 frame_counter;
g_return_if_fail (GDK_IS_FRAME_CLOCK (clock));
history = gdk_frame_clock_get_history (clock);
frame_counter = gdk_frame_history_get_frame_counter (history);
frame_counter = gdk_frame_clock_get_frame_counter (clock);
if (presentation_time_return)
*presentation_time_return = 0;
@ -426,7 +543,7 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *clock,
while (TRUE)
{
GdkFrameTimings *timings = gdk_frame_history_get_timings (history, frame_counter);
GdkFrameTimings *timings = gdk_frame_clock_get_timings (clock, frame_counter);
gint64 presentation_time;
gint64 refresh_interval;

View File

@ -31,7 +31,7 @@
#ifndef __GDK_FRAME_CLOCK_H__
#define __GDK_FRAME_CLOCK_H__
#include <gdk/gdkframehistory.h>
#include <gdk/gdkframetimings.h>
G_BEGIN_DECLS
@ -68,7 +68,12 @@ GdkFrameClockPhase gdk_frame_clock_get_requested (GdkFrameClock *clock);
void gdk_frame_clock_freeze (GdkFrameClock *clock);
void gdk_frame_clock_thaw (GdkFrameClock *clock);
GdkFrameHistory *gdk_frame_clock_get_history (GdkFrameClock *clock);
/* Frame history */
gint64 gdk_frame_clock_get_frame_counter (GdkFrameClock *clock);
gint64 gdk_frame_clock_get_start (GdkFrameClock *clock);
GdkFrameTimings *gdk_frame_clock_get_timings (GdkFrameClock *clock,
gint64 frame_counter);
GdkFrameTimings *gdk_frame_clock_get_last_complete (GdkFrameClock *clock);
/* Convenience API */
void gdk_frame_clock_get_frame_time_val (GdkFrameClock *clock,

View File

@ -274,10 +274,8 @@ gdk_frame_clock_paint_idle (void *data)
GdkFrameClock *clock = GDK_FRAME_CLOCK (data);
GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
GdkFrameHistory *history = gdk_frame_clock_get_history (clock);
gboolean skip_to_resume_events;
GdkFrameTimings *timings = NULL;
gint64 frame_counter = 0;
priv->paint_idle_id = 0;
priv->in_paint_idle = TRUE;
@ -288,8 +286,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->phase > GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT)
{
frame_counter = gdk_frame_history_get_frame_counter (history);
timings = gdk_frame_history_get_timings (history, frame_counter);
timings = gdk_frame_clock_get_current_frame_timings (clock);
}
if (!skip_to_resume_events)
@ -304,9 +301,8 @@ gdk_frame_clock_paint_idle (void *data)
{
priv->frame_time = compute_frame_time (clock_idle);
gdk_frame_history_begin_frame (history);
frame_counter = gdk_frame_history_get_frame_counter (history);
timings = gdk_frame_history_get_timings (history, frame_counter);
_gdk_frame_clock_begin_frame (clock);
timings = gdk_frame_clock_get_current_frame_timings (clock);
gdk_frame_timings_set_frame_time (timings, priv->frame_time);
@ -393,7 +389,7 @@ gdk_frame_clock_paint_idle (void *data)
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
{
if (gdk_frame_timings_get_complete (timings))
_gdk_frame_history_debug_print (history, timings);
_gdk_frame_clock_debug_print_timings (clock, timings);
}
#endif /* G_ENABLE_DEBUG */

View File

@ -67,6 +67,10 @@ struct _GdkFrameClockClass
/* void (* resume_events) (GdkFrameClock *clock); */
};
void _gdk_frame_clock_begin_frame (GdkFrameClock *clock);
void _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
GdkFrameTimings *timings);
G_END_DECLS
#endif /* __GDK_FRAME_CLOCK_PRIVATE_H__ */

View File

@ -1,187 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkframehistory.h"
#include "gdkinternals.h"
#define FRAME_HISTORY_MAX_LENGTH 16
struct _GdkFrameHistory
{
GObject parent_instance;
gint64 frame_counter;
gint n_timings;
gint current;
GdkFrameTimings *timings[FRAME_HISTORY_MAX_LENGTH];
};
struct _GdkFrameHistoryClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE (GdkFrameHistory, gdk_frame_history, G_TYPE_OBJECT)
static void
gdk_frame_history_finalize (GObject *object)
{
GdkFrameHistory *history = GDK_FRAME_HISTORY (object);
int i;
for (i = 0; i < FRAME_HISTORY_MAX_LENGTH; i++)
if (history->timings[i] != 0)
gdk_frame_timings_unref (history->timings[i]);
G_OBJECT_CLASS (gdk_frame_history_parent_class)->finalize (object);
}
static void
gdk_frame_history_class_init (GdkFrameHistoryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_frame_history_finalize;
}
static void
gdk_frame_history_init (GdkFrameHistory *history)
{
history->frame_counter = -1;
history->current = FRAME_HISTORY_MAX_LENGTH - 1;
}
GdkFrameHistory *
gdk_frame_history_new (void)
{
return g_object_new (GDK_TYPE_FRAME_HISTORY, NULL);
}
gint64
gdk_frame_history_get_frame_counter (GdkFrameHistory *history)
{
g_return_val_if_fail (GDK_IS_FRAME_HISTORY (history), 0);
return history->frame_counter;
}
gint64
gdk_frame_history_get_start (GdkFrameHistory *history)
{
g_return_val_if_fail (GDK_IS_FRAME_HISTORY (history), 0);
return history->frame_counter + 1 - history->n_timings;
}
void
gdk_frame_history_begin_frame (GdkFrameHistory *history)
{
g_return_if_fail (GDK_IS_FRAME_HISTORY (history));
history->frame_counter++;
history->current = (history->current + 1) % FRAME_HISTORY_MAX_LENGTH;
if (history->n_timings < FRAME_HISTORY_MAX_LENGTH)
history->n_timings++;
else
{
gdk_frame_timings_unref(history->timings[history->current]);
}
history->timings[history->current] = gdk_frame_timings_new (history->frame_counter);
}
GdkFrameTimings *
gdk_frame_history_get_timings (GdkFrameHistory *history,
gint64 frame_counter)
{
gint pos;
g_return_val_if_fail (GDK_IS_FRAME_HISTORY (history), NULL);
if (frame_counter > history->frame_counter)
return NULL;
if (frame_counter <= history->frame_counter - history->n_timings)
return NULL;
pos = (history->current - (history->frame_counter - frame_counter) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
return history->timings[pos];
}
GdkFrameTimings *
gdk_frame_history_get_last_complete (GdkFrameHistory *history)
{
gint i;
g_return_val_if_fail (GDK_IS_FRAME_HISTORY (history), NULL);
for (i = 0; i < history->n_timings; i++)
{
gint pos = ((history->current - i) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
if (gdk_frame_timings_get_complete (history->timings[pos]))
return history->timings[pos];
}
return NULL;
}
#ifdef G_ENABLE_DEBUG
void
_gdk_frame_history_debug_print (GdkFrameHistory *history,
GdkFrameTimings *timings)
{
gint64 frame_counter = gdk_frame_timings_get_frame_counter (timings);
gint64 layout_start_time = _gdk_frame_timings_get_layout_start_time (timings);
gint64 paint_start_time = _gdk_frame_timings_get_paint_start_time (timings);
gint64 frame_end_time = _gdk_frame_timings_get_frame_end_time (timings);
gint64 frame_time = gdk_frame_timings_get_frame_time (timings);
gint64 presentation_time = gdk_frame_timings_get_presentation_time (timings);
gint64 predicted_presentation_time = gdk_frame_timings_get_predicted_presentation_time (timings);
gint64 refresh_interval = gdk_frame_timings_get_refresh_interval (timings);
gint64 previous_frame_time = 0;
gboolean slept_before = gdk_frame_timings_get_slept_before (timings);
GdkFrameTimings *previous_timings = gdk_frame_history_get_timings (history,
frame_counter - 1);
if (previous_timings != NULL)
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
g_print ("%5" G_GINT64_FORMAT ":", frame_counter);
if (previous_frame_time != 0)
{
g_print (" interval=%-4.1f", (frame_time - previous_frame_time) / 1000.);
g_print (slept_before ? " (sleep)" : " ");
}
if (layout_start_time != 0)
g_print (" layout_start=%-4.1f", (layout_start_time - frame_time) / 1000.);
if (paint_start_time != 0)
g_print (" paint_start=%-4.1f", (paint_start_time - frame_time) / 1000.);
if (frame_end_time != 0)
g_print (" frame_end=%-4.1f", (frame_end_time - frame_time) / 1000.);
if (presentation_time != 0)
g_print (" present=%-4.1f", (presentation_time - frame_time) / 1000.);
if (predicted_presentation_time != 0)
g_print (" predicted=%-4.1f", (predicted_presentation_time - frame_time) / 1000.);
if (refresh_interval != 0)
g_print (" refresh_interval=%-4.1f", refresh_interval / 1000.);
g_print ("\n");
}
#endif /* G_ENABLE_DEBUG */

View File

@ -1,49 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_FRAME_HISTORY_H__
#define __GDK_FRAME_HISTORY_H__
#include <gdk/gdkframetimings.h>
G_BEGIN_DECLS
typedef struct _GdkFrameHistory GdkFrameHistory;
typedef struct _GdkFrameHistoryClass GdkFrameHistoryClass;
#define GDK_TYPE_FRAME_HISTORY (gdk_frame_history_get_type ())
#define GDK_FRAME_HISTORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_FRAME_HISTORY, GdkFrameHistory))
#define GDK_IS_FRAME_HISTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_FRAME_HISTORY))
GType gdk_frame_history_get_type (void) G_GNUC_CONST;
GdkFrameHistory *gdk_frame_history_new (void);
gint64 gdk_frame_history_get_frame_counter (GdkFrameHistory *history);
gint64 gdk_frame_history_get_start (GdkFrameHistory *history);
void gdk_frame_history_begin_frame (GdkFrameHistory *history);
GdkFrameTimings *gdk_frame_history_get_timings (GdkFrameHistory *history,
gint64 frame_counter);
GdkFrameTimings *gdk_frame_history_get_last_complete (GdkFrameHistory *history);
G_END_DECLS
#endif /* __GDK_FRAME_HISTORY_H__ */

View File

@ -445,9 +445,6 @@ gint64 _gdk_frame_timings_get_frame_end_time (GdkFrameTimings *timing
void _gdk_frame_timings_set_frame_end_time (GdkFrameTimings *timings,
gint64 frame_end_time);
void _gdk_frame_history_debug_print (GdkFrameHistory *history,
GdkFrameTimings *timings);
#endif /* G_ENABLE_DEBUG */
G_END_DECLS

View File

@ -26,6 +26,7 @@
#include "gdkdisplay.h"
#include "gdkeventsource.h"
#include "gdkeventtranslator.h"
#include "gdkframeclockprivate.h"
#include "gdkinternals.h"
#include "gdkscreen.h"
#include "gdkinternals.h"
@ -1061,14 +1062,13 @@ static GdkFrameTimings *
find_frame_timings (GdkFrameClock *clock,
guint64 serial)
{
GdkFrameHistory *history = gdk_frame_clock_get_history (clock);
gint64 start_frame, end_frame, i;
start_frame = gdk_frame_history_get_start (history);
end_frame = gdk_frame_history_get_frame_counter (history);
start_frame = gdk_frame_clock_get_start (clock);
end_frame = gdk_frame_clock_get_frame_counter (clock);
for (i = end_frame; i >= start_frame; i--)
{
GdkFrameTimings *timings = gdk_frame_history_get_timings (history, i);
GdkFrameTimings *timings = gdk_frame_clock_get_timings (clock, i);
if (gdk_frame_timings_get_cookie (timings) == serial)
return timings;
@ -1167,8 +1167,7 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
gdk_frame_timings_set_complete (timings, TRUE);
#ifdef G_ENABLE_DEBUG
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
_gdk_frame_history_debug_print (gdk_frame_clock_get_history (clock),
timings);
_gdk_frame_clock_debug_print_timings (clock, timings);
#endif /* G_ENABLE_DEBUG */
}
}

View File

@ -148,7 +148,7 @@ print_variable (const char *description,
}
static void
handle_frame_stats (GdkFrameHistory *frame_history)
handle_frame_stats (GdkFrameClock *frame_clock)
{
static int num_stats = 0;
static double last_print_time = 0;
@ -192,11 +192,11 @@ handle_frame_stats (GdkFrameHistory *frame_history)
frames_since_last_print++;
for (frame_counter = last_handled_frame;
frame_counter < gdk_frame_history_get_frame_counter (frame_history);
frame_counter < gdk_frame_clock_get_frame_counter (frame_clock);
frame_counter++)
{
GdkFrameTimings *timings = gdk_frame_history_get_timings (frame_history, frame_counter);
GdkFrameTimings *previous_timings = gdk_frame_history_get_timings (frame_history, frame_counter - 1);
GdkFrameTimings *timings = gdk_frame_clock_get_timings (frame_clock, frame_counter);
GdkFrameTimings *previous_timings = gdk_frame_clock_get_timings (frame_clock, frame_counter - 1);
if (!timings || gdk_frame_timings_get_complete (timings))
last_handled_frame = frame_counter;
@ -220,10 +220,7 @@ on_frame (double progress)
int jitter;
if (frame_clock)
{
GdkFrameHistory *history = gdk_frame_clock_get_history (frame_clock);
handle_frame_stats (history);
}
handle_frame_stats (clock);
angle = 2 * M_PI * progress;
jitter = WINDOW_SIZE_JITTER * sin(angle);

View File

@ -221,9 +221,7 @@ on_window_draw (GtkWidget *widget,
if (displayed_frame->frame_counter == 0)
{
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (window);
GdkFrameHistory *history = gdk_frame_clock_get_history (frame_clock);
displayed_frame->frame_counter = gdk_frame_history_get_frame_counter (history);
displayed_frame->frame_counter = gdk_frame_clock_get_frame_counter (clock);
}
}
}
@ -232,7 +230,6 @@ static void
collect_old_frames (void)
{
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (window);
GdkFrameHistory *history = gdk_frame_clock_get_history (frame_clock);
GList *l, *l_next;
for (l = past_frames; l; l = l_next)
@ -241,8 +238,8 @@ collect_old_frames (void)
gboolean remove = FALSE;
l_next = l->next;
GdkFrameTimings *timings = gdk_frame_history_get_timings (history,
frame_data->frame_counter);
GdkFrameTimings *timings = gdk_frame_clock_get_timings (clock,
frame_data->frame_counter);
if (timings == NULL)
{
remove = TRUE;