This commit is contained in:
Alessandro Mauri 2023-03-19 16:42:41 +01:00
parent 5455449bf9
commit 7875a55c10
No known key found for this signature in database
GPG key ID: 2B7BF9531FF03BE8
6 changed files with 32 additions and 92 deletions

View file

@ -151,7 +151,7 @@ const struct font_glyph * font_get_glyph_texture(struct font_atlas *atlas, unsig
// TODO: bounds check usign atlas height
// TODO: clear spot area in the atlas before writing on it
unsigned int spot = cache_get(&PRIV(atlas)->c);
unsigned int spot = cache_get_free_spot(&PRIV(atlas)->c);
unsigned int ty = ((atlas->glyph_max_w * spot) / atlas->width) * atlas->glyph_max_h;
unsigned int tx = (atlas->glyph_max_w * spot) % atlas->width;
unsigned int w = atlas->width;
@ -179,7 +179,7 @@ const struct font_glyph * font_get_glyph_texture(struct font_atlas *atlas, unsig
.y = off_y-base,
.a = adv,
};
return cache_insert(&PRIV(atlas)->c, &g, g.codepoint, spot);
return cache_insert_at(&PRIV(atlas)->c, &g, g.codepoint, spot);
}