summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-04-11 22:09:45 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-04-11 22:10:33 -0400
commitf3bf4e487690443ba6f3acc341ad7f7293b0aae4 (patch)
treebbe3227b19dd44d093f2cf941c8c6e93a72c654d
parent46270d3dcd81f4437f4441c3f5439ba17f246de1 (diff)
downloadgtk+-f3bf4e487690443ba6f3acc341ad7f7293b0aae4.tar.gz
ngl: Don't slice unsliceable shadows
When the corners are too big to make slicing work, don't do it, since it leads to broken results.
-rw-r--r--gsk/ngl/gsknglrenderjob.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index 4a3d1394b7..5c34d1273b 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -2311,6 +2311,8 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
int cached_tid;
gboolean do_slicing;
guint16 color[4];
+ float half_width = outline->bounds.size.width / 2;
+ float half_height = outline->bounds.size.height / 2;
rgba_to_half (gsk_outset_shadow_node_get_color (node), color);
@@ -2319,7 +2321,15 @@ gsk_ngl_render_job_visit_blurred_outset_shadow_node (GskNglRenderJob *job,
scaled_outline = *outline;
if (outline->bounds.size.width < blur_extra ||
- outline->bounds.size.height < blur_extra)
+ outline->bounds.size.height < blur_extra ||
+ outline->corner[0].width >= half_width ||
+ outline->corner[1].width >= half_width ||
+ outline->corner[2].width >= half_width ||
+ outline->corner[3].width >= half_width ||
+ outline->corner[0].height >= half_height ||
+ outline->corner[1].height >= half_height ||
+ outline->corner[2].height >= half_height ||
+ outline->corner[3].height >= half_height)
{
do_slicing = FALSE;
gsk_rounded_rect_shrink (&scaled_outline, -spread, -spread, -spread, -spread);