[gtk/wip/baedert/for-master: 42/58] snapshot: Remove new_with_parent



commit b87a220541ebd49249113b289a178e1be132954c
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 31 17:45:37 2020 +0100

    snapshot: Remove new_with_parent
    
    Unneeded now that we have push_collect()/pop_collect()

 gtk/gtksnapshot.c        | 32 ++++----------------------------
 gtk/gtksnapshotprivate.h |  4 ----
 2 files changed, 4 insertions(+), 32 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 1804ffb9c2..878fe88b4d 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -162,7 +162,6 @@ gtk_snapshot_new (void)
 
   snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL);
 
-  snapshot->from_parent = FALSE;
   snapshot->state_stack = g_array_new (FALSE, TRUE, sizeof (GtkSnapshotState));
   g_array_set_clear_func (snapshot->state_stack, (GDestroyNotify)gtk_snapshot_state_clear);
   snapshot->nodes = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_render_node_unref);
@@ -174,24 +173,6 @@ gtk_snapshot_new (void)
   return snapshot;
 }
 
-/* Private. Does the same as _new but does not allocate a NEW
- * state/node stack. */
-GtkSnapshot *
-gtk_snapshot_new_with_parent (GtkSnapshot *parent_snapshot)
-{
-  GtkSnapshot *snapshot = g_object_new (GTK_TYPE_SNAPSHOT, NULL);
-
-  snapshot->state_stack = parent_snapshot->state_stack;
-  snapshot->nodes = parent_snapshot->nodes;
-  snapshot->from_parent = TRUE;
-
-  gtk_snapshot_push_state (snapshot,
-                           NULL,
-                           gtk_snapshot_collect_default);
-
-  return snapshot;
-}
-
 /**
  * gtk_snapshot_free_to_node: (skip)
  * @snapshot: (transfer full): a #GtkSnapshot
@@ -1048,8 +1029,7 @@ gtk_snapshot_pop_one (GtkSnapshot *snapshot)
   guint state_index;
   GskRenderNode *node;
 
-  if (snapshot->state_stack->len == 0 &&
-      !snapshot->from_parent)
+  if (snapshot->state_stack->len == 0)
     {
       g_warning ("Too many gtk_snapshot_pop() calls.");
       return NULL;
@@ -1182,17 +1162,13 @@ gtk_snapshot_to_node (GtkSnapshot *snapshot)
   result = gtk_snapshot_pop_internal (snapshot);
 
   /* We should have exactly our initial state */
-  if (snapshot->state_stack->len > 0 &&
-      !snapshot->from_parent)
+  if (snapshot->state_stack->len > 0)
     {
       g_warning ("Too many gtk_snapshot_push() calls. %u states remaining.", snapshot->state_stack->len);
     }
 
-  if (!snapshot->from_parent)
-    {
-      g_array_free (snapshot->state_stack, TRUE);
-      g_ptr_array_free (snapshot->nodes, TRUE);
-    }
+  g_array_free (snapshot->state_stack, TRUE);
+  g_ptr_array_free (snapshot->nodes, TRUE);
 
   snapshot->state_stack = NULL;
   snapshot->nodes = NULL;
diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h
index 7317b4ad59..aebf5c3840 100644
--- a/gtk/gtksnapshotprivate.h
+++ b/gtk/gtksnapshotprivate.h
@@ -88,16 +88,12 @@ struct _GdkSnapshot {
 
   GArray                *state_stack;
   GPtrArray             *nodes;
-
-  guint from_parent : 1;
 };
 
 struct _GtkSnapshotClass {
   GObjectClass           parent_class; /* it's really GdkSnapshotClass, but don't tell anyone! */
 };
 
-GtkSnapshot *           gtk_snapshot_new_with_parent            (GtkSnapshot            *parent_snapshot);
-
 void                    gtk_snapshot_append_text                (GtkSnapshot            *snapshot,
                                                                  PangoFont              *font,
                                                                  PangoGlyphString       *glyphs,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]