making VEFontCache less dependent on grime pkg (getting it ready to be standalone)
This commit is contained in:
parent
e6147caf41
commit
c94be49714
@ -152,7 +152,7 @@ LRU_Cache :: struct {
|
||||
LRU_init :: proc( cache : ^LRU_Cache, capacity : u32, dbg_name : string = "" ) {
|
||||
error : AllocatorError
|
||||
cache.capacity = capacity
|
||||
cache.table, error = make( map[u64]LRU_Link, hmap_closest_prime( uint(capacity)) )
|
||||
cache.table, error = make( map[u64]LRU_Link, uint(capacity) )
|
||||
assert( error == .None, "VEFontCache.LRU_init : Failed to allocate cache's table")
|
||||
|
||||
pool_list_init( & cache.key_queue, capacity, dbg_name = dbg_name )
|
||||
|
@ -177,7 +177,7 @@ startup :: proc( ctx : ^Context, parser_kind : ParserKind,
|
||||
temp_path, error = make( [dynamic]Vec2, temp_path_reserve )
|
||||
assert(error == .None, "VEFontCache.init : Failed to allocate temp_path")
|
||||
|
||||
temp_codepoint_seen, error = make( map[u64]bool, hmap_closest_prime( uint(temp_codepoint_seen_reserve)) )
|
||||
temp_codepoint_seen, error = make( map[u64]bool, uint(temp_codepoint_seen_reserve) )
|
||||
assert(error == .None, "VEFontCache.init : Failed to allocate temp_path")
|
||||
|
||||
draw_list.vertices, error = make( [dynamic]Vertex, 4 * Kilobyte )
|
||||
|
@ -12,7 +12,6 @@ import "core:math"
|
||||
ceil_f64 :: math.ceil_f64
|
||||
ceil_f64le :: math.ceil_f64le
|
||||
ceil_f64be :: math.ceil_f64be
|
||||
|
||||
import "core:math/linalg"
|
||||
import "core:mem"
|
||||
Kilobyte :: mem.Kilobyte
|
||||
@ -25,12 +24,9 @@ import "core:mem"
|
||||
arena_allocator :: mem.arena_allocator
|
||||
arena_init :: mem.arena_init
|
||||
import "codebase:grime"
|
||||
hmap_closest_prime :: grime.hmap_closest_prime
|
||||
log :: grime.log
|
||||
logf :: grime.logf
|
||||
profile :: grime.profile
|
||||
reload_array :: grime.reload_array
|
||||
reload_map :: grime.reload_map
|
||||
|
||||
//#region("Proc overload mappings")
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
package VEFontCache
|
||||
|
||||
import "base:runtime"
|
||||
|
||||
reload_array :: proc( self : ^[dynamic]$Type, allocator : Allocator ) {
|
||||
raw := transmute( ^runtime.Raw_Dynamic_Array) self
|
||||
raw.allocator = allocator
|
||||
}
|
||||
|
||||
reload_map :: proc( self : ^map [$KeyType] $EntryType, allocator : Allocator ) {
|
||||
raw := transmute( ^runtime.Raw_Map) self
|
||||
raw.allocator = allocator
|
||||
}
|
||||
|
||||
font_glyph_lru_code :: #force_inline proc "contextless" ( font : FontID, glyph_index : Glyph ) -> (lru_code : u64) {
|
||||
lru_code = u64(glyph_index) + ( ( 0x100000000 * u64(font) ) & 0xFFFFFFFF00000000 )
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user