[gtk+] inspector: Pass the renderer when recording
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Pass the renderer when recording
- Date: Sun, 20 Nov 2016 04:31:34 +0000 (UTC)
commit be237dbb5a0ab512ad94e680fb3578602531d50c
Author: Benjamin Otte <otte redhat com>
Date: Sun Nov 20 03:52:56 2016 +0100
inspector: Pass the renderer when recording
... and collect the profiler information from the renderer.
gtk/gtkwidget.c | 2 +-
gtk/inspector/recorder.c | 3 +++
gtk/inspector/recorder.h | 1 +
gtk/inspector/renderrecording.c | 21 +++++++++++++++++++++
gtk/inspector/renderrecording.h | 5 +++++
gtk/inspector/window.c | 2 ++
gtk/inspector/window.h | 1 +
7 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 5ebb019..b5c28d4 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -15739,7 +15739,7 @@ gtk_widget_render (GtkWidget *widget,
if (root == NULL)
return;
- gtk_inspector_record_render (widget, window, region, root);
+ gtk_inspector_record_render (widget, renderer, window, region, root);
context = gdk_window_begin_draw_frame (window, region);
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index 0d3a61b..455ec4a 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -25,6 +25,7 @@
#include <gtk/gtklistbox.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtktreeview.h>
+#include <gsk/gskrendererprivate.h>
#include <gsk/gskrendernodeprivate.h>
#include "gtktreemodelrendernode.h"
@@ -410,6 +411,7 @@ gtk_inspector_recorder_is_recording (GtkInspectorRecorder *recorder)
void
gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
GtkWidget *widget,
+ GskRenderer *renderer,
GdkWindow *window,
const cairo_region_t *region,
GskRenderNode *node)
@@ -423,6 +425,7 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
frame_clock = gtk_widget_get_frame_clock (widget);
recording = gtk_inspector_render_recording_new (gdk_frame_clock_get_frame_time (frame_clock),
+ gsk_renderer_get_profiler (renderer),
&(GdkRectangle) { 0, 0,
gdk_window_get_width (window),
gdk_window_get_height (window) },
diff --git a/gtk/inspector/recorder.h b/gtk/inspector/recorder.h
index 557bb8c..676f3f1 100644
--- a/gtk/inspector/recorder.h
+++ b/gtk/inspector/recorder.h
@@ -50,6 +50,7 @@ gboolean gtk_inspector_recorder_is_recording (GtkInspectorRec
void gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
GtkWidget *widget,
+ GskRenderer *renderer,
GdkWindow *window,
const cairo_region_t *region,
GskRenderNode *node);
diff --git a/gtk/inspector/renderrecording.c b/gtk/inspector/renderrecording.c
index 761f5bd..f3bb0d1 100644
--- a/gtk/inspector/renderrecording.c
+++ b/gtk/inspector/renderrecording.c
@@ -29,6 +29,7 @@ gtk_inspector_render_recording_finalize (GObject *object)
g_clear_pointer (&recording->clip, cairo_region_destroy);
g_clear_pointer (&recording->node, gsk_render_node_unref);
+ g_clear_pointer (&recording->profiler_info, g_free);
G_OBJECT_CLASS (gtk_inspector_render_recording_parent_class)->finalize (object);
}
@@ -46,8 +47,21 @@ gtk_inspector_render_recording_init (GtkInspectorRenderRecording *vis)
{
}
+static void
+collect_profiler_info (GtkInspectorRenderRecording *recording,
+ GskProfiler *profiler)
+{
+ GString *string;
+
+ string = g_string_new (NULL);
+ gsk_profiler_append_timers (profiler, string);
+ gsk_profiler_append_counters (profiler, string);
+ recording->profiler_info = g_string_free (string, FALSE);
+}
+
GtkInspectorRecording *
gtk_inspector_render_recording_new (gint64 timestamp,
+ GskProfiler *profiler,
const GdkRectangle *area,
const cairo_region_t *clip,
GskRenderNode *node)
@@ -58,6 +72,7 @@ gtk_inspector_render_recording_new (gint64 timestamp,
"timestamp", timestamp,
NULL);
+ collect_profiler_info (recording, profiler);
recording->area = *area;
recording->clip = cairo_region_copy (clip);
recording->node = gsk_render_node_ref (node);
@@ -83,4 +98,10 @@ gtk_inspector_render_recording_get_area (GtkInspectorRenderRecording *recording)
return &recording->area;
}
+const char *
+gtk_inspector_render_recording_get_profiler_info (GtkInspectorRenderRecording *recording)
+{
+ return recording->profiler_info;
+}
+
// vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/renderrecording.h b/gtk/inspector/renderrecording.h
index c9b14a1..f84a87e 100644
--- a/gtk/inspector/renderrecording.h
+++ b/gtk/inspector/renderrecording.h
@@ -20,6 +20,7 @@
#include <gdk/gdk.h>
#include <gsk/gsk.h>
+#include "gsk/gskprofilerprivate.h"
#include "inspector/recording.h"
@@ -42,6 +43,7 @@ typedef struct _GtkInspectorRenderRecording
GdkRectangle area;
cairo_region_t *clip;
GskRenderNode *node;
+ char *profiler_info;
} GtkInspectorRenderRecording;
typedef struct _GtkInspectorRenderRecordingClass
@@ -53,6 +55,7 @@ GType gtk_inspector_render_recording_get_type (void);
GtkInspectorRecording *
gtk_inspector_render_recording_new (gint64 timestamp,
+ GskProfiler *profiler,
const GdkRectangle *area,
const cairo_region_t *clip,
GskRenderNode *node);
@@ -62,6 +65,8 @@ const cairo_region_t *
gtk_inspector_render_recording_get_clip_region (GtkInspectorRenderRecording *recording);
const cairo_rectangle_int_t *
gtk_inspector_render_recording_get_area (GtkInspectorRenderRecording *recording);
+const char * gtk_inspector_render_recording_get_profiler_info
+ (GtkInspectorRenderRecording *recording);
G_END_DECLS
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index beb0db9..b21f5c9 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -343,6 +343,7 @@ gtk_inspector_window_get_for_display (GdkDisplay *display)
void
gtk_inspector_record_render (GtkWidget *widget,
+ GskRenderer *renderer,
GdkWindow *window,
const cairo_region_t *region,
GskRenderNode *node)
@@ -359,6 +360,7 @@ gtk_inspector_record_render (GtkWidget *widget,
gtk_inspector_recorder_record_render (GTK_INSPECTOR_RECORDER (iw->widget_recorder),
widget,
+ renderer,
window,
region,
node);
diff --git a/gtk/inspector/window.h b/gtk/inspector/window.h
index 0ca153d..671e759 100644
--- a/gtk/inspector/window.h
+++ b/gtk/inspector/window.h
@@ -107,6 +107,7 @@ void gtk_inspector_window_select_widget_under_pointer (GtkInspectorWindow
void gtk_inspector_window_rescan (GtkWidget *iw);
void gtk_inspector_record_render (GtkWidget *widget,
+ GskRenderer *renderer,
GdkWindow *window,
const cairo_region_t *region,
GskRenderNode *node);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]