renderer: turn off AA and turn on hairline

This commit is contained in:
Mitchell Hashimoto
2026-01-30 20:37:56 -08:00
parent d4f7c11a38
commit 693035eaaf
2 changed files with 22 additions and 14 deletions

View File

@@ -113,20 +113,13 @@ fn highlightHyperlinks(
alloc: Allocator,
state: *const terminal.RenderState,
) void {
// Border and fill colors (premultiplied alpha, 50% alpha for fill)
const border_color: z2d.Pixel = .{ .rgba = .{
.r = 180,
.g = 180,
.b = 255,
.a = 255,
} };
// Fill: 50% alpha (128/255), so premultiply RGB by 128/255
const fill_color: z2d.Pixel = .{ .rgba = .{
.r = 90,
.g = 90,
.b = 180,
.a = 128,
} };
const border_fill_rgb: z2d.pixel.RGB = .{ .r = 180, .g = 180, .b = 255 };
const border_color = border_fill_rgb.asPixel();
const fill_color: z2d.Pixel = px: {
var rgba: z2d.pixel.RGBA = .fromPixel(border_color);
rgba.a = 128;
break :px rgba.multiply().asPixel();
};
const row_slice = state.row_data.slice();
const row_raw = row_slice.items(.raw);
@@ -213,6 +206,11 @@ fn highlightRect(
var ctx: z2d.Context = .init(alloc, &self.surface);
defer ctx.deinit();
// Don't need AA because we use sharp edges
ctx.setAntiAliasingMode(.none);
// Can use hairline since we have 1px borders
ctx.setHairline(true);
// Draw rectangle path
try ctx.moveTo(start_x, start_y);
try ctx.lineTo(end_x, start_y);

View File

@@ -1389,6 +1389,16 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
self: *Self,
sync: bool,
) !void {
// const start = std.time.Instant.now() catch unreachable;
// const start_micro = std.time.microTimestamp();
// defer {
// const end = std.time.Instant.now() catch unreachable;
// log.warn(
// "[drawFrame time] start_micro={} duration={}ns",
// .{ start_micro, end.since(start) / std.time.ns_per_us },
// );
// }
// We hold a the draw mutex to prevent changes to any
// data we access while we're in the middle of drawing.
self.draw_mutex.lock();