really fixed memory issue

This commit is contained in:
Ron Aaron 2020-03-06 12:06:58 +02:00
parent 1cc9fa9619
commit 3d84f6c42c

View File

@ -138,7 +138,7 @@ nk_font_baker_memory(nk_size *temp, int *glyph_count,
} while ((i = i->n) != iter);
}
*temp = (nk_size)*glyph_count * sizeof(struct stbrp_rect);
*temp += (nk_size)*glyph_count * sizeof(stbtt_pack_range);
*temp += (nk_size)total_range_count * sizeof(stbtt_pack_range);
*temp += (nk_size)*glyph_count * sizeof(stbtt_packedchar);
*temp += (nk_size)count * sizeof(struct nk_font_bake_data);
*temp += sizeof(struct nk_font_baker);
@ -1179,6 +1179,7 @@ nk_font_atlas_bake(struct nk_font_atlas *atlas, int *width, int *height,
tmp = atlas->temporary.alloc(atlas->temporary.userdata,0, tmp_size);
NK_ASSERT(tmp);
if (!tmp) goto failed;
memset(tmp,0,tmp_size);
/* allocate glyph memory for all fonts */
baker = nk_font_baker(tmp, atlas->glyph_count, atlas->font_num, &atlas->temporary);