From 64d34a76489ce46926ece828259ed4c394730f94 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 1 Oct 2020 18:01:46 +0800 Subject: [PATCH] background-content: Apply Cullable clipping even in the transformed case Just like we used to before 30809665d8. Because in some cases `clip_region` is able to shave off an extra pixel from the edge of the redraw rectangle(s). And not shaving that off was making the background rendering inconsistent with shaped-texture, causing occasional off-by-one artefacts. Now both shaped-texture and background-content agree on the clip region again that doesn't happen. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1443 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1464 --- src/compositor/meta-background-content.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/compositor/meta-background-content.c b/src/compositor/meta-background-content.c index bf203aa9a..ce6ee2fff 100644 --- a/src/compositor/meta-background-content.c +++ b/src/compositor/meta-background-content.c @@ -557,15 +557,23 @@ meta_background_content_paint_content (ClutterContent *content, region = cairo_region_create_rectangle (&rect_within_stage); } } - - if (self->unobscured_region) - cairo_region_intersect (region, self->unobscured_region); } else /* actor and stage space are different but we need actor space */ { - region = cairo_region_create_rectangle (&rect_within_actor); + if (self->clip_region) + { + region = cairo_region_copy (self->clip_region); + cairo_region_intersect_rectangle (region, &rect_within_actor); + } + else + { + region = cairo_region_create_rectangle (&rect_within_actor); + } } + if (self->unobscured_region) + cairo_region_intersect (region, self->unobscured_region); + /* region is now in actor space */ if (cairo_region_is_empty (region)) {