gsk: Extend the blur radius for outset shadow extents
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 23 Nov 2022 17:58:18 +0000 (18:58 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 23 Nov 2022 18:27:49 +0000 (19:27 +0100)
By dividing the blur radius to obtain the clip radius, we may end up
with halved values that result in an overshunk clip mask. Extend this
so that we ensure to cover the last pixel.

Fixes artifacts seen with the cairo renderer in X11 when resizing
windows horizontally, a black 1px high line would be seen in the
top of the window due to these outset bounds being used in clipping.

More mysteriously, also seems to fix resize lag in the GL renderer
(also X11), if e.g. the bottom-right corner of a window is resized
diagonally in bottom-left -> top-right direction, or
bottom-right -> top-left.

Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175#note_1599335

gsk/gskrendernodeimpl.c

index 482b14bef921f90e1c479d17182c22ffc7e582d8..8eaea1f20a3956cec143cf4503ecc93fda2db0f6 100644 (file)
@@ -2160,7 +2160,7 @@ gsk_outset_shadow_get_extents (GskOutsetShadowNode *self,
 {
   float clip_radius;
 
-  clip_radius = gsk_cairo_blur_compute_pixels (self->blur_radius / 2.0);
+  clip_radius = gsk_cairo_blur_compute_pixels (ceil (self->blur_radius / 2.0));
   *top = MAX (0, ceil (clip_radius + self->spread - self->dy));
   *right = MAX (0, ceil (clip_radius + self->spread + self->dx));
   *bottom = MAX (0, ceil (clip_radius + self->spread + self->dy));