fix missing free in the new rectangle packing
Before adoption: this commit came in with the history the project adopted, so no landing records it.
remove unneeded (but harmless) statements
authored by Sean Barrett · committed by Sean Barrett · parent ab6aaa8 · Browse files · 1 file·+15 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+15 added−12 removed
- other:+15 added−12 removed
Provenance
- Commit
a7ee207- Tree
54f06c4- Author
Sean Barrett <sean2@nothings.org>- Committer
Sean Barrett <sean2@nothings.org>- Parent
ab6aaa8
1 file changed+15 added−12 removed
modified:stb_truetype.h+15 added-12 removed
35 unmodified lines36 // Fabian "ryg" Giesen37 // Martins Mozeiko38 // Cap Petschulat39 // Omar Cornut40+// github:aloucks41 //42 // Misc other:43 // Ryan Gordon44 //1009 unmodified lines1054 stbtt_uint16 segcount = ttUSHORT(data+index_map+6) >> 1;1055 stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1;1056 stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10);1057 stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1;1057- stbtt_uint16 item, offset, start, end;1058 1059 // do a binary search of the segments1060 stbtt_uint32 endCount = index_map + 14;1061 stbtt_uint32 search = endCount;8 unmodified lines1070 1071 // now decrement to bias correctly to find smallest1072 search -= 2;1073 while (entrySelector) {1074+ stbtt_uint16 end;1075 searchRange >>= 1;1075- start = ttUSHORT(data + search + searchRange*2 + segcount*2 + 2);1076 end = ttUSHORT(data + search + searchRange*2);1077 if (unicode_codepoint > end)1078 search += searchRange*2;1079 --entrySelector;1080 }1081 search += 2;1082 1083+ {1084+ stbtt_uint16 offset, start;1083- item = (stbtt_uint16) ((search - endCount) >> 1);1085+ stbtt_uint16 item = (stbtt_uint16) ((search - endCount) >> 1);1086 1085- STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item));1086- start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item);1087- end = ttUSHORT(data + index_map + 14 + 2 + 2*item);1088- if (unicode_codepoint < start)1089- return 0;1087+ STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item));1088+ start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item);1089+ if (unicode_codepoint < start)1090+ return 0;1091 1091- offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item);1092- if (offset == 0)1093- return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item));1092+ offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item);1093+ if (offset == 0)1094+ return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item));1095 1095- return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item);1096+ return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item);1097+ }1098 } else if (format == 12 || format == 13) {1099 stbtt_uint32 ngroups = ttULONG(data+index_map+12);1100 stbtt_int32 low,high;1101 low = 0; high = (stbtt_int32)ngroups;1320 unmodified lines2422 ++k;2423 }2424 }2425 2426+ STBTT_free(rects, spc->user_allocator_context);2427 return return_value;2428 }2429 2430 STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, float font_size,199 unmodified lines