[mutter/wip/carlosg/performance-improvements: 5/23] ClutterActor: Preserve valid paint volumes till the next relayout/repaint



commit 91309a2088d02802a3da50e925b1f60089781a4b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Apr 29 13:43:33 2017 +0200

    ClutterActor: Preserve valid paint volumes till the next relayout/repaint
    
    Cuts down approximately 55% of paint volumes calculation when there's
    windows that redraw frequently, but don't move.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782344

 clutter/clutter/clutter-actor.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index e8ae3d1..386fc08 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -840,6 +840,7 @@ struct _ClutterActorPrivate
   guint needs_compute_expand        : 1;
   guint needs_x_expand              : 1;
   guint needs_y_expand              : 1;
+  guint needs_paint_volume_update   : 1;
 };
 
 enum
@@ -2619,6 +2620,7 @@ clutter_actor_real_allocate (ClutterActor           *self,
   g_object_freeze_notify (G_OBJECT (self));
 
   changed = clutter_actor_set_allocation_internal (self, box, flags);
+  priv->needs_paint_volume_update = changed;
 
   /* we allocate our children before we notify changes in our geometry,
    * so that people connecting to properties will be able to get valid
@@ -2679,6 +2681,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
   if (self != origin)
     {
       self->priv->is_dirty = TRUE;
+      self->priv->needs_paint_volume_update = TRUE;
       self->priv->effect_to_redraw = NULL;
     }
 
@@ -8510,6 +8513,7 @@ clutter_actor_init (ClutterActor *self)
   priv->needs_width_request = TRUE;
   priv->needs_height_request = TRUE;
   priv->needs_allocation = TRUE;
+  priv->needs_paint_volume_update = TRUE;
 
   priv->cached_width_age = 1;
   priv->cached_height_age = 1;
@@ -8907,6 +8911,7 @@ _clutter_actor_queue_redraw_full (ClutterActor       *self,
     }
 
   priv->is_dirty = TRUE;
+  priv->needs_paint_volume_update = TRUE;
 }
 
 /**
@@ -12963,6 +12968,7 @@ clutter_actor_add_child_internal (ClutterActor              *self,
       child->priv->needs_width_request = TRUE;
       child->priv->needs_height_request = TRUE;
       child->priv->needs_allocation = TRUE;
+      child->priv->needs_paint_volume_update = TRUE;
 
       /* we only queue a relayout here, because any possible
        * redraw has already been queued either by show() or
@@ -17506,16 +17512,22 @@ _clutter_actor_get_paint_volume_mutable (ClutterActor *self)
   priv = self->priv;
 
   if (priv->paint_volume_valid)
-    clutter_paint_volume_free (&priv->paint_volume);
+    {
+      if (!priv->needs_paint_volume_update)
+        return &priv->paint_volume;
+      clutter_paint_volume_free (&priv->paint_volume);
+    }
 
   if (_clutter_actor_get_paint_volume_real (self, &priv->paint_volume))
     {
       priv->paint_volume_valid = TRUE;
+      priv->needs_paint_volume_update = FALSE;
       return &priv->paint_volume;
     }
   else
     {
       priv->paint_volume_valid = FALSE;
+      priv->needs_paint_volume_update = FALSE;
       return NULL;
     }
 }


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