From 16d7321484798db6f6def811223ca0f1d90ad6be Mon Sep 17 00:00:00 2001 From: Daniel Hammer Date: Sat, 18 Jul 2026 10:10:56 +0200 Subject: [PATCH] fix: fix MTK elements' border radiuses --- kernel/src/Api/BuildNo.hpp | 2 +- programs/include/gui/mtk/widgets.hpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/src/Api/BuildNo.hpp b/kernel/src/Api/BuildNo.hpp index 885d4ac..50f8da1 100644 --- a/kernel/src/Api/BuildNo.hpp +++ b/kernel/src/Api/BuildNo.hpp @@ -12,4 +12,4 @@ #pragma once -#define MONTAUK_BUILD_NUMBER 32 +#define MONTAUK_BUILD_NUMBER 33 diff --git a/programs/include/gui/mtk/widgets.hpp b/programs/include/gui/mtk/widgets.hpp index 0285367..b3effcc 100644 --- a/programs/include/gui/mtk/widgets.hpp +++ b/programs/include/gui/mtk/widgets.hpp @@ -726,6 +726,13 @@ inline void fill_round_rect_aa(Canvas& c, const Rect& box, int radius, Color col {box.x + box.w - r, box.y + box.h - r, box.x + box.w - r, box.y + box.h - r}, }; for (auto& cn : corners) { + // Push the arc center a half pixel away from this corner (toward the + // box interior). Pixel-center sampling otherwise sits half a pixel + // closer to the center than the legacy pixel-corner test did, which + // filled the arcs fuller and made small radii read as square. Left + // corners share x == box.x, top corners share y == box.y. + double cx = cn[2] + (cn[0] == box.x ? 0.5 : -0.5); + double cy = cn[3] + (cn[1] == box.y ? 0.5 : -0.5); for (int yy = 0; yy < r; yy++) { int py = cn[1] + yy; for (int xx = 0; xx < r; xx++) { @@ -733,8 +740,8 @@ inline void fill_round_rect_aa(Canvas& c, const Rect& box, int radius, Color col int hits = 0; for (int sy = 0; sy < S; sy++) for (int sx = 0; sx < S; sx++) { - double dx = (px + (sx + 0.5) / S) - cn[2]; - double dy = (py + (sy + 0.5) / S) - cn[3]; + double dx = (px + (sx + 0.5) / S) - cx; + double dy = (py + (sy + 0.5) / S) - cy; if (dx * dx + dy * dy <= r2) hits++; } if (hits) aa_blend_px(c, px, py, color, hits * 255 / (S * S));