diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/atlas.cc | 8 | ||||
| -rw-r--r-- | src/text.cc | 3 |
2 files changed, 7 insertions, 4 deletions
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 <cstring> + #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 <cstddef> +#include <cstring> #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; |
