(font_driver) Get rid of warnings

This commit is contained in:
twinaphex 2015-03-28 20:50:51 +01:00
parent 2f83c43917
commit 3da7197538
6 changed files with 49 additions and 23 deletions

View File

@ -1476,6 +1476,7 @@ static INLINE void gl_draw_texture(gl_t *gl)
static bool gl_frame(void *data, const void *frame,
unsigned width, unsigned height, unsigned pitch, const char *msg)
{
const struct gl_font_renderer *font_driver = NULL;
gl_t *gl = (gl_t*)data;
runloop_t *runloop = rarch_main_get_ptr();
driver_t *driver = driver_get_ptr();
@ -1484,6 +1485,8 @@ static bool gl_frame(void *data, const void *frame,
RARCH_PERFORMANCE_INIT(frame_run);
RARCH_PERFORMANCE_START(frame_run);
font_driver = (const struct gl_font_renderer*)gl->font_driver;
context_bind_hw_render(gl, false);
#ifndef HAVE_OPENGLES
@ -1609,8 +1612,8 @@ static bool gl_frame(void *data, const void *frame,
gl_draw_texture(gl);
#endif
if (msg && gl->font_driver && gl->font_handle)
gl->font_driver->render_msg(gl->font_handle, msg, NULL);
if (msg && font_driver && gl->font_handle)
font_driver->render_msg(gl->font_handle, msg, NULL);
#ifdef HAVE_OVERLAY
if (gl->overlay_enable)
@ -1723,10 +1726,13 @@ static void gl_free_overlay(gl_t *gl)
static void gl_free(void *data)
{
gl_t *gl = (gl_t*)data;
const struct gl_font_renderer *font_driver = NULL;
if (!gl)
return;
font_driver = (const struct gl_font_renderer*)gl->font_driver;
context_bind_hw_render(gl, false);
#ifdef HAVE_GL_SYNC
@ -1744,8 +1750,8 @@ static void gl_free(void *data)
}
#endif
if (gl->font_driver && gl->font_handle)
gl->font_driver->free(gl->font_handle);
if (font_driver && gl->font_handle)
font_driver->free(gl->font_handle);
gl_shader_deinit(gl);
#ifndef NO_GL_FF_VERTEX
@ -3155,14 +3161,17 @@ static void gl_apply_state_changes(void *data)
static void gl_set_osd_msg(void *data, const char *msg,
const struct font_params *params, void *font)
{
const struct gl_font_renderer *font_driver = NULL;
gl_t *gl = (gl_t*)data;
if (!gl)
return;
if (gl->font_driver && gl->font_handle)
font_driver = (const struct gl_font_renderer*)gl->font_driver;
if (font_driver && gl->font_handle)
{
context_bind_hw_render(gl, false);
gl->font_driver->render_msg(font ? font : gl->font_handle, msg, params);
font_driver->render_msg(font ? font : gl->font_handle, msg, params);
context_bind_hw_render(gl, true);
}
}

View File

@ -26,7 +26,7 @@ static const gl_font_renderer_t *gl_font_backends[] = {
NULL,
};
bool gl_font_init_first(const gl_font_renderer_t **font_driver, void **font_handle,
bool gl_font_init_first(const void **font_driver, void **font_handle,
void *video_data, const char *font_path, float font_size)
{
unsigned i;

View File

@ -45,7 +45,7 @@ typedef struct gl_font_renderer
extern gl_font_renderer_t gl_raster_font;
extern gl_font_renderer_t libdbg_font;
bool gl_font_init_first(const gl_font_renderer_t **font_driver,
bool gl_font_init_first(const void **font_driver,
void **font_handle, void *gl_data,
const char *font_path, float font_size);

View File

@ -335,7 +335,7 @@ typedef struct gl
#endif
/* Fonts */
const struct gl_font_renderer *font_driver;
const void *font_driver;
void *font_handle;
bool egl_images;

View File

@ -329,6 +329,7 @@ static void glui_frame(void)
glui_handle_t *glui = NULL;
const char *core_name = NULL;
const char *core_version = NULL;
const struct gl_font_renderer *font_driver = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
const uint32_t normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
@ -345,6 +346,8 @@ static void glui_frame(void)
if (!gl)
return;
font_driver = (const struct gl_font_renderer*)gl->font_driver;
glui = (glui_handle_t*)menu->userdata;
if (!glui)
@ -361,7 +364,7 @@ static void glui_frame(void)
if (glui->use_blocks)
{
gl->font_driver->bind_block(gl->font_handle, &glui->raster_block);
font_driver->bind_block(gl->font_handle, &glui->raster_block);
if (!menu_display_update_pending())
goto draw_text;
@ -484,8 +487,8 @@ draw_text:
if (glui->use_blocks)
{
gl->font_driver->flush(gl->font_handle);
gl->font_driver->bind_block(gl->font_handle, NULL);
font_driver->flush(gl->font_handle);
font_driver->bind_block(gl->font_handle, NULL);
}
if (settings->menu.mouse.enable)
@ -498,6 +501,7 @@ static void *glui_init(void)
{
glui_handle_t *glui = NULL;
const video_driver_t *video_driver = NULL;
const struct gl_font_renderer *font_driver = NULL;
menu_handle_t *menu = NULL;
gl_t *gl = (gl_t*)video_driver_get_ptr(&video_driver);
@ -507,7 +511,8 @@ static void *glui_init(void)
return NULL;
}
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
font_driver = (const struct gl_font_renderer*)gl->font_driver;
menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu)
goto error;
@ -520,7 +525,7 @@ static void *glui_init(void)
glui = (glui_handle_t*)menu->userdata;
glui->textures.bg.id = 0;
if (gl->font_driver->bind_block && gl->font_driver->flush)
if (font_driver->bind_block && font_driver->flush)
glui->use_blocks = true;
return menu;
@ -533,14 +538,17 @@ error:
static void glui_free(void *data)
{
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
const struct gl_font_renderer *font_driver = NULL;
menu_handle_t *menu = (menu_handle_t*)data;
glui_handle_t *glui = (glui_handle_t*)menu->userdata;
gl_coord_array_release(&glui->raster_block.carr);
font_driver = (const struct gl_font_renderer*)gl->font_driver;
if (glui->use_blocks)
gl->font_driver->bind_block(gl->font_handle, NULL);
font_driver->bind_block(gl->font_handle, NULL);
if (menu->alloc_font)
free((uint8_t*)menu->font);

View File

@ -1250,6 +1250,7 @@ static void xmb_frame(void)
const char *core_version = NULL;
xmb_handle_t *xmb = NULL;
gl_t *gl = NULL;
const struct gl_font_renderer *font_driver = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
@ -1267,8 +1268,10 @@ static void xmb_frame(void)
if (!gl)
return;
if (gl->font_driver->bind_block)
gl->font_driver->bind_block(xmb->font.buf, &xmb->raster_block);
font_driver = (const struct gl_font_renderer*)gl->font_driver;
if (font_driver->bind_block)
font_driver->bind_block(xmb->font.buf, &xmb->raster_block);
xmb->raster_block.carr.coords.vertices = 0;
@ -1386,10 +1389,10 @@ static void xmb_frame(void)
xmb_frame_messagebox(msg);
}
if (gl->font_driver->flush)
if (font_driver->flush)
{
gl->font_driver->flush(xmb->font.buf);
gl->font_driver->bind_block(xmb->font.buf, NULL);
font_driver->flush(xmb->font.buf);
font_driver->bind_block(xmb->font.buf, NULL);
}
if (settings->menu.mouse.enable)
@ -1513,8 +1516,14 @@ static void xmb_free(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
xmb_handle_t *xmb = NULL;
const struct gl_font_renderer *font_driver = NULL;
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
if (!gl)
return;
font_driver = (const struct gl_font_renderer*)gl->font_driver;
if (menu && menu->userdata)
free(menu->userdata);
@ -1522,11 +1531,11 @@ static void xmb_free(void *data)
gl_coord_array_release(&xmb->raster_block.carr);
if (gl->font_driver->bind_block)
gl->font_driver->bind_block(gl->font_handle, NULL);
if (font_driver->bind_block)
font_driver->bind_block(gl->font_handle, NULL);
}
static bool xmb_font_init_first(const gl_font_renderer_t **font_driver,
static bool xmb_font_init_first(const void **font_driver,
void **font_handle, void *video_data, const char *font_path,
float xmb_font_size)
{