migrate allocator calls to alloc_bytes / libc_free

This commit is contained in:
swipelab
2026-06-12 09:34:13 +03:00
parent 38815c7d50
commit 1ab74c7d08
3 changed files with 19 additions and 19 deletions

View File

@@ -76,7 +76,7 @@ main :: () -> s32 {
// Per-pixel luminance, plus the checker shades read off the border ring
// (the border is pure checker — the glow never reaches the corners).
lum : [*]s64 = xx context.allocator.alloc(N * size_of(s64));
lum : [*]s64 = xx context.allocator.alloc_bytes(N * size_of(s64));
c_lo : s64 = 255;
c_hi : s64 = 0;
y = 0;
@@ -102,9 +102,9 @@ main :: () -> s32 {
// 8-connected flood fill of the edge-connected checker, seeded from every
// border pixel. `bg[i]==1` marks a removed (transparent) background pixel.
bg : [*]u8 = xx context.allocator.alloc(N);
bg : [*]u8 = xx context.allocator.alloc_bytes(N);
memset(xx bg, 0, N);
stack : [*]s64 = xx context.allocator.alloc(N * size_of(s64));
stack : [*]s64 = xx context.allocator.alloc_bytes(N * size_of(s64));
sp : s64 = 0;
checker_lim := c_hi + LUM_MARGIN;
@@ -153,7 +153,7 @@ main :: () -> s32 {
// checker shade up to pure white, giving the glow its smooth falloff.
denom := cast(f32) (255 - c_hi);
if denom < 1.0 { denom = 1.0; }
alpha : [*]f32 = xx context.allocator.alloc(N * size_of(f32));
alpha : [*]f32 = xx context.allocator.alloc_bytes(N * size_of(f32));
kept : s64 = 0;
n_bg : s64 = 0;
a : f32 = 0.0;
@@ -174,7 +174,7 @@ main :: () -> s32 {
// Area-averaged downscale to OUT_DIM. RGB stays white; only the averaged
// alpha carries the sprite, so no premultiply is needed (white*cov == white).
out_px : [*]u8 = xx context.allocator.alloc(OUT_DIM * OUT_DIM * 4);
out_px : [*]u8 = xx context.allocator.alloc_bytes(OUT_DIM * OUT_DIM * 4);
sxf := cast(f32) W / cast(f32) OUT_DIM;
syf := cast(f32) H / cast(f32) OUT_DIM;
max_a : f32 = 0.0;