[gtk+/wip/ebassi/gsk-renderer: 34/65] gsk: Add GskRenderer::clear_tree



commit ade7a1ad6acad244fc6ebb4c43379e3bddcebe75
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Apr 26 14:22:25 2016 +0100

    gsk: Add GskRenderer::clear_tree
    
    We need a way to clear eventual caches inside GskRenderer subclasses if
    the root node has changed.

 gsk/gskrenderer.c        |   15 +++++++++++++++
 gsk/gskrendererprivate.h |    5 +++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index cf90e38..3a84fc9 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -136,6 +136,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)
 {
   GskRenderer *self = GSK_RENDERER (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
diff --git a/gsk/gskrendererprivate.h b/gsk/gskrendererprivate.h
index 404502c..2237c86 100644
--- a/gsk/gskrendererprivate.h
+++ b/gsk/gskrendererprivate.h
@@ -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);


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