diff options
-rw-r--r-- | src/compositor/meta-window-actor-private.h | 11 | ||||
-rw-r--r-- | src/compositor/meta-window-actor.c | 40 | ||||
-rw-r--r-- | 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 b9f88c4ca..2b9cb4138 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 8956f810d..1bbb2255f 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 44b35c820..be1b54462 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)) { |