Use intrusive list to track LRU order

This commit is contained in:
grovesNL 2022-05-17 10:51:21 -02:30 committed by Josh Groves
parent 81671d02b8
commit e64b4ab63b
2 changed files with 179 additions and 47 deletions

View file

@ -112,7 +112,7 @@ fn try_allocate(atlas: &mut InnerAtlas, width: usize, height: usize) -> Option<A
}
// Try to free least recently used allocation
let (key, value) = atlas.glyph_cache.entries_least_recently_used().next()?;
let (key, value) = atlas.glyph_cache.pop()?;
atlas
.packer
.deallocate(value.atlas_id.expect("cache corrupt"));