Add MENU_DISPLAY_CTL_FONT_BIND_BLOCK

This commit is contained in:
twinaphex 2016-02-09 00:57:10 +01:00
parent 3e0d3cbd55
commit d0e9881f46
5 changed files with 13 additions and 21 deletions

View File

@ -853,7 +853,7 @@ static void mui_frame(void *data)
width, height,
&lightblue_bg[0]);
menu_display_font_bind_block(&mui->list_block);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BIND_BLOCK, &mui->list_block);
mui_render_menu_list(mui, width, height,
normal_color, hover_color, &pure_white[0]);

View File

@ -1715,7 +1715,7 @@ static void xmb_frame(void *data)
video_driver_get_size(&width, &height);
menu_display_font_bind_block(&xmb->raster_block);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BIND_BLOCK, &xmb->raster_block);
xmb->raster_block.carr.coords.vertices = 0;

View File

@ -990,7 +990,7 @@ static void zarch_frame(void *data)
zui->tmp_block.carr.coords.vertices = 0;
menu_display_font_bind_block(&zui->tmp_block);
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BIND_BLOCK, &zui->tmp_block);
zarch_zui_push_quad(zui->width, zui->height, ZUI_BG_SCREEN, &zui->ca, 0, 0, zui->width, zui->height);
zarch_zui_snow(zui, &zui->ca, zui->width, zui->height);

View File

@ -89,17 +89,6 @@ static bool menu_display_font_init_first(void **font_handle,
font_path, font_size);
}
bool menu_display_font_bind_block(void *userdata)
{
menu_display_t *disp = menu_display_get_ptr();
if (!disp)
return false;
font_driver_bind_block(disp->font.buf, userdata);
return true;
}
void menu_display_free_main_font(void)
{
menu_display_t *disp = menu_display_get_ptr();
@ -145,10 +134,9 @@ static bool menu_display_check_compatibility(
return false;
}
static bool menu_display_driver_init_first(void)
static bool menu_display_driver_init_first(menu_display_t *disp)
{
unsigned i;
menu_display_t *disp = menu_display_get_ptr();
for (i = 0; menu_display_ctx_drivers[i]; i++)
{
@ -218,13 +206,18 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
return false;
menu_disp->blend_end();
break;
case MENU_DISPLAY_CTL_FONT_BIND_BLOCK:
if (!disp)
return false;
font_driver_bind_block(disp->font.buf, data);
break;
case MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK:
if (!disp || !disp->font.buf)
return false;
font_driver_flush(disp->font.buf);
return menu_display_font_bind_block(NULL);
font_driver_bind_block(disp->font.buf, NULL);
break;
case MENU_DISPLAY_CTL_FRAMEBUF_DEINIT:
menu_display_framebuf_width = 0;
menu_display_framebuf_height = 0;
@ -469,7 +462,7 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
}
break;
case MENU_DISPLAY_CTL_INIT_FIRST_DRIVER:
return menu_display_driver_init_first();
return menu_display_driver_init_first(disp);
case MENU_DISPLAY_CTL_NONE:
default:
break;

View File

@ -68,6 +68,7 @@ enum menu_display_ctl_state
MENU_DISPLAY_CTL_SET_FONT_BUF,
MENU_DISPLAY_CTL_FONT_FB,
MENU_DISPLAY_CTL_SET_FONT_FB,
MENU_DISPLAY_CTL_FONT_BIND_BLOCK,
MENU_DISPLAY_CTL_BLEND_BEGIN,
MENU_DISPLAY_CTL_BLEND_END
};
@ -125,8 +126,6 @@ typedef struct menu_display_ctx_driver
const char *ident;
} menu_display_ctx_driver_t;
bool menu_display_font_bind_block(void *userdata);
bool menu_display_init_main_font(const char *font_path, float font_size);
void menu_display_free_main_font(void);