fix(gui): anti-aliased rounded rects from one distance field

Corners were drawn by two disagreeing algorithms: a hand-rolled per-row inset for
the gradient fill and TFT_eSPI's Bresenham arc for the border, so they missed each
other by a pixel and left a halo. The inset was also wrong, truncating the sqrt and
ignoring pixel centres, which over-cut the top row by 2px into a visible chamfer.

gui.roundRect now derives fill and border from the same signed distance, blending
edge pixels by coverage, and replaces fillRoundRect, drawRoundRect and
fillRectGradient. The geometry moved to src/gfx/round_rect.h so round_rect_test.cpp
can check the arc on the host, since only the eye ever checked the old one.
This commit is contained in:
2026-08-01 11:04:35 -04:00
parent 0a27062a70
commit 36953bb140
8 changed files with 186 additions and 48 deletions
+1 -3
View File
@@ -13,9 +13,7 @@ gui = {
clear = function() end,
fillRect = function() end,
drawText = function(label, x, y) painted[#painted + 1] = {label = label, x = x, y = y} end,
fillRoundRect = function() end,
drawRoundRect = function() end,
fillRectGradient = function() end,
roundRect = function() end,
fontHeight = function() return FONT_HEIGHT end,
textWidth = function(text) return #text * CHAR_WIDTH end,
}