gsk: Add gsk_container_node_new()

It replaces gsk_renderer_create_render_node() which was doing the eact
same thing, only taking an unused extra argument.
This commit is contained in:
Benjamin Otte 2016-12-11 04:14:04 +01:00
parent 8830a1a1ad
commit a97b819b81
6 changed files with 30 additions and 29 deletions

View File

@ -11,7 +11,6 @@ gsk_renderer_realize
gsk_renderer_unrealize
gsk_renderer_begin_draw_frame
gsk_renderer_end_draw_frame
gsk_renderer_create_render_node
gsk_renderer_render
<SUBSECTION Standard>
GSK_IS_RENDERER
@ -50,6 +49,7 @@ gsk_render_node_set_name
gsk_texture_node_new
gsk_cairo_node_new
gsk_cairo_node_get_draw_context
gsk_container_node_new
<SUBSECTION Standard>
GSK_IS_RENDER_NODE
GSK_RENDER_NODE

View File

@ -676,29 +676,6 @@ gsk_renderer_render (GskRenderer *renderer,
g_clear_pointer (&priv->root_node, gsk_render_node_unref);
}
static const GskRenderNodeClass GSK_CONTAINER_NODE_CLASS = {
GSK_CONTAINER_NODE,
"GskContainerNode"
};
/**
* gsk_renderer_create_render_node:
* @renderer: a #GskRenderer
*
* Creates a new #GskRenderNode instance tied to the given @renderer.
*
* Returns: (transfer full): the new #GskRenderNode
*
* Since: 3.90
*/
GskRenderNode *
gsk_renderer_create_render_node (GskRenderer *renderer)
{
g_return_val_if_fail (GSK_IS_RENDERER (renderer), NULL);
return gsk_render_node_new (&GSK_CONTAINER_NODE_CLASS);
}
/*< private >
* gsk_renderer_get_profiler:
* @renderer: a #GskRenderer

View File

@ -68,9 +68,6 @@ gboolean gsk_renderer_realize (GskRenderer
GDK_AVAILABLE_IN_3_90
void gsk_renderer_unrealize (GskRenderer *renderer);
GDK_AVAILABLE_IN_3_90
GskRenderNode * gsk_renderer_create_render_node (GskRenderer *renderer);
GDK_AVAILABLE_IN_3_90
GskRenderer * gsk_renderer_create_fallback (GskRenderer *renderer,
const graphene_rect_t *viewport,

View File

@ -54,6 +54,9 @@ GDK_AVAILABLE_IN_3_90
cairo_t * gsk_cairo_node_get_draw_context (GskRenderNode *node,
GskRenderer *renderer);
GDK_AVAILABLE_IN_3_90
GskRenderNode * gsk_container_node_new (void);
GDK_AVAILABLE_IN_3_90
GskRenderNode * gsk_render_node_get_parent (GskRenderNode *node);
GDK_AVAILABLE_IN_3_90

View File

@ -201,3 +201,27 @@ gsk_cairo_node_get_draw_context (GskRenderNode *node,
return res;
}
/**** GSK_CONTAINER_NODE ***/
static const GskRenderNodeClass GSK_CONTAINER_NODE_CLASS = {
GSK_CONTAINER_NODE,
"GskContainerNode"
};
/**
* gsk_container_node_new:
*
* Creates a new #GskRenderNode instance for holding multiple different
* render nodes. You can use gsk_container_node_append_child() to add
* nodes to the container.
*
* Returns: (transfer full): the new #GskRenderNode
*
* Since: 3.90
*/
GskRenderNode *
gsk_container_node_new (void)
{
return gsk_render_node_new (&GSK_CONTAINER_NODE_CLASS);
}

View File

@ -110,7 +110,7 @@ gtk_snapshot_init (GtkSnapshot *snapshot,
snapshot->state = NULL;
snapshot->renderer = renderer;
snapshot->clip_region = clip;
snapshot->root = gsk_renderer_create_render_node (renderer);
snapshot->root = gsk_container_node_new ();
gsk_render_node_set_bounds (snapshot->root, &GRAPHENE_RECT_INIT (extents.x, extents.y, extents.width, extents.height));
if (name)
@ -182,7 +182,7 @@ gtk_snapshot_push (GtkSnapshot *snapshot,
{
GskRenderNode *node;
node = gsk_renderer_create_render_node (snapshot->renderer);
node = gsk_container_node_new ();
gsk_render_node_set_bounds (node, bounds);
if (name)