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>
This commit is contained in:
msizanoen1 2022-12-18 12:52:29 +07:00 committed by Marge Bot
parent 7e1427ba8a
commit aad0baf70d

View File

@ -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,