use the same allocator everywhere behind pxl8 calls

This commit is contained in:
asrael 2026-01-23 12:26:59 -06:00
parent f18652dc97
commit fe747969a5
45 changed files with 687 additions and 627 deletions

View file

@ -1,18 +1,19 @@
#include "pxl8_lightmap.h"
#include "pxl8_mem.h"
#include <stdlib.h>
#include <string.h>
pxl8_lightmap* pxl8_lightmap_create(u32 width, u32 height, u32 scale) {
pxl8_lightmap* lm = calloc(1, sizeof(pxl8_lightmap));
pxl8_lightmap* lm = pxl8_calloc(1, sizeof(pxl8_lightmap));
if (!lm) return NULL;
lm->width = width;
lm->height = height;
lm->scale = scale;
lm->data = calloc(width * height * 3, sizeof(u8));
lm->data = pxl8_calloc(width * height * 3, sizeof(u8));
if (!lm->data) {
free(lm);
pxl8_free(lm);
return NULL;
}
@ -22,8 +23,8 @@ pxl8_lightmap* pxl8_lightmap_create(u32 width, u32 height, u32 scale) {
void pxl8_lightmap_destroy(pxl8_lightmap* lm) {
if (!lm) return;
free(lm->data);
free(lm);
pxl8_free(lm->data);
pxl8_free(lm);
}
void pxl8_lightmap_clear(pxl8_lightmap* lm, u8 r, u8 g, u8 b) {