mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 19:47:17 +02:00
We implemented repeating linear gradients by expanding a vector of color stops until the entire range was covered. This is both a bit wasteful and caused Skia to draw corrupted gradients to screen whenever the total amount of color stops and positions exceeded 127. Instead of doing that, use the original color stops for the shader and repeat it instead of clamping it. We need to do a bit of math to project positions correctly, but after that the shader repeats itself nicely. While we're here, calculate the gradient's length and the center point as floats instead of ints, yielding a slight but noticeable improvement in gradient rendering (see the diff on the zig zag pattern in css-gradients.html for an example of this).
244 KiB
800x1158px
244 KiB
800x1158px