Bugfixing the runtime (rendering not working yet)

This commit is contained in:
2024-06-11 22:20:19 -04:00
parent 82e7482c85
commit 5bd6519b6a
11 changed files with 31 additions and 16 deletions

View File

@ -31,7 +31,7 @@ pool_list_init :: proc( pool : ^PoolList, capacity : u32 )
pool.free_list, error = make( Array( PoolListIter ), u64(capacity) )
assert( error == .None, "VEFontCache.pool_list_init : Failed to allocate free_list array")
array_resize( & pool.items, u64(capacity) )
array_resize( & pool.free_list, u64(capacity) )
pool.capacity = capacity
@ -172,10 +172,14 @@ LRU_put :: proc( cache : ^LRU_Cache, key : u64, value : i32 ) -> u64 {
}
pool_list_push_front( & cache.key_queue, key )
hmap_chained_set( cache.table, key, LRU_Link {
bytes := transmute( [8]byte ) key
hash_key := fnv64a( bytes[:] )
hmap_chained_set( cache.table, hash_key, LRU_Link {
value = value,
ptr = cache.key_queue.front
})
cache.num += 1
return evict
}

View File

@ -112,7 +112,7 @@ can_batch_glyph :: proc( ctx : ^Context, font : FontID, entry : ^Entry, glyph_in
cache_glyph_to_atlas( ctx, font, glyph_index )
}
assert( LRU_get( & region.state, lru_code ) != 1 )
assert( LRU_get( & region.state, lru_code ) != -1 )
set( ctx.temp_codepoint_seen, lru_code, true )
ctx.temp_codepoint_seen_num += 1
return true

View File

@ -270,7 +270,7 @@ draw_filled_path :: proc( draw_list : ^DrawList, outside_point : Vec2, path : []
draw_text :: proc( ctx : ^Context, font : FontID, text_utf8 : string, position : Vec2, scale : Vec2 ) -> b32
{
assert( ctx != nil )
assert( font > 0 && font < FontID(ctx.entries.num) )
assert( font >= 0 && font < FontID(ctx.entries.num) )
shaped := shape_text_cached( ctx, font, text_utf8 )

View File

@ -117,9 +117,11 @@ parser_find_glyph_index :: proc( font : ^ParserFontInfo, codepoint : rune ) -> (
{
case .Freetype:
glyph_index = transmute(Glyph) freetype.get_char_index( font.freetype_info, transmute(u32) codepoint )
return
case .STB_TrueType:
glyph_index = transmute(Glyph) stbtt.FindGlyphIndex( & font.stbtt_info, codepoint )
return
}
return Glyph(-1)
}