[gtk+/wip/otte/rendernode: 24/110] gtk: Don't push cairo nodes



commit 91473b1f6d7867ec58c645f07d3326cc868ba96a
Author: Benjamin Otte <otte redhat com>
Date:   Sun Dec 11 00:12:02 2016 +0100

    gtk: Don't push cairo nodes
    
    We want to split nodes into containers and nodes that do actual drawing.
    So pushing nodes that do drawing is exactly the wrong thing.
    
    Also fix up GtkPopover. There's no need for it to push anything.

 docs/reference/gtk/gtk4-sections.txt |    1 -
 gtk/gtkpopover.c                     |    8 ++---
 gtk/gtksnapshot.c                    |   49 ----------------------------------
 gtk/gtksnapshot.h                    |    5 ---
 4 files changed, 3 insertions(+), 60 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index abc1183..eeae960 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4456,7 +4456,6 @@ GtkSnapshot
 gtk_snapshot_get_renderer
 gtk_snapshot_push
 gtk_snapshot_push_node
-gtk_snapshot_push_cairo_node
 gtk_snapshot_pop
 gtk_snapshot_set_transform
 gtk_snapshot_transform
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index fce815a..17a4f2e 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1125,9 +1125,9 @@ gtk_popover_snapshot (GtkWidget   *widget,
   graphene_rect_init (&bounds,
                       clip.x - allocation.x, clip.y - allocation.y,
                       clip.width, clip.height);
-  cr = gtk_snapshot_push_cairo_node (snapshot,
-                                     &bounds,
-                                     "Popover");
+  cr = gtk_snapshot_append_cairo_node (snapshot,
+                                       &bounds,
+                                       "Popover");
   /* Render the rect background */
   gtk_render_background (context, cr,
                          rect_x, rect_y,
@@ -1198,8 +1198,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
   if (child)
     gtk_container_snapshot_child (GTK_CONTAINER (widget), child, snapshot);
-
-  gtk_snapshot_pop (snapshot);
 }
 
 static void
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index c7c2bd3..b6025a8 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -432,55 +432,6 @@ gtk_snapshot_append_cairo_node (GtkSnapshot           *snapshot,
   return gsk_render_node_get_draw_context (node, snapshot->renderer);
 }
 
-/**
- * gtk_snapshot_push_cairo_node:
- * @snapshot: a #GtkSnapshot
- * @bounds: the bounds for the new node
- * @name: (transfer none): a printf() style format string for the name for the new node
- * @...: arguments to insert into the format string
- *
- * Creates a new render node, appends it to the current render
- * node of @snapshot, and makes it the new current render node.
- *
- * Returns: a cairo_t suitable for drawing the contents of the newly
- *     created render node
- *
- * Since: 3.90
- */
-cairo_t *
-gtk_snapshot_push_cairo_node (GtkSnapshot            *snapshot,
-                              const graphene_rect_t  *bounds,
-                              const char             *name,
-                              ...)
-{
-  GskRenderNode *node;
-
-  g_return_val_if_fail (snapshot != NULL, NULL);
-  g_return_val_if_fail (bounds != NULL, NULL);
-
-  node = gsk_renderer_create_render_node (snapshot->renderer);
-  gsk_render_node_set_bounds (node, bounds);
-
-  if (name)
-    {
-      va_list args;
-      char *str;
-
-      va_start (args, name);
-      str = g_strdup_vprintf (name, args);
-      va_end (args);
-
-      gsk_render_node_set_name (node, str);
-
-      g_free (str);
-    }
-
-  gtk_snapshot_push_node (snapshot, node);
-  gsk_render_node_unref (node);
-
-  return gsk_render_node_get_draw_context (node, snapshot->renderer);
-}
-
 static void
 rectangle_init_from_graphene (cairo_rectangle_int_t *cairo,
                               const graphene_rect_t *graphene)
diff --git a/gtk/gtksnapshot.h b/gtk/gtksnapshot.h
index e981132..dbf8b76 100644
--- a/gtk/gtksnapshot.h
+++ b/gtk/gtksnapshot.h
@@ -48,11 +48,6 @@ GDK_AVAILABLE_IN_3_90
 void            gtk_snapshot_push_node                  (GtkSnapshot            *snapshot,
                                                          GskRenderNode          *node);
 GDK_AVAILABLE_IN_3_90
-cairo_t *       gtk_snapshot_push_cairo_node            (GtkSnapshot            *snapshot,
-                                                         const graphene_rect_t  *bounds,
-                                                         const char             *name,
-                                                         ...) G_GNUC_PRINTF(3, 4);
-GDK_AVAILABLE_IN_3_90
 void            gtk_snapshot_pop                        (GtkSnapshot            *snapshot);
 
 GDK_AVAILABLE_IN_3_90


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