From 78592cbcc86e78070eac978403d80ae5ec9089c8 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Thu, 1 Oct 2020 01:38:16 +0200 Subject: [PATCH] surface-actor: Simplify culling logic This reverts the commits 372d73e2757 and 1d2004524728 - the special case for alpha-less textures could only happen on Wayland, but now the opaque region is also set in those cases. This commit saves us some allocations, simplifies the logic a bit and makes sure culling uses the same opaque region as our painting paths. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1463 --- src/compositor/meta-surface-actor.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index 884a7a2b3..0fa6f64ed 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -295,25 +295,9 @@ meta_surface_actor_cull_out (MetaCullable *cullable, cairo_region_t *scaled_opaque_region; opaque_region = meta_shaped_texture_get_opaque_region (priv->texture); - if (opaque_region) - { - cairo_region_reference (opaque_region); - } - else if (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); - } - else - { - return; - } + if (!opaque_region) + return; scaled_opaque_region = get_scaled_region (surface_actor, opaque_region, @@ -324,7 +308,6 @@ meta_surface_actor_cull_out (MetaCullable *cullable, if (clip_region) cairo_region_subtract (clip_region, scaled_opaque_region); - cairo_region_destroy (opaque_region); cairo_region_destroy (scaled_opaque_region); } }