ImFontAtlas::Build() does a sanity memset on glyph rectangles.

This commit is contained in:
ocornut 2015-01-29 17:44:46 +01:00
parent 4c4bbcb451
commit 64679a0b03

View File

@ -6602,6 +6602,7 @@ bool ImFontAtlas::Build()
stbrp_rect* buf_rects = (stbrp_rect*)ImGui::MemAlloc(total_glyph_count * sizeof(stbrp_rect)); stbrp_rect* buf_rects = (stbrp_rect*)ImGui::MemAlloc(total_glyph_count * sizeof(stbrp_rect));
stbtt_pack_range* buf_ranges = (stbtt_pack_range*)ImGui::MemAlloc(total_glyph_range_count * sizeof(stbtt_pack_range)); stbtt_pack_range* buf_ranges = (stbtt_pack_range*)ImGui::MemAlloc(total_glyph_range_count * sizeof(stbtt_pack_range));
memset(buf_packedchars, 0, total_glyph_count * sizeof(stbtt_packedchar)); memset(buf_packedchars, 0, total_glyph_count * sizeof(stbtt_packedchar));
memset(buf_rects, 0, total_glyph_count * sizeof(stbrp_rect)); // Unnessary but let's clear this for the sake of sanity.
memset(buf_ranges, 0, total_glyph_range_count * sizeof(stbtt_pack_range)); memset(buf_ranges, 0, total_glyph_range_count * sizeof(stbtt_pack_range));
// First pass: pack all glyphs (no rendering at this point, we are working with glyph sizes only) // First pass: pack all glyphs (no rendering at this point, we are working with glyph sizes only)