gsk: Add GskRenderNodeClass.make_immutable()

This commit is contained in:
Benjamin Otte 2016-12-11 11:53:17 +01:00
parent e4ee65fd19
commit d907f60843
3 changed files with 32 additions and 12 deletions

View File

@ -841,19 +841,12 @@ gsk_render_node_get_blend_mode (GskRenderNode *node)
void
gsk_render_node_make_immutable (GskRenderNode *node)
{
GskRenderNode *child;
if (!node->is_mutable)
return;
node->is_mutable = FALSE;
node->node_class->make_immutable (node);
for (child = gsk_render_node_get_first_child (node);
child != NULL;
child = gsk_render_node_get_next_sibling (child))
{
gsk_render_node_make_immutable (child);
}
node->is_mutable = FALSE;
}
/*< private >

View File

@ -41,11 +41,17 @@ gsk_texture_node_finalize (GskRenderNode *node)
gsk_texture_unref (self->texture);
}
static void
gsk_texture_node_make_immutable (GskRenderNode *node)
{
}
static const GskRenderNodeClass GSK_TEXTURE_NODE_CLASS = {
GSK_TEXTURE_NODE,
sizeof (GskTextureNode),
"GskTextureNode",
gsk_texture_node_finalize
gsk_texture_node_finalize,
gsk_texture_node_make_immutable
};
GskTexture *
@ -109,11 +115,17 @@ gsk_cairo_node_finalize (GskRenderNode *node)
cairo_surface_destroy (self->surface);
}
static void
gsk_cairo_node_make_immutable (GskRenderNode *node)
{
}
static const GskRenderNodeClass GSK_CAIRO_NODE_CLASS = {
GSK_CAIRO_NODE,
sizeof (GskCairoNode),
"GskCairoNode",
gsk_cairo_node_finalize
gsk_cairo_node_finalize,
gsk_cairo_node_make_immutable
};
/*< private >
@ -252,11 +264,25 @@ gsk_container_node_finalize (GskRenderNode *node)
{
}
static void
gsk_container_node_make_immutable (GskRenderNode *node)
{
GskRenderNode *child;
for (child = gsk_render_node_get_first_child (node);
child != NULL;
child = gsk_render_node_get_next_sibling (child))
{
gsk_render_node_make_immutable (child);
}
}
static const GskRenderNodeClass GSK_CONTAINER_NODE_CLASS = {
GSK_CONTAINER_NODE,
sizeof (GskRenderNode),
"GskContainerNode",
gsk_container_node_finalize
gsk_container_node_finalize,
gsk_container_node_make_immutable
};
/**

View File

@ -62,6 +62,7 @@ struct _GskRenderNodeClass
gsize struct_size;
const char *type_name;
void (* finalize) (GskRenderNode *node);
void (* make_immutable) (GskRenderNode *node);
};
GskRenderNode *gsk_render_node_new (const GskRenderNodeClass *node_class);