mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Create menu_display_draw_icon_blend_begin and menu_display_draw_icon_blend_end - cut down on code duplication
This commit is contained in:
parent
40a4a7a354
commit
19a6ccb646
@ -183,11 +183,7 @@ static void glui_draw_icon(gl_t *gl, glui_handle_t *glui,
|
||||
struct gfx_coords coords;
|
||||
math_matrix_4x4 mymat, mrot, mscal;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (gl->shader && gl->shader->use)
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
menu_display_draw_icon_blend_begin(gl);
|
||||
|
||||
matrix_4x4_rotate_z(&mrot, rotation);
|
||||
matrix_4x4_multiply(&mymat, &mrot, &gl->mvp_no_rot);
|
||||
@ -209,7 +205,7 @@ static void glui_draw_icon(gl_t *gl, glui_handle_t *glui,
|
||||
gl->shader, &coords, &mymat, false, texture, 4,
|
||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
menu_display_draw_icon_blend_end(gl);
|
||||
}
|
||||
|
||||
static void glui_blit_line(float x, float y, unsigned width, unsigned height,
|
||||
|
@ -344,20 +344,6 @@ static float xmb_item_y(xmb_handle_t *xmb, int i, size_t current)
|
||||
return iy;
|
||||
}
|
||||
|
||||
static void xmb_draw_icon_begin(gl_t *gl)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (gl->shader && gl->shader->use)
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
}
|
||||
|
||||
static void xmb_draw_icon_end(void)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
|
||||
GRuint texture,
|
||||
float x, float y,
|
||||
@ -1414,7 +1400,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
TEXT_ALIGN_LEFT,
|
||||
width, height);
|
||||
|
||||
xmb_draw_icon_begin(gl);
|
||||
menu_display_draw_icon_blend_begin(gl);
|
||||
|
||||
/* set alpha components of color */
|
||||
color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
|
||||
@ -1437,7 +1423,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||
0,
|
||||
1, &color[0]);
|
||||
|
||||
xmb_draw_icon_end();
|
||||
menu_display_draw_icon_blend_end(gl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1457,7 +1443,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb,
|
||||
coords.lut_tex_coord = rmb_tex_coord;
|
||||
coords.color = (const float*)color;
|
||||
|
||||
xmb_draw_icon_begin(gl);
|
||||
menu_display_draw_icon_blend_begin(gl);
|
||||
|
||||
menu_display_draw_frame(
|
||||
x - (xmb->cursor.size/2),
|
||||
@ -1539,7 +1525,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
|
||||
if (!node)
|
||||
continue;
|
||||
|
||||
xmb_draw_icon_begin(gl);
|
||||
menu_display_draw_icon_blend_begin(gl);
|
||||
|
||||
/* set alpha components of color */
|
||||
color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
|
||||
@ -1555,7 +1541,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
|
||||
node->zoom,
|
||||
&color[0]);
|
||||
|
||||
xmb_draw_icon_end();
|
||||
menu_display_draw_icon_blend_end(gl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1664,7 +1650,7 @@ static void xmb_frame(void)
|
||||
matrix_4x4_scale(&mscal, 1 /* scale_factor */, 1 /* scale_factor */, 1);
|
||||
matrix_4x4_multiply(&mymat, &mscal, &mymat);
|
||||
|
||||
xmb_draw_icon_begin(gl);
|
||||
menu_display_draw_icon_blend_begin(gl);
|
||||
|
||||
if (settings->menu.boxart_enable && xmb->boxart)
|
||||
xmb_draw_boxart(gl, xmb, &coord_color2[0], width, height);
|
||||
|
@ -503,6 +503,27 @@ static GLenum menu_display_prim_to_gl_enum(enum menu_display_prim_type prim_type
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_display_draw_icon_blend_begin(void *data)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (gl->shader && gl->shader->use)
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
}
|
||||
|
||||
void menu_display_draw_icon_blend_end(void *data)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void menu_display_draw_frame(
|
||||
unsigned x, unsigned y,
|
||||
unsigned width, unsigned height,
|
||||
|
@ -105,6 +105,10 @@ void menu_display_draw_frame(
|
||||
enum menu_display_prim_type prim_type
|
||||
);
|
||||
|
||||
void menu_display_draw_icon_blend_begin(void *data);
|
||||
|
||||
void menu_display_draw_icon_blend_end(void *data);
|
||||
|
||||
void menu_display_frame_background(
|
||||
menu_handle_t *menu,
|
||||
settings_t *settings,
|
||||
|
Loading…
x
Reference in New Issue
Block a user