mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
(font driver) add a .dirty flag to struct font_atlas.
This commit is contained in:
parent
c7f05f9318
commit
e3bfb617e4
@ -76,6 +76,7 @@ static void char_to_texture(bm_renderer_t *handle, uint8_t letter,
|
||||
dst[xo + yo * handle->atlas.width] = col;
|
||||
}
|
||||
}
|
||||
handle->atlas.dirty = true;
|
||||
}
|
||||
|
||||
static void *font_renderer_bmp_init(const char *font_path, float font_size)
|
||||
|
@ -38,7 +38,7 @@ typedef struct
|
||||
struct font_glyph glyphs[256];
|
||||
} stb_font_renderer_t;
|
||||
|
||||
static const struct font_atlas *font_renderer_stb_get_atlas(void *data)
|
||||
static struct font_atlas *font_renderer_stb_get_atlas(void *data)
|
||||
{
|
||||
stb_font_renderer_t *self = (stb_font_renderer_t*)data;
|
||||
return &self->atlas;
|
||||
@ -89,6 +89,8 @@ static bool font_renderer_stb_create_atlas(stb_font_renderer_t *self,
|
||||
stbtt_PackFontRange(&pc, font_data, 0, font_size, 0, 256, chardata);
|
||||
stbtt_PackEnd(&pc);
|
||||
|
||||
self->atlas.dirty = true;
|
||||
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
struct font_glyph *g = &self->glyphs[i];
|
||||
|
@ -73,6 +73,7 @@ struct font_atlas
|
||||
uint8_t *buffer; /* Alpha channel. */
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
bool dirty;
|
||||
};
|
||||
|
||||
struct font_params
|
||||
@ -112,7 +113,7 @@ typedef struct font_renderer_driver
|
||||
{
|
||||
void *(*init)(const char *font_path, float font_size);
|
||||
|
||||
const struct font_atlas *(*get_atlas)(void *data);
|
||||
struct font_atlas *(*get_atlas)(void *data);
|
||||
|
||||
/* Returns NULL if no glyph for this code is found. */
|
||||
const struct font_glyph *(*get_glyph)(void *data, uint32_t code);
|
||||
|
Loading…
x
Reference in New Issue
Block a user