[mutter/wip/culling: 2/8] window-actor: Move the operations we need to do when we cull out here



commit 907364303e6cb9bbd8da79fcc8f0974bf1511dbe
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         |   31 +++++++++++++++++++++++----
 src/compositor/meta-window-group.c         |   20 ++---------------
 3 files changed, 33 insertions(+), 29 deletions(-)
---
diff --git a/src/compositor/meta-window-actor-private.h b/src/compositor/meta-window-actor-private.h
index c05343d..f10276b 100644
--- a/src/compositor/meta-window-actor-private.h
+++ b/src/compositor/meta-window-actor-private.h
@@ -55,13 +55,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 9274d2c..153b303 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -1717,7 +1717,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;
@@ -1806,7 +1806,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)
 {
@@ -1828,7 +1828,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)
 {
@@ -1848,15 +1848,36 @@ 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)
+{
+  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 d655eb6..ea23e1d 100644
--- a/src/compositor/meta-window-group.c
+++ b/src/compositor/meta-window-group.c
@@ -155,10 +155,9 @@ 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;
 
           x += paint_x_offset;
@@ -168,20 +167,7 @@ meta_window_group_cull_out (MetaWindowGroup *group,
           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);
@@ -225,7 +211,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]