[mutter] background: Don't bother attaching a paint node if the region is empty



commit b284126d3bc22ee44653c12987429ed768bb626a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Aug 7 14:59:59 2014 -0400

    background: Don't bother attaching a paint node if the region is empty

 src/compositor/meta-background.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index 3bb87b8..0f6220f 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -410,8 +410,6 @@ meta_background_paint_content (ClutterContent   *content,
   if (priv->texture == NULL)
     return;
 
-  node = meta_background_paint_node_new (self, actor);
-
   clutter_actor_get_content_box (actor, &actor_box);
 
   /* First figure out where on the monitor the texture is supposed to be painted.
@@ -444,6 +442,11 @@ meta_background_paint_content (ClutterContent   *content,
         cairo_region_intersect (paintable_region, clip_region);
     }
 
+  if (cairo_region_is_empty (paintable_region))
+    goto out;
+
+  node = meta_background_paint_node_new (self, actor);
+
   /* Finally, split the paintable region up into distinct areas
    * and paint each area one by one
    */
@@ -466,10 +469,11 @@ meta_background_paint_content (ClutterContent   *content,
 
       clutter_paint_node_add_texture_rectangle (node, &texture_rectangle, tx1, ty1, tx2, ty2);
     }
-  cairo_region_destroy (paintable_region);
-
   clutter_paint_node_add_child (root, node);
   clutter_paint_node_unref (node);
+
+ out:
+  cairo_region_destroy (paintable_region);
 }
 
 static void


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