gsk: Add GskRenderer::clear_tree

We need a way to clear eventual caches inside GskRenderer subclasses if
the root node has changed.
This commit is contained in:
Emmanuele Bassi 2016-04-26 14:22:25 +01:00
parent 9d3ca22b4c
commit 635fd7026a
2 changed files with 20 additions and 0 deletions

View File

@ -135,6 +135,12 @@ gsk_renderer_real_validate_tree (GskRenderer *self,
{
}
static void
gsk_renderer_real_clear_tree (GskRenderer *self,
GskRenderNode *old_root)
{
}
static void
gsk_renderer_dispose (GObject *gobject)
{
@ -294,6 +300,7 @@ gsk_renderer_class_init (GskRendererClass *klass)
klass->resize_viewport = gsk_renderer_real_resize_viewport;
klass->update = gsk_renderer_real_update;
klass->validate_tree = gsk_renderer_real_validate_tree;
klass->clear_tree = gsk_renderer_real_clear_tree;
klass->render = gsk_renderer_real_render;
gobject_class->constructed = gsk_renderer_constructed;
@ -727,6 +734,7 @@ gsk_renderer_set_root_node (GskRenderer *renderer,
if (old_root != NULL)
{
gsk_render_node_set_invalidate_func (old_root, NULL, NULL, NULL);
gsk_renderer_clear_tree (renderer, old_root);
g_object_unref (old_root);
}
@ -1135,6 +1143,13 @@ gsk_renderer_maybe_update (GskRenderer *renderer)
}
}
void
gsk_renderer_clear_tree (GskRenderer *renderer,
GskRenderNode *old_root)
{
GSK_RENDERER_GET_CLASS (renderer)->clear_tree (renderer, old_root);
}
/*< private >
* gsk_renderer_maybe_validate_tree:
* @renderer: a #GskRenderer

View File

@ -46,12 +46,17 @@ struct _GskRendererClass
const graphene_matrix_t *projection);
void (* validate_tree) (GskRenderer *renderer,
GskRenderNode *root);
void (* clear_tree) (GskRenderer *renderer,
GskRenderNode *old_root);
void (* clear) (GskRenderer *renderer);
void (* render) (GskRenderer *renderer);
};
gboolean gsk_renderer_is_realized (GskRenderer *renderer);
void gsk_renderer_clear_tree (GskRenderer *renderer,
GskRenderNode *old_root);
void gsk_renderer_maybe_resize_viewport (GskRenderer *renderer);
void gsk_renderer_maybe_update (GskRenderer *renderer);
void gsk_renderer_maybe_validate_tree (GskRenderer *renderer);