mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 05:50:27 +00:00
renderer: turn off AA and turn on hairline
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user