[gtk/matthiasc/for-master: 13/16] inspector: Use gdk_frame_clock_get_fps
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 13/16] inspector: Use gdk_frame_clock_get_fps
- Date: Mon, 14 Sep 2020 03:45:02 +0000 (UTC)
commit c462f35a5e5be03d3739aec6b8bac7ef447182d5
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Sep 13 23:32:33 2020 -0400
inspector: Use gdk_frame_clock_get_fps
gtk/inspector/fpsoverlay.c | 32 +-------------------------------
1 file changed, 1 insertion(+), 31 deletions(-)
---
diff --git a/gtk/inspector/fpsoverlay.c b/gtk/inspector/fpsoverlay.c
index fcc8da691c..b68238deb1 100644
--- a/gtk/inspector/fpsoverlay.c
+++ b/gtk/inspector/fpsoverlay.c
@@ -98,42 +98,12 @@ static double
gtk_fps_overlay_get_fps (GtkWidget *widget)
{
GdkFrameClock *frame_clock;
- GdkFrameTimings *start, *end;
- gint64 start_counter, end_counter;
- gint64 start_timestamp, end_timestamp;
- gint64 interval;
frame_clock = gtk_widget_get_frame_clock (widget);
if (frame_clock == NULL)
return 0.0;
- start_counter = gdk_frame_clock_get_history_start (frame_clock);
- end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
- start = gdk_frame_clock_get_timings (frame_clock, start_counter);
- for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
- end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
- end = gdk_frame_clock_get_timings (frame_clock, end_counter))
- end_counter--;
- if (end_counter - start_counter < 4)
- return 0.0;
-
- start_timestamp = gdk_frame_timings_get_presentation_time (start);
- end_timestamp = gdk_frame_timings_get_presentation_time (end);
- if (start_timestamp == 0 || end_timestamp == 0)
- {
- start_timestamp = gdk_frame_timings_get_frame_time (start);
- end_timestamp = gdk_frame_timings_get_frame_time (end);
- }
-
- interval = gdk_frame_timings_get_refresh_interval (end);
- if (interval == 0)
- {
- interval = guess_refresh_interval (frame_clock);
- if (interval == 0)
- return 0.0;
- }
-
- return ((double) end_counter - start_counter) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
+ return gdk_frame_clock_get_fps (frame_clock);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]