From 8bf222c57986065807edfa259a8b17221fb76727 Mon Sep 17 00:00:00 2001 From: nat3 Date: Wed, 12 Aug 2026 11:22:46 +0200 Subject: [PATCH 1/2] widgets: always feather rounded-corner fills/borders Drop the windowNaturalScale() >= 2.0 heuristic that skipped edge fade on hi-dpi displays. It assumed pixel density alone hides aliasing, but that only holds for straight edges - on real hi-dpi hardware, rounded corners (any radius, not just small ones) still show visible aliasing without the fade. Always feather now; ninepatch draws keep fade=0 since those already have their own baked edges. --- src/WidgetData.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/WidgetData.zig b/src/WidgetData.zig index a3b00404c..6e7706760 100644 --- a/src/WidgetData.zig +++ b/src/WidgetData.zig @@ -198,7 +198,8 @@ pub fn visible(self: *const WidgetData) bool { pub fn borderAndBackground(self: *const WidgetData, opts: struct { fill_color: ?Color = null, ninepatch: ?*const Ninepatch = null, - /// If null, 0.0 if natural scale >= 2, otherwise 1.0 + /// If null, 1.0 (0.0 when drawing a ninepatch, which already has its + /// own baked edges). fade: ?f32 = null, }) void { if (!self.visible()) { @@ -233,7 +234,7 @@ pub fn borderAndBackground(self: *const WidgetData, opts: struct { var rs = self.borderRectScale(); if (!rs.r.empty()) { - const fade: f32 = opts.fade orelse (if (dvui.windowNaturalScale() >= 2.0) 0.0 else 1.0); + const fade: f32 = opts.fade orelse 1.0; if (fade > 0) { // if any border is zero, inset by half the fade so it doesn't bleed out var inset: Rect.Physical = .{}; @@ -259,7 +260,7 @@ pub fn borderAndBackground(self: *const WidgetData, opts: struct { const fill = opts.fill_color orelse self.options.color(.fill); rs.r.fill(self.options.cornersGet().scale(rs.s, CornerRect.Physical), .{ .color = fill, - .fade = opts.fade orelse (if (ninepatch != null or dvui.windowNaturalScale() >= 2.0) 0.0 else 1.0), + .fade = opts.fade orelse (if (ninepatch != null) 0.0 else 1.0), }); } } From 58e6f3f738c055bb2d83045c4f42fee19709bbb3 Mon Sep 17 00:00:00 2001 From: David Vanderson Date: Wed, 12 Aug 2026 09:55:11 -0400 Subject: [PATCH 2/2] grid: don't override fade --- src/widgets/GridWidget.zig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/widgets/GridWidget.zig b/src/widgets/GridWidget.zig index 9f032cbc4..e8a9303bb 100644 --- a/src/widgets/GridWidget.zig +++ b/src/widgets/GridWidget.zig @@ -392,10 +392,7 @@ pub const CellWidget = struct { const rs = self.data().backgroundRectScale(); if (!rs.r.empty()) { const fill = (dvui.themeGet().text_select orelse dvui.themeGet().color(.highlight, .fill)).opacity(0.75); - rs.r.fill(self.data().options.cornersGet().scale(rs.s, dvui.CornerRect.Physical), .{ - .color = fill, - .fade = if (dvui.windowNaturalScale() >= 2.0) 0.0 else 1.0, - }); + rs.r.fill(self.data().options.cornersGet().scale(rs.s, dvui.CornerRect.Physical), .{ .color = fill }); } } }