feat(font): add lv_font_glyph_release_draw_data api to release glyph data (#6052)

Co-authored-by: Benign X <1341398182@qq.com>
This commit is contained in:
liamHowatt
2024-04-10 02:43:50 -04:00
committed by GitHub
parent 51b8d8e4ea
commit ecbd2ba4cd
4 changed files with 19 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ jobs:
with:
repository: szepeviktor/astyle
path: astyle
ref: v3.4.10
- name: Install astyle
run: |
cd astyle/build/gcc/

View File

@@ -438,8 +438,7 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
dsc->g = &g;
cb(draw_unit, dsc, NULL, NULL);
if(g.resolved_font && font->release_glyph) {
font->release_glyph(font, &g);
}
lv_font_glyph_release_draw_data(&g);
LV_PROFILER_END;
}

View File

@@ -50,6 +50,15 @@ const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, uint32_t lett
return font_p->get_glyph_bitmap(g_dsc, letter, draw_buf);
}
void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t * g_dsc)
{
const lv_font_t * font = g_dsc->resolved_font;
if(font != NULL && font->release_glyph) {
font->release_glyph(font, g_dsc);
}
}
bool lv_font_get_glyph_dsc(const lv_font_t * font_p, lv_font_glyph_dsc_t * dsc_out, uint32_t letter,
uint32_t letter_next)
{

View File

@@ -133,6 +133,13 @@ const void * lv_font_get_glyph_bitmap(lv_font_glyph_dsc_t * g_dsc, uint32_t lett
bool lv_font_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t letter,
uint32_t letter_next);
/**
* Release the bitmap of a font.
* @note You must call @lv_font_get_glyph_dsc to get @g_dsc (@lv_font_glyph_dsc_t) before you can call this function.
* @param g_dsc the glyph descriptor including which font to use, which supply the glyph_index and the format.
*/
void lv_font_glyph_release_draw_data(lv_font_glyph_dsc_t * g_dsc);
/**
* Get the width of a glyph with kerning
* @param font pointer to a font