[gtk/wip/baedert/for-master: 2/7] snapshot: Add _push_collect() and _pop_collect()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 2/7] snapshot: Add _push_collect() and _pop_collect()
- Date: Fri, 31 Jan 2020 16:47:50 +0000 (UTC)
commit c4405db3d34845766f187532c4d3b6a0e1d10863
Author: Timm Bäder <tbaeder redhat com>
Date: Fri Jan 31 08:05:34 2020 +0100
snapshot: Add _push_collect() and _pop_collect()
These will replace the previous gtk_snapshot_new_with_parent(), which
allocated an entirely new GObject just to push()/pop() some state. This
is already a problem but will be more important in the future as we
start using this more.
gtk/gtksnapshot.c | 24 ++++++++++++++++++++++++
gtk/gtksnapshotprivate.h | 4 ++++
2 files changed, 28 insertions(+)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 5654e0abbc..1804ffb9c2 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -1138,6 +1138,30 @@ gtk_snapshot_pop_internal (GtkSnapshot *snapshot)
return gtk_snapshot_pop_one (snapshot);
}
+/**
+ * gtk_snapshot_push_collect:
+ *
+ * PRIVATE.
+ *
+ * Puhses state so a later pop_collect call can collect all nodes
+ * appended until that point.
+ */
+void
+gtk_snapshot_push_collect (GtkSnapshot *snapshot)
+{
+ gtk_snapshot_push_state (snapshot,
+ NULL,
+ gtk_snapshot_collect_default);
+}
+
+GskRenderNode *
+gtk_snapshot_pop_collect (GtkSnapshot *snapshot)
+{
+ GskRenderNode *result = gtk_snapshot_pop_internal (snapshot);
+
+ return result;
+}
+
/**
* gtk_snapshot_to_node:
* @snapshot: a #GtkSnapshot
diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h
index e02531e1a5..7317b4ad59 100644
--- a/gtk/gtksnapshotprivate.h
+++ b/gtk/gtksnapshotprivate.h
@@ -104,6 +104,10 @@ void gtk_snapshot_append_text (GtkSnapshot
const GdkRGBA *color,
float x,
float y);
+
+void gtk_snapshot_push_collect (GtkSnapshot *snapshot);
+GskRenderNode * gtk_snapshot_pop_collect (GtkSnapshot *snapshot);
+
G_END_DECLS
#endif /* __GTK_SNAPSHOT_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]