From 372d73e2757b6d73e72be08af515727205f301b6 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Sun, 23 Feb 2020 16:37:50 +0100 Subject: [PATCH] surface-actor: Cull out surfaces without alpha channel If a opaque region is explicitly set we should not consider the surface opaque, as that implies e.g. a shape region is set. If no opque region is set but the texture does not have an alpha channel, we can savely cull it out. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1082 --- src/compositor/meta-surface-actor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index 15bf24c07..02b7af2fc 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -274,6 +274,18 @@ meta_surface_actor_cull_out (MetaCullable *cullable, opaque_region = meta_shaped_texture_get_opaque_region (priv->texture); + if (!opaque_region && meta_shaped_texture_is_opaque (priv->texture)) + { + cairo_rectangle_int_t rect; + + rect = (cairo_rectangle_int_t) { + .width = meta_shaped_texture_get_width (priv->texture), + .height = meta_shaped_texture_get_height (priv->texture) + }; + + opaque_region = cairo_region_create_rectangle (&rect); + } + if (!opaque_region) return;