Show recent errors as labelled chips and rebuild the reset button to match

This commit is contained in:
flamingcow
2026-07-31 17:05:31 -07:00
parent f512391ee4
commit 3c8637f931
2 changed files with 85 additions and 16 deletions
+26
View File
@@ -3,6 +3,7 @@ package main
import (
"encoding/binary"
"fmt"
"math"
"path/filepath"
"unsafe"
@@ -449,6 +450,31 @@ func (fb *framebuffer) rect(x0, y0, w, h int, c rgb) {
}
}
// Distance to the rectangle the corner radius sweeps around, which is zero
// across the whole flat middle and grows only near a corner. Taking coverage
// from that rather than from a plain inside test keeps the curves smooth
// instead of stepped.
func (fb *framebuffer) roundRect(x0, y0, w, h, r int, c rgb) {
// A radius past half the shorter side has no meaning and would put the
// swept rectangle inside out, which matters while something is growing from
// nothing.
r = min(r, min(w, h)/2)
ix0, iy0 := float64(x0+r), float64(y0+r)
ix1, iy1 := float64(x0+w-1-r), float64(y0+h-1-r)
for y := y0; y < y0+h; y++ {
for x := x0; x < x0+w; x++ {
fx, fy := float64(x), float64(y)
dx := math.Max(math.Max(ix0-fx, fx-ix1), 0)
dy := math.Max(math.Max(iy0-fy, fy-iy1), 0)
cov := float64(r) - math.Sqrt(dx*dx+dy*dy) + 0.5
if cov <= 0 {
continue
}
fb.blend(x, y, c, uint8(math.Min(cov, 1)*255))
}
}
}
// Blends src over the existing pixel, with cov as 0-255 coverage.
func (fb *framebuffer) blend(x, y int, c rgb, cov uint8) {
if x < 0 || y < 0 || x >= fb.w || y >= fb.h || cov == 0 {