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:
+1
-3
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user