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.
This commit is contained in:
Benjamin Otte 2016-12-11 00:12:02 +01:00
parent 8c8691b469
commit d1b80a6baa
4 changed files with 3 additions and 60 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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