[gtk+/wip/chergert/quartz-frame-clock: 222/228] quartz: improve frame timing predictions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/chergert/quartz-frame-clock: 222/228] quartz: improve frame timing predictions
- Date: Fri, 25 Sep 2015 09:44:07 +0000 (UTC)
commit 1301c3f4422b4089d026cd6154393b43125bd378
Author: Christian Hergert <christian hergert me>
Date: Fri Sep 11 15:05:14 2015 -0700
quartz: improve frame timing predictions
gdk/quartz/gdkwindow-quartz.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 35b4c84..0074267 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -736,22 +736,30 @@ frame_callback (GdkDisplay *display,
gint64 now,
gint64 presentation_time)
{
- GdkFrameClock *frame_clock;
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
+ GdkFrameClock *frame_clock = gdk_window_get_frame_clock (window);
GdkFrameTimings *timings;
- frame_clock = gdk_window_get_frame_clock (window);
if (frame_clock == NULL)
return;
+ _gdk_frame_clock_thaw (frame_clock);
+
+ if (impl->pending_frame_counter)
+ {
+ timings = gdk_frame_clock_get_timings (frame_clock, impl->pending_frame_counter);
+ if (timings)
+ timings->presentation_time = presentation_time - refresh_interval;
+ impl->pending_frame_counter = 0;
+ }
+
timings = gdk_frame_clock_get_current_timings (frame_clock);
if (timings != NULL)
{
timings->refresh_interval = refresh_interval;
- timings->presentation_time = presentation_time;
+ timings->predicted_presentation_time = presentation_time;
}
-
- _gdk_frame_clock_thaw (frame_clock);
}
static void
@@ -764,9 +772,16 @@ static void
on_frame_clock_after_paint (GdkFrameClock *frame_clock,
GdkWindow *window)
{
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
GdkDisplay *display = gdk_window_get_display (window);
+ GdkFrameTimings *timings;
+
+ timings = gdk_frame_clock_get_current_timings (frame_clock);
+ if (timings != NULL)
+ impl->pending_frame_counter = timings->frame_counter;
_gdk_quartz_display_add_frame_callback (display, frame_callback, window);
+
_gdk_frame_clock_freeze (frame_clock);
}
@@ -1120,6 +1135,7 @@ void
gdk_window_quartz_hide (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
+ GdkFrameClock *frame_clock;
/* Make sure we're not stuck in fullscreen mode. */
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
@@ -1149,6 +1165,10 @@ gdk_window_quartz_hide (GdkWindow *window)
{
[impl->view setHidden:YES];
}
+
+ frame_clock = gdk_window_get_frame_clock (window);
+ if (frame_clock != NULL)
+ _gdk_frame_clock_thaw (frame_clock);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]