Add MENU_DISPLAY_CTL_BLEND_BEGIN/MENU_DISPLAY_CTL_BLEND_END

This commit is contained in:
twinaphex 2015-12-12 23:53:16 +01:00
parent 8833ba1141
commit ecdecad963
5 changed files with 28 additions and 37 deletions

View File

@ -176,7 +176,7 @@ static void mui_draw_icon(mui_handle_t *mui,
struct gfx_coords coords; struct gfx_coords coords;
math_matrix_4x4 mymat; math_matrix_4x4 mymat;
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_matrix_4x4_rotate_z(&mymat, rotation, scale_factor, scale_factor, 1, true); menu_display_matrix_4x4_rotate_z(&mymat, rotation, scale_factor, scale_factor, 1, true);
@ -194,7 +194,7 @@ static void mui_draw_icon(mui_handle_t *mui,
&coords, &mymat, texture, &coords, &mymat, texture,
MENU_DISPLAY_PRIM_TRIANGLESTRIP); MENU_DISPLAY_PRIM_TRIANGLESTRIP);
menu_display_blend_end(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
} }
@ -266,7 +266,7 @@ static void mui_render_quad(mui_handle_t *mui,
coords.lut_tex_coord = NULL; coords.lut_tex_coord = NULL;
coords.color = coord_color; coords.color = coord_color;
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_draw( menu_display_draw(
x, x,
@ -276,7 +276,7 @@ static void mui_render_quad(mui_handle_t *mui,
&coords, NULL, mui->textures.white, &coords, NULL, mui->textures.white,
MENU_DISPLAY_PRIM_TRIANGLESTRIP); MENU_DISPLAY_PRIM_TRIANGLESTRIP);
menu_display_blend_end(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
} }
static void mui_draw_tab_begin(mui_handle_t *mui, static void mui_draw_tab_begin(mui_handle_t *mui,
@ -624,7 +624,7 @@ static void mui_draw_cursor(mui_handle_t *mui,
coords.lut_tex_coord = NULL; coords.lut_tex_coord = NULL;
coords.color = (const float*)color; coords.color = (const float*)color;
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_draw( menu_display_draw(
x - 32, x - 32,
@ -635,7 +635,7 @@ static void mui_draw_cursor(mui_handle_t *mui,
mui->textures.list[MUI_TEXTURE_POINTER].id, mui->textures.list[MUI_TEXTURE_POINTER].id,
MENU_DISPLAY_PRIM_TRIANGLESTRIP); MENU_DISPLAY_PRIM_TRIANGLESTRIP);
menu_display_blend_end(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
} }
static size_t mui_list_get_size(void *data, menu_list_type_t type) static size_t mui_list_get_size(void *data, menu_list_type_t type)

View File

@ -1480,7 +1480,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT,
width, height); width, height);
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
/* set alpha components of color */ /* set alpha components of color */
color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha; color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
@ -1503,7 +1503,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
0, 0,
1, &color[0]); 1, &color[0]);
menu_display_blend_end(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
} }
} }
@ -1519,7 +1519,7 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
coords.lut_tex_coord = NULL; coords.lut_tex_coord = NULL;
coords.color = (const float*)color; coords.color = (const float*)color;
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_draw( menu_display_draw(
x - (xmb->cursor.size/2), x - (xmb->cursor.size/2),
@ -1529,7 +1529,7 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
&coords, NULL, xmb->textures.list[XMB_TEXTURE_POINTER].id, &coords, NULL, xmb->textures.list[XMB_TEXTURE_POINTER].id,
MENU_DISPLAY_PRIM_TRIANGLESTRIP); MENU_DISPLAY_PRIM_TRIANGLESTRIP);
menu_display_blend_end(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
} }
static void xmb_render(void *data) static void xmb_render(void *data)
@ -1602,7 +1602,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
if (!node) if (!node)
continue; continue;
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
/* set alpha components of color */ /* set alpha components of color */
color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha; color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
@ -1618,7 +1618,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
node->zoom, node->zoom,
&color[0]); &color[0]);
menu_display_blend_end(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
} }
} }
@ -1710,7 +1710,7 @@ static void xmb_frame(void *data)
menu_display_matrix_4x4_rotate_z(&mymat, 0, 1, 1, 1, true); menu_display_matrix_4x4_rotate_z(&mymat, 0, 1, 1, 1, true);
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
if (settings->menu.boxart_enable && xmb->boxart) if (settings->menu.boxart_enable && xmb->boxart)
xmb_draw_boxart(xmb, &coord_color2[0], width, height); xmb_draw_boxart(xmb, &coord_color2[0], width, height);

View File

@ -1019,7 +1019,7 @@ static void zarch_frame(void *data)
else if (zui->item.active == 0) else if (zui->item.active == 0)
zui->item.active = -1; zui->item.active = -1;
menu_display_blend_begin(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_draw( menu_display_draw(
0, 0,
@ -1030,7 +1030,7 @@ static void zarch_frame(void *data)
&zui->mvp, zui->textures.white, &zui->mvp, zui->textures.white,
MENU_DISPLAY_PRIM_TRIANGLES); MENU_DISPLAY_PRIM_TRIANGLES);
menu_display_blend_end(); menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
menu_display_draw_bg( menu_display_draw_bg(
zui->width, zui->height, zui->width, zui->height,

View File

@ -234,6 +234,16 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
switch (state) switch (state)
{ {
case MENU_DISPLAY_CTL_BLEND_BEGIN:
if (!menu_disp || !menu_disp->blend_begin)
return false;
menu_disp->blend_begin();
break;
case MENU_DISPLAY_CTL_BLEND_END:
if (!menu_disp || !menu_disp->blend_end)
return false;
menu_disp->blend_end();
break;
case MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK: case MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK:
if (!disp || !disp->font.buf) if (!disp || !disp->font.buf)
return false; return false;
@ -530,23 +540,6 @@ void menu_display_msg_queue_push(const char *msg, unsigned prio, unsigned durati
} }
void menu_display_blend_begin(void)
{
menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr();
if (!menu_disp || !menu_disp->blend_begin)
return;
menu_disp->blend_begin();
}
void menu_display_blend_end(void)
{
menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr();
if (!menu_disp || !menu_disp->blend_end)
return;
menu_disp->blend_end();
}
void menu_display_matrix_4x4_rotate_z(void *data, float rotation, void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
float scale_x, float scale_y, float scale_z, bool scale_enable) float scale_x, float scale_y, float scale_z, bool scale_enable)

View File

@ -63,7 +63,9 @@ enum menu_display_ctl_state
MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK, MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK,
MENU_DISPLAY_CTL_SET_FONT_BUF, MENU_DISPLAY_CTL_SET_FONT_BUF,
MENU_DISPLAY_CTL_FONT_FB, MENU_DISPLAY_CTL_FONT_FB,
MENU_DISPLAY_CTL_SET_FONT_FB MENU_DISPLAY_CTL_SET_FONT_FB,
MENU_DISPLAY_CTL_BLEND_BEGIN,
MENU_DISPLAY_CTL_BLEND_END
}; };
enum menu_display_prim_type enum menu_display_prim_type
@ -165,10 +167,6 @@ void menu_display_draw_bg(
void menu_display_matrix_4x4_rotate_z(void *data, float rotation, void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
float scale_x, float scale_y, float scale_z, bool scale_enable); float scale_x, float scale_y, float scale_z, bool scale_enable);
void menu_display_blend_begin(void);
void menu_display_blend_end(void);
unsigned menu_display_texture_load(void *data, unsigned menu_display_texture_load(void *data,
enum texture_filter_type filter_type); enum texture_filter_type filter_type);