cssimagelinear: Make gradient offsets stay in [0, 1]

Fixes linear-gradient reftest
This commit is contained in:
Benjamin Otte 2019-03-29 05:01:33 +01:00
parent fee8f6b9be
commit b21882bcea

View File

@ -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);