Refactor: BLF Remove blf_glyph_ensure_ex Using Default Argument

We have both a blf_glyph_ensure and blf_glyph_ensure_ex, with the former
calling the latter with subpixel equal to zero. This PR just combines
the two using a C++ default optional parameter.

Pull Request: https://projects.blender.org/blender/blender/pulls/118470
This commit is contained in:
Harley Acheson 2024-02-19 21:09:08 +01:00 committed by Harley Acheson
parent 628c026140
commit 4ed6daf490
2 changed files with 6 additions and 11 deletions

View File

@ -1277,10 +1277,7 @@ static FT_GlyphSlot blf_glyph_render(FontBLF *settings_font,
return nullptr;
}
static GlyphBLF *blf_glyph_ensure_ex(FontBLF *font,
GlyphCacheBLF *gc,
const uint charcode,
uint8_t subpixel)
GlyphBLF *blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, const uint charcode, uint8_t subpixel)
{
GlyphBLF *g = blf_glyph_cache_find_glyph(gc, charcode, subpixel);
if (g) {
@ -1306,11 +1303,6 @@ static GlyphBLF *blf_glyph_ensure_ex(FontBLF *font,
return g;
}
GlyphBLF *blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, const uint charcode)
{
return blf_glyph_ensure_ex(font, gc, charcode, 0);
}
#ifdef BLF_SUBPIXEL_AA
GlyphBLF *blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x)
{
@ -1328,7 +1320,7 @@ GlyphBLF *blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *
const uint8_t subpixel = uint8_t(pen_x & ((font->size > 16.0f) ? 32L : 48L));
if (g->subpixel != subpixel) {
g = blf_glyph_ensure_ex(font, gc, g->c, subpixel);
g = blf_glyph_ensure(font, gc, g->c, subpixel);
}
return g;
}

View File

@ -173,7 +173,10 @@ void blf_glyph_cache_clear(struct FontBLF *font);
/**
* Create (or load from cache) a fully-rendered bitmap glyph.
*/
struct GlyphBLF *blf_glyph_ensure(struct FontBLF *font, struct GlyphCacheBLF *gc, uint charcode);
struct GlyphBLF *blf_glyph_ensure(struct FontBLF *font,
struct GlyphCacheBLF *gc,
uint charcode,
uint8_t subpixel = 0);
#ifdef BLF_SUBPIXEL_AA
struct GlyphBLF *blf_glyph_ensure_subpixel(struct FontBLF *font,