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!
pull/7822/head
Qwerasd 2025-07-05 22:13:26 -06:00
parent 87f35bd1c1
commit 8f50c7f269
1 changed files with 1 additions and 18 deletions

View File

@ -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);