From aad0baf70d15164d4049dabf7928c80381b99266 Mon Sep 17 00:00:00 2001 From: msizanoen1 Date: Sun, 18 Dec 2022 12:52:29 +0700 Subject: [PATCH] shaped-texture: Account for linear sampling when calculating actor damage Linear sampling can influence the value of surrounding pixels beyond the scaled framebuffer extents calculated during stage view rendering, resulting in flickering graphical artifacts due to unaccounted pixel changes. This is exhibited in xfreerdp and wlfreerdp at 150% display scaling. Fix this by ensuring that all pixels that may be affected by linear scaling is included in the framebuffer redraw clip by padding the actor redraw clip. Part-of: --- src/compositor/meta-shaped-texture.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 1b25cea48..63f144c6b 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -951,19 +951,30 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, cairo_rectangle_int_t *clip) { MetaMonitorTransform inverted_transform; + cairo_rectangle_int_t buffer_rect; int scaled_and_transformed_width; int scaled_and_transformed_height; if (stex->texture == NULL) return FALSE; + /* Pad the actor clip to ensure that pixels affected by linear scaling are accounted for */ *clip = (cairo_rectangle_int_t) { - .x = x, - .y = y, - .width = width, - .height = height + .x = x - 1, + .y = y - 1, + .width = width + 2, + .height = height + 2 }; + buffer_rect = (cairo_rectangle_int_t) { + .x = 0, + .y = 0, + .width = stex->tex_width, + .height = stex->tex_height, + }; + + meta_rectangle_intersect (&buffer_rect, clip, clip); + meta_rectangle_scale_double (clip, 1.0 / stex->buffer_scale, META_ROUNDING_STRATEGY_GROW,