[mutter] window-actor: Don't pass around client_area



commit 7253a5d274ac78815b0a8e0d59f139749d4b4c1c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Feb 26 19:35:41 2014 -0500

    window-actor: Don't pass around client_area
    
    To solve a performance regression, the three update_*_region
    calls are going to be split up, so just call get_client_area_rect
    in the methods itself.

 src/compositor/meta-window-actor.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 6eeeaa7..7e628e1 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1974,16 +1974,18 @@ build_and_scan_frame_mask (MetaWindowActor       *self,
 }
 
 static void
-meta_window_actor_update_shape_region (MetaWindowActor       *self,
-                                       cairo_rectangle_int_t *client_area)
+meta_window_actor_update_shape_region (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
   cairo_region_t *region = NULL;
+  cairo_rectangle_int_t client_area;
+
+  meta_window_get_client_area_rect (priv->window, &client_area);
 
   if (priv->window->frame != NULL && priv->window->shape_region != NULL)
     {
       region = cairo_region_copy (priv->window->shape_region);
-      cairo_region_translate (region, client_area->x, client_area->y);
+      cairo_region_translate (region, client_area.x, client_area.y);
     }
   else if (priv->window->shape_region != NULL)
     {
@@ -1994,12 +1996,12 @@ meta_window_actor_update_shape_region (MetaWindowActor       *self,
       /* If we don't have a shape on the server, that means that
        * we have an implicit shape of one rectangle covering the
        * entire window. */
-      region = cairo_region_create_rectangle (client_area);
+      region = cairo_region_create_rectangle (&client_area);
     }
 
   meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor), NULL);
   if ((priv->window->shape_region != NULL) || (priv->window->frame != NULL))
-    build_and_scan_frame_mask (self, client_area, region);
+    build_and_scan_frame_mask (self, &client_area, region);
 
   g_clear_pointer (&priv->shape_region, cairo_region_destroy);
   priv->shape_region = region;
@@ -2010,24 +2012,26 @@ meta_window_actor_update_shape_region (MetaWindowActor       *self,
 }
 
 static void
-meta_window_actor_update_input_region (MetaWindowActor       *self,
-                                       cairo_rectangle_int_t *client_area)
+meta_window_actor_update_input_region (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
   MetaShapedTexture *stex = META_SHAPED_TEXTURE (priv->actor);
   cairo_region_t *region = NULL;
+  cairo_rectangle_int_t client_area;
+
+  meta_window_get_client_area_rect (priv->window, &client_area);
 
   if (priv->window->frame != NULL && priv->window->input_region != NULL)
     {
       region = meta_frame_get_frame_bounds (priv->window->frame);
 
-      cairo_region_subtract_rectangle (region, client_area);
+      cairo_region_subtract_rectangle (region, &client_area);
 
       /* input_region is in client window coordinates, so translate the
        * input region into that coordinate system and back */
-      cairo_region_translate (region, -client_area->x, -client_area->y);
+      cairo_region_translate (region, -client_area.x, -client_area.y);
       cairo_region_union (region, priv->window->input_region);
-      cairo_region_translate (region, client_area->x, client_area->y);
+      cairo_region_translate (region, client_area.x, client_area.y);
     }
   else if (priv->window->input_region != NULL)
     {
@@ -2038,7 +2042,7 @@ meta_window_actor_update_input_region (MetaWindowActor       *self,
       /* If we don't have a shape on the server, that means that
        * we have an implicit shape of one rectangle covering the
        * entire window. */
-      region = cairo_region_create_rectangle (client_area);
+      region = cairo_region_create_rectangle (&client_area);
     }
 
   meta_shaped_texture_set_input_shape_region (stex, region);
@@ -2084,15 +2088,12 @@ static void
 check_needs_reshape (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
-  cairo_rectangle_int_t client_area;
 
   if (!priv->needs_reshape)
     return;
 
-  meta_window_get_client_area_rect (window, &client_area);
-
-  meta_window_actor_update_shape_region (self, &client_area);
-  meta_window_actor_update_input_region (self, &client_area);
+  meta_window_actor_update_shape_region (self);
+  meta_window_actor_update_input_region (self);
   meta_window_actor_update_opaque_region (self);
 
   priv->needs_reshape = FALSE;


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