Rectangles with square corners are filled with hard edges on the GLES backend, so rectangles that share an edge leave no seam between them
CI / build + test (push) Canceled after 0s
CI / cargo audit (push) Canceled after 0s

On the GLES backend, Prompt's selection showed a dark line between every two of its rows. `GlesCanvas::fill_rect` always grew the quad by 1 px and passed `u_pad = 1`, so the rect shader never took its solid path, which only runs with no radius, no stroke and no pad, and antialiased every rectangle over a band from −1 to +1 px around its edge. A pixel along an edge, its centre half a pixel inside, was covered at 84 % even when the edge lay on a whole pixel, so two rectangles that met there each left 16 % of what lay beneath showing through, which over a dark background reads as a line. The software backend does not show it, since tiny-skia covers a pixel-aligned edge fully.
A rectangle with square corners now gets no pad, which takes the shader's hard-edged path, as tiny-skia fills it. Rounded rectangles keep the pad and their antialiased edges. A square rectangle whose edges fall between pixels now has a hard edge where it had a soft one.
This commit is contained in:
2026-10-17 20:04:40 +02:00
parent cacf871ddd
commit ef6847b12c
+2 -1
View File
@@ -132,7 +132,8 @@ impl GlesCanvas
// straight edges of pills / rounded rects. `u_size` and `u_radii`
// stay anchored to the original rect — `u_pad` lets the shader
// remap `v_uv` from the larger quad back into rect-local space.
let pad = 1.0_f32;
// Square corners take the shader's hard-edged path instead, so rects that share an edge leave no seam.
let pad = if corners.is_zero() { 0.0_f32 } else { 1.0 };
let expanded = rect.expand( pad );
let mvp = ortho_rect( self.width, self.height, expanded );
let alpha = color.a * self.global_alpha;