From 8f50c7f2699bb09ec85a43776c8fb6f59e8abe1e Mon Sep 17 00:00:00 2001 From: Qwerasd Date: Sat, 5 Jul 2025 22:13:26 -0600 Subject: [PATCH] font/sprite: no more margin in atlas region We no longer need a margin in the atlas because we always sample with nearest neighbor and our glyphs are always pixel perfect, no worry about interpolation between adjacent glyphs anymore! --- src/font/sprite/canvas.zig | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/font/sprite/canvas.zig b/src/font/sprite/canvas.zig index b981449bc..a77b90a56 100644 --- a/src/font/sprite/canvas.zig +++ b/src/font/sprite/canvas.zig @@ -140,24 +140,7 @@ pub const Canvas = struct { const region_height = sfc_height -| self.clip_top -| self.clip_bottom; // Allocate our texture atlas region - const region = region: { - // Reserve a region with a 1px margin on the bottom and right edges - // so that we can avoid interpolation between adjacent glyphs during - // texture sampling. - var region = try atlas.reserve( - alloc, - region_width + 1, - region_height + 1, - ); - - // Modify the region to remove the margin so that we write to the - // non-zero location. The data in an Altlas is always initialized - // to zero (Atlas.clear) so we don't need to worry about zero-ing - // that. - region.width -= 1; - region.height -= 1; - break :region region; - }; + const region = try atlas.reserve(alloc, region_width, region_height); if (region.width > 0 and region.height > 0) { const buffer: []u8 = @ptrCast(self.sfc.image_surface_alpha8.buf);