From 89080d1cf616adf41d717df70e862d820560f903 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Thu, 12 Feb 2026 22:07:37 +0100 Subject: memsetting --- src/atlas.cc | 8 +++++--- src/text.cc | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/atlas.cc b/src/atlas.cc index 4b756eb..2494cd0 100644 --- a/src/atlas.cc +++ b/src/atlas.cc @@ -1,5 +1,7 @@ #include "atlas.h" +#include + #include "mimalloc.h" #include "utils.h" @@ -33,12 +35,12 @@ static inline usize wayc_atlas_size(struct atlas_s* atlas) { enum atlas_error_e wayc_atlas_init(struct atlas_s* atlas, u32 width, u32 height, enum sg_pixel_format format) { wayc_notnull(atlas); - + memset(atlas, 0, sizeof(*atlas)); bool success = false; - usize atlas_size = wayc_atlas_size(atlas); + usize atlas_size = width * height; u8* cpu_atlas = (u8*)mi_malloc(atlas_size); - wayc_defer_cond(mi_free(cpu_atlas);, success, true); + wayc_defer_cond(mi_free(cpu_atlas), success, true); struct sg_image_desc desc = {}; wayc_atlas_gpu_desc(&desc, width, height, format); diff --git a/src/text.cc b/src/text.cc index ab2155f..0cd81d6 100644 --- a/src/text.cc +++ b/src/text.cc @@ -1,6 +1,7 @@ #include "text.h" #include +#include #include "atlas.h" #include "freetype/freetype.h" @@ -63,7 +64,7 @@ static void font_context_pipeline_desc(struct sg_pipeline_desc* desc, enum font_context_error_e wayc_font_context_init( struct font_context_s* context) { wayc_notnull(context); - + memset(context, 0, sizeof(*context)); bool success = false; FT_Library ft; -- cgit v1.2.3