Documentation
¶
Overview ¶
Command shadowprobe compares the software painter's canvas.BoxShadow with the GPU painter's, on the same canvas (#876). It shows opaque black shadows at three blur radii, with a corner radius and an offset, over white, then paints that one window canvas twice: through the window's GPU painter (Canvas.Capture), and through software.NewPainter. Every pixel inside the shadows' painted extents is compared.
go run ./hack/shadowprobe # the default (WebGPU) painter go run -tags gl ./hack/shadowprobe BELLUI_SCALE=2 go run ./hack/shadowprobe
PASS: no channel differs by more than 10/255. Most of the difference is the GPU's: its blur approximates the Gaussian with a 9-tap kernel and halvings that internal/painter.PlanBlur documents as up to about a tenth of sigma off, while the software painter computes it exactly. The limit was 8, from that bound on a straight edge. At scale 2, 20 corner pixels of the blur-12 shadow differed by 9. There, a fine-grid integral of the Gaussian over the rounded rect gave grey 58.6: the software painter drew 58 and the GPU 67. So 10 is the GPU's own error at a corner. FAIL: anything more. Before #876 the software painter drew no shadow at all, so the difference was the whole shadow, 255 at its middle.