BLF: blf_glyph_cache_free Made Static

blf_glyph_cache_free does not need to be public.

See D13395 for more details.

Differential Revision: https://developer.blender.org/D13395

Reviewed by Campbell Barton
This commit is contained in:
Harley Acheson 2022-02-04 17:37:23 -08:00
parent 81d2eda2bf
commit 2a967d444f
3 changed files with 15 additions and 23 deletions

View File

@ -1318,12 +1318,7 @@ FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, int m
void blf_font_free(FontBLF *font)
{
BLI_spin_lock(&blf_glyph_cache_mutex);
GlyphCacheBLF *gc;
while ((gc = BLI_pophead(&font->cache))) {
blf_glyph_cache_free(gc);
}
blf_glyph_cache_clear(font);
if (font->kerning_cache) {
MEM_freeN(font->kerning_cache);
@ -1337,8 +1332,6 @@ void blf_font_free(FontBLF *font)
MEM_freeN(font->name);
}
MEM_freeN(font);
BLI_spin_unlock(&blf_glyph_cache_mutex);
}
/** \} */

View File

@ -122,20 +122,7 @@ void blf_glyph_cache_release(FontBLF *font)
BLI_spin_unlock(font->glyph_cache_mutex);
}
void blf_glyph_cache_clear(FontBLF *font)
{
GlyphCacheBLF *gc;
BLI_spin_lock(font->glyph_cache_mutex);
while ((gc = BLI_pophead(&font->cache))) {
blf_glyph_cache_free(gc);
}
BLI_spin_unlock(font->glyph_cache_mutex);
}
void blf_glyph_cache_free(GlyphCacheBLF *gc)
static void blf_glyph_cache_free(GlyphCacheBLF *gc)
{
GlyphBLF *g;
for (uint i = 0; i < ARRAY_SIZE(gc->bucket); i++) {
@ -152,6 +139,19 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc)
MEM_freeN(gc);
}
void blf_glyph_cache_clear(FontBLF *font)
{
GlyphCacheBLF *gc;
BLI_spin_lock(font->glyph_cache_mutex);
while ((gc = BLI_pophead(&font->cache))) {
blf_glyph_cache_free(gc);
}
BLI_spin_unlock(font->glyph_cache_mutex);
}
/**
* Try to find a glyph in cache.
*

View File

@ -148,7 +148,6 @@ struct GlyphCacheBLF *blf_glyph_cache_new(struct FontBLF *font);
struct GlyphCacheBLF *blf_glyph_cache_acquire(struct FontBLF *font);
void blf_glyph_cache_release(struct FontBLF *font);
void blf_glyph_cache_clear(struct FontBLF *font);
void blf_glyph_cache_free(struct GlyphCacheBLF *gc);
/**
* Create (or load from cache) a fully-rendered bitmap glyph.