From 7c18911c0082b5b189f3bbed4e7261f172e6130c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 11 Mar 2018 00:17:53 -0500 Subject: [PATCH] GtkSnapshot: Add getters These getters can be useful when creating new snapshots in a snapshot() vfunc. --- docs/reference/gtk/gtk4-sections.txt | 2 ++ gtk/gtksnapshot.c | 17 ++++++++++++++++- gtk/gtksnapshot.h | 5 +++++ gtk/gtksnapshotprivate.h | 2 -- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index fb8707a246..64f11cb4c3 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4171,6 +4171,8 @@ gtk_snapshot_ref gtk_snapshot_unref gtk_snapshot_to_node gtk_snapshot_free_to_node +gtk_snapshot_get_renderer +gtk_snapshot_get_record_names gtk_snapshot_push gtk_snapshot_push_transform gtk_snapshot_push_opacity diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index ffc7217544..a771a1adcc 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -1223,11 +1223,26 @@ gtk_snapshot_pop (GtkSnapshot *snapshot) * Returns: (transfer none): the #GskRenderer */ GskRenderer * -gtk_snapshot_get_renderer (const GtkSnapshot *snapshot) +gtk_snapshot_get_renderer (GtkSnapshot *snapshot) { return snapshot->renderer; } +/** + * gtk_snapshot_get_record_names: + * @snapshot: a #GtkSnapshot + * + * Obtains whether the snapshot is recording names + * for debugging. + * + * Returns: whether the snapshot records names + */ +gboolean +gtk_snapshot_get_record_names (GtkSnapshot *snapshot) +{ + return snapshot->record_names; +} + /** * gtk_snapshot_offset: * @snapshot: a $GtkSnapshot diff --git a/gtk/gtksnapshot.h b/gtk/gtksnapshot.h index 67c502dea4..767e1bcbfb 100644 --- a/gtk/gtksnapshot.h +++ b/gtk/gtksnapshot.h @@ -56,6 +56,11 @@ GskRenderNode * gtk_snapshot_free_to_node (GtkSnapshot GDK_AVAILABLE_IN_ALL GskRenderNode * gtk_snapshot_to_node (GtkSnapshot *snapshot); +GDK_AVAILABLE_IN_ALL +GskRenderer * gtk_snapshot_get_renderer (GtkSnapshot *snapshot); +GDK_AVAILABLE_IN_ALL +gboolean gtk_snapshot_get_record_names (GtkSnapshot *snapshot); + GDK_AVAILABLE_IN_ALL void gtk_snapshot_push (GtkSnapshot *snapshot, gboolean keep_coordinates, diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h index f2117bb43f..f78b5ede19 100644 --- a/gtk/gtksnapshotprivate.h +++ b/gtk/gtksnapshotprivate.h @@ -88,8 +88,6 @@ struct _GtkSnapshot { GPtrArray *nodes; }; -GskRenderer * gtk_snapshot_get_renderer (const GtkSnapshot *snapshot); - G_END_DECLS #endif /* __GTK_SNAPSHOT_PRIVATE_H__ */