Change signature returntype of get_glyph to const struct font_glyph *

This commit is contained in:
twinaphex 2015-04-22 23:33:43 +02:00
parent 59d4cfcfd0
commit 20b5fb056f
5 changed files with 9 additions and 11 deletions

View File

@ -138,11 +138,9 @@ static int get_message_width(gl_raster_t *font, const char *msg)
for (i = 0; i < msg_len; i++)
{
const struct font_glyph *glyph =
(const struct font_glyph*)
font->font_driver->get_glyph(font->font_data, (uint8_t)msg[i]);
if (!glyph) /* Do something smarter here ... */
glyph = (const struct font_glyph*)
font->font_driver->get_glyph(font->font_data, '?');
glyph = font->font_driver->get_glyph(font->font_data, '?');
if (!glyph)
continue;
@ -214,10 +212,10 @@ static void gl_raster_font_render_message(
{
int off_x, off_y, tex_x, tex_y, width, height;
const struct font_glyph *glyph =
(const struct font_glyph*)font->font_driver->get_glyph(font->font_data, (uint8_t)msg[i]);
font->font_driver->get_glyph(font->font_data, (uint8_t)msg[i]);
if (!glyph) /* Do something smarter here ... */
glyph = (const struct font_glyph*)font->font_driver->get_glyph(font->font_data, '?');
glyph = font->font_driver->get_glyph(font->font_data, '?');
if (!glyph)
continue;
@ -363,7 +361,7 @@ static void gl_raster_font_render_msg(void *data, const char *msg,
gl_raster_font_restore_viewport(gl);
}
static const void *gl_raster_font_get_glyph(
static const struct font_glyph *gl_raster_font_get_glyph(
void *data, uint32_t code)
{
gl_raster_t *font = (gl_raster_t*)data;

View File

@ -40,7 +40,7 @@ static const struct font_atlas *font_renderer_bmp_get_atlas(void *data)
return &handle->atlas;
}
static const void *font_renderer_bmp_get_glyph(
static const struct font_glyph *font_renderer_bmp_get_glyph(
void *data, uint32_t code)
{
bm_renderer_t *handle = (bm_renderer_t*)data;

View File

@ -45,7 +45,7 @@ static const struct font_atlas *font_renderer_ct_get_atlas(void *data)
return &handle->atlas;
}
static const void *font_renderer_ct_get_glyph(void *data, uint32_t code)
static const struct font_glyph *font_renderer_ct_get_glyph(void *data, uint32_t code)
{
ct_font_renderer_t *handle = (ct_font_renderer_t*)data;

View File

@ -45,7 +45,7 @@ static const struct font_atlas *font_renderer_ft_get_atlas(void *data)
return &handle->atlas;
}
static const void *font_renderer_ft_get_glyph(
static const struct font_glyph *font_renderer_ft_get_glyph(
void *data, uint32_t code)
{
ft_font_renderer_t *handle = (ft_font_renderer_t*)data;

View File

@ -67,7 +67,7 @@ typedef struct font_renderer
const void *params);
const char *ident;
const void *(*get_glyph)(void *data, uint32_t code);
const struct font_glyph *(*get_glyph)(void *data, uint32_t code);
void (*bind_block)(void *data, void *block);
void (*flush)(void *data);
} font_renderer_t;
@ -85,7 +85,7 @@ typedef struct font_renderer_driver
const struct font_atlas *(*get_atlas)(void *data);
/* Returns NULL if no glyph for this code is found. */
const void *(*get_glyph)(void *data, uint32_t code);
const struct font_glyph *(*get_glyph)(void *data, uint32_t code);
void (*free)(void *data);