From b21882bcea94fd9acf0edd9937e8318f134c7275 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 29 Mar 2019 05:01:33 +0100 Subject: [PATCH] cssimagelinear: Make gradient offsets stay in [0, 1] Fixes linear-gradient reftest --- gtk/gtkcssimagelinear.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c index 1253ed8bf9..5487767ae2 100644 --- a/gtk/gtkcssimagelinear.c +++ b/gtk/gtkcssimagelinear.c @@ -211,7 +211,10 @@ gtk_css_image_linear_snapshot (GtkCssImage *image, continue; } else - pos = _gtk_css_number_value_get (stop->offset, length) / length; + { + pos = _gtk_css_number_value_get (stop->offset, length) / length; + pos = CLAMP (pos, 0.0, 1.0); + } pos = MAX (pos, offset); step = (pos - offset) / (i - last);