[mutter/wip/carlosg/performance-improvements: 4/13] ClutterActor: Preserve valid paint volumes till the next relayout



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

    ClutterActor: Preserve valid paint volumes till the next relayout
    
    Cuts down approximately 75% of paint volumes calculation when there's
    windows that redraw frequently, but don't move.

 clutter/clutter/clutter-actor.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index e8ae3d1..a17666a 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
@@ -2729,6 +2730,7 @@ clutter_actor_real_queue_relayout (ClutterActor *self)
   priv->needs_width_request  = TRUE;
   priv->needs_height_request = TRUE;
   priv->needs_allocation     = TRUE;
+  priv->needs_paint_volume_update = TRUE;
 
   /* reset the cached size requests */
   memset (priv->width_requests, 0,
@@ -8510,6 +8512,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;
@@ -12963,6 +12966,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 +17510,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]