[mutter/wayland] window-actor: Move the operations we need to do when we cull out here



commit 0764b2058ad3686ffd910065d8accfa6ecccddc7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Nov 21 15:13:18 2013 -0500

    window-actor: Move the operations we need to do when we cull out here
    
    Soon, we'll move this into a generic MetaCullable interface, but for
    now, just put hardcoded knowledge in MetaWindowGroup.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=714706

 src/compositor/meta-window-actor-private.h |   11 +++-----
 src/compositor/meta-window-actor.c         |   40 ++++++++++++++++++++++++---
 src/compositor/meta-window-group.c         |   27 ++----------------
 3 files changed, 42 insertions(+), 36 deletions(-)
---
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index b9f88c4..2b9cb41 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -67,13 +67,10 @@ void     meta_window_actor_set_updates_frozen  (MetaWindowActor *self,
 void     meta_window_actor_queue_frame_drawn   (MetaWindowActor *self,
                                                 gboolean         no_delay_frame);
 
-cairo_region_t *meta_window_actor_get_obscured_region (MetaWindowActor *self);
-
-void meta_window_actor_set_clip_region         (MetaWindowActor *self,
-                                                cairo_region_t  *clip_region);
-void meta_window_actor_set_clip_region_beneath (MetaWindowActor *self,
-                                                cairo_region_t  *beneath_region);
-void meta_window_actor_reset_clip_regions      (MetaWindowActor *self);
+void meta_window_actor_cull_out (MetaWindowActor *self,
+                                 cairo_region_t  *unobscured_region,
+                                 cairo_region_t  *clip_region);
+void meta_window_actor_reset_culling (MetaWindowActor *self);
 
 void meta_window_actor_set_unobscured_region      (MetaWindowActor *self,
                                                    cairo_region_t  *unobscured_region);
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 8956f81..1bbb225 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1810,7 +1810,7 @@ meta_window_actor_unmapped (MetaWindowActor *self)
  * Return value: (transfer none): the area obscured by the window,
  *  %NULL is the same as an empty region.
  */
-cairo_region_t *
+static cairo_region_t *
 meta_window_actor_get_obscured_region (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
@@ -1910,7 +1910,7 @@ meta_window_actor_set_unobscured_region (MetaWindowActor *self,
  * not drawn in this frame.
  * This will be set before painting then unset afterwards.
  */
-void
+static void
 meta_window_actor_set_clip_region (MetaWindowActor *self,
                                    cairo_region_t  *clip_region)
 {
@@ -1931,7 +1931,7 @@ meta_window_actor_set_clip_region (MetaWindowActor *self,
  * shadow hid by the window itself. This will be set before painting
  * then unset afterwards.
  */
-void
+static void
 meta_window_actor_set_clip_region_beneath (MetaWindowActor *self,
                                            cairo_region_t  *beneath_region)
 {
@@ -1951,15 +1951,45 @@ meta_window_actor_set_clip_region_beneath (MetaWindowActor *self,
     }
 }
 
+void
+meta_window_actor_cull_out (MetaWindowActor *self,
+                            cairo_region_t  *unobscured_region,
+                            cairo_region_t  *clip_region)
+{
+  if (!meta_is_wayland_compositor ())
+    {
+      MetaCompScreen *info = meta_screen_get_compositor_data (self->priv->screen);
+
+      /* Don't do any culling for the unredirected window */
+      if (self == info->unredirected_window)
+        return;
+    }
+
+  meta_window_actor_set_unobscured_region (self, unobscured_region);
+  meta_window_actor_set_clip_region (self, clip_region);
+
+  if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self)) == 0xff)
+    {
+      cairo_region_t *obscured_region = meta_window_actor_get_obscured_region (self);
+      if (obscured_region)
+        {
+          cairo_region_subtract (unobscured_region, obscured_region);
+          cairo_region_subtract (clip_region, obscured_region);
+        }
+    }
+
+  meta_window_actor_set_clip_region_beneath (self, clip_region);
+}
+
 /**
- * meta_window_actor_reset_clip_regions:
+ * meta_window_actor_reset_culling:
  * @self: a #MetaWindowActor
  *
  * Unsets the regions set by meta_window_actor_set_clip_region() and
  * meta_window_actor_set_clip_region_beneath()
  */
 void
-meta_window_actor_reset_clip_regions (MetaWindowActor *self)
+meta_window_actor_reset_culling (MetaWindowActor *self)
 {
   MetaWindowActorPrivate *priv = self->priv;
 
diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c
index 44b35c8..be1b544 100644
--- a/src/compositor/meta-window-group.c
+++ b/src/compositor/meta-window-group.c
@@ -102,16 +102,9 @@ meta_window_group_cull_out (MetaWindowGroup *group,
   clutter_actor_iter_init (&iter, actor);
   while (clutter_actor_iter_prev (&iter, &child))
     {
-      MetaCompScreen *info = meta_screen_get_compositor_data (group->screen);
-
       if (!CLUTTER_ACTOR_IS_VISIBLE (child))
         continue;
 
-      if (!meta_is_wayland_compositor () &&
-          info->unredirected_window != NULL &&
-          child == CLUTTER_ACTOR (info->unredirected_window))
-        continue;
-
       /* If an actor has effects applied, then that can change the area
        * it paints and the opacity, so we no longer can figure out what
        * portion of the actor is obscured and what portion of the screen
@@ -133,30 +126,16 @@ meta_window_group_cull_out (MetaWindowGroup *group,
 
       if (META_IS_WINDOW_ACTOR (child))
         {
-          MetaWindowActor *window_actor = META_WINDOW_ACTOR (child);
           int x, y;
 
-          if (!meta_actor_is_untransformed (CLUTTER_ACTOR (window_actor), &x, &y))
+          if (!meta_actor_is_untransformed (child, &x, &y))
             continue;
 
           /* Temporarily move to the coordinate system of the actor */
           cairo_region_translate (unobscured_region, - x, - y);
           cairo_region_translate (clip_region, - x, - y);
 
-          meta_window_actor_set_unobscured_region (window_actor, unobscured_region);
-          meta_window_actor_set_clip_region (window_actor, clip_region);
-
-          if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (window_actor)) == 0xff)
-            {
-              cairo_region_t *obscured_region = meta_window_actor_get_obscured_region (window_actor);
-              if (obscured_region)
-                {
-                  cairo_region_subtract (unobscured_region, obscured_region);
-                  cairo_region_subtract (clip_region, obscured_region);
-                }
-            }
-
-          meta_window_actor_set_clip_region_beneath (window_actor, clip_region);
+          meta_window_actor_cull_out (META_WINDOW_ACTOR (child), unobscured_region, clip_region);
 
           cairo_region_translate (unobscured_region, x, y);
           cairo_region_translate (clip_region, x, y);
@@ -196,7 +175,7 @@ meta_window_group_reset_culling (MetaWindowGroup *group)
       if (META_IS_WINDOW_ACTOR (child))
         {
           MetaWindowActor *window_actor = META_WINDOW_ACTOR (child);
-          meta_window_actor_reset_clip_regions (window_actor);
+          meta_window_actor_reset_culling (window_actor);
         }
       else if (META_IS_BACKGROUND_ACTOR (child))
         {


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