summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsizanoen1 <msizanoen@qtmlabs.xyz>2022-12-18 12:52:29 +0700
committerMarge Bot <marge-bot@gnome.org>2023-03-04 18:23:34 +0000
commitaad0baf70d15164d4049dabf7928c80381b99266 (patch)
tree3b3b2267e7d4b6a57dd77cd7a9a8e03d2ae0acee
parent7e1427ba8af0899926a881b4f71d4233a5736a04 (diff)
downloadmutter-aad0baf70d15164d4049dabf7928c80381b99266.tar.gz
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2771>
-rw-r--r--src/compositor/meta-shaped-texture.c19
1 files 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,