vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: b45260a8aa557c12cffcd58a80a652608baee266
Parent: 576d06c1a98602b05396d74fb55f475ac36ba597
Author: Randy Palamar
Date:   Tue, 10 Sep 2024 22:13:17 -0600

remove memcpy from stb_truetype

Another stdlib function that is no longer linked.

Diffstat:
Mextern/stb_truetype.h | 37++++++++++++++-----------------------
1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/extern/stb_truetype.h b/extern/stb_truetype.h @@ -306,18 +306,8 @@ #define STBTT_acos(x) acos(x) #endif - #ifndef STBTT_fabs - #include <math.h> - #define STBTT_fabs(x) fabs(x) - #endif - + #define STBTT_fabs(x) ABS(x) #define STBTT_assert(x) ASSERT(x) - - #ifndef STBTT_memcpy - #include <string.h> - #define STBTT_memcpy memcpy - #define STBTT_memset mem_clear - #endif #endif /////////////////////////////////////////////////////////////////////////////// @@ -1658,8 +1648,11 @@ static int stbtt__GetGlyphShapeTT(Arena *a, const stbtt_fontinfo *info, int glyp } // Append vertices. tmp = alloc(a, stbtt_vertex, num_vertices + comp_num_verts); - if (num_vertices > 0 && vertices) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); - STBTT_memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex)); + if (num_vertices > 0 && vertices) + mem_copy((s8){.len = num_vertices * sizeof(stbtt_vertex), .data = (u8 *)vertices}, + (s8){.len = (num_vertices + comp_num_verts) * sizeof(stbtt_vertex), .data = (u8 *)tmp}); + mem_copy((s8){.len = comp_num_verts * sizeof(stbtt_vertex), .data = (u8 *)comp_verts}, + (s8){.len = comp_num_verts * sizeof(stbtt_vertex), .data = (u8 *)(tmp + num_vertices)}); vertices = tmp; num_vertices += comp_num_verts; } @@ -2870,8 +2863,8 @@ static void stbtt__rasterize_sorted_edges(Arena *a, stbtt__bitmap *result, stbtt float scan_y_bottom = y + 1.0f; stbtt__active_edge **step = &active; - STBTT_memset(scanline , 0, result->w*sizeof(scanline[0])); - STBTT_memset(scanline2, 0, (result->w+1)*sizeof(scanline[0])); + mem_clear(scanline , 0, result->w*sizeof(scanline[0])); + mem_clear(scanline2, 0, (result->w+1)*sizeof(scanline[0])); // update all active edges; // remove all active edges that terminate before the top of this scanline @@ -3267,7 +3260,7 @@ STBTT_DEF int stbtt_BakeFontBitmap(Arena a, unsigned char *data, int offset, // stbtt_fontinfo f; if (!stbtt_InitFont(&f, data, offset)) return -1; - STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels + mem_clear(pixels, 0, pw*ph); // background of 0 around pixels x=y=1; bottom_y = 1; @@ -3420,7 +3413,7 @@ STBTT_DEF int stbtt_PackBegin(Arena *a, stbtt_pack_context *spc, unsigned char * stbrp_init_target(context, pw-padding, ph-padding, nodes, num_nodes); if (pixels) - STBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels + mem_clear(pixels, 0, pw*ph); // background of 0 around pixels return 1; } @@ -3448,14 +3441,13 @@ STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int s static void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width) { - unsigned char buffer[STBTT_MAX_OVERSAMPLE]; + unsigned char buffer[STBTT_MAX_OVERSAMPLE] = {0}; int safe_w = w - kernel_width; int j; - STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze for (j=0; j < h; ++j) { int i; unsigned int total; - STBTT_memset(buffer, 0, kernel_width); + mem_clear(buffer, 0, kernel_width); total = 0; @@ -3510,14 +3502,13 @@ static void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_i static void stbtt__v_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width) { - unsigned char buffer[STBTT_MAX_OVERSAMPLE]; + unsigned char buffer[STBTT_MAX_OVERSAMPLE] = {0}; int safe_h = h - kernel_width; int j; - STBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze for (j=0; j < w; ++j) { int i; unsigned int total; - STBTT_memset(buffer, 0, kernel_width); + mem_clear(buffer, 0, kernel_width); total = 0;