Simplify menu_video_frame_background

This commit is contained in:
twinaphex 2015-09-06 17:45:16 +02:00
parent f74eeeb464
commit 699ebe2644
4 changed files with 28 additions and 34 deletions

View File

@ -135,8 +135,7 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
coords.vertex = vertex;
coords.tex_coord = tex_coord;
coords.lut_tex_coord = tex_coord;
coords.color = color;
coords.color = color;
menu_video_draw_frame(gl->shader, &coords,
&gl->mvp_no_rot, true, glui->textures.white);
@ -373,6 +372,8 @@ static void glui_render_menu_list(glui_handle_t *glui,
static void glui_frame(void)
{
unsigned i;
GRfloat coord_color[16];
unsigned width, height, ticker_limit;
char title[PATH_MAX_LENGTH];
char title_buf[PATH_MAX_LENGTH];
@ -415,8 +416,15 @@ static void glui_frame(void)
menu_display_set_viewport();
for (i = 0; i < 16; i++)
{
coord_color[i] = 0;
if (i == 3 || i == 7 || i == 11 || i == 15)
coord_color[i] = 0.75f;
}
menu_video_frame_background(menu, settings,
gl, glui->textures.bg.id, 0.75f, 0.75f, false);
gl, glui->textures.bg.id, 0.75f, false, &coord_color[0]);
menu_entries_get_title(title, sizeof(title));

View File

@ -1562,11 +1562,11 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
static void xmb_frame(void)
{
math_matrix_4x4 mymat, mrot, mscal;
unsigned depth;
unsigned width, height;
unsigned depth, i, width, height;
char msg[PATH_MAX_LENGTH];
char title_msg[PATH_MAX_LENGTH];
char timedate[PATH_MAX_LENGTH];
GRfloat coord_color[16];
bool render_background = false;
xmb_handle_t *xmb = NULL;
gl_t *gl = NULL;
@ -1600,8 +1600,15 @@ static void xmb_frame(void)
xmb->raster_block.carr.coords.vertices = 0;
for (i = 0; i < 16; i++)
{
coord_color[i] = 0;
if (i == 3 || i == 7 || i == 11 || i == 15)
coord_color[i] = (0.75f > xmb->alpha) ? xmb->alpha : 0.75f;
}
menu_video_frame_background(menu, settings,
gl, xmb->textures.bg.id, xmb->alpha, 0.75f, false);
gl, xmb->textures.bg.id, xmb->alpha, false, &coord_color[0]);
xmb_draw_text(menu, xmb,
xmb->title_name, xmb->margins.title.left,
@ -1684,7 +1691,7 @@ static void xmb_frame(void)
if (render_background)
{
menu_video_frame_background(menu, settings, gl,
xmb->textures.bg.id, xmb->alpha, 0.75f, true);
xmb->textures.bg.id, xmb->alpha, true, &coord_color[0]);
xmb_frame_messagebox(msg);
}

View File

@ -52,12 +52,11 @@ void menu_video_frame_background(
gl_t *gl,
GLuint texture,
float handle_alpha,
float alpha,
bool force_transparency)
bool force_transparency,
GRfloat *coord_color)
{
struct gfx_coords coords;
GRfloat color[16], black_color[16],
vertex[8], tex_coord[8];
GRfloat color[16], vertex[8], tex_coord[8];
global_t *global = global_get_ptr();
@ -96,31 +95,11 @@ void menu_video_frame_background(
color[14] = 1.0f;
color[15] = handle_alpha;
if (alpha > handle_alpha)
alpha = handle_alpha;
black_color[ 0] = 0.0f;
black_color[ 1] = 0.0f;
black_color[ 2] = 0.0f;
black_color[ 3] = alpha;
black_color[ 4] = 0.0f;
black_color[ 5] = 0.0f;
black_color[ 6] = 0.0f;
black_color[ 7] = alpha;
black_color[ 8] = 0.0f;
black_color[ 9] = 0.0f;
black_color[10] = 0.0f;
black_color[11] = alpha;
black_color[12] = 0.0f;
black_color[13] = 0.0f;
black_color[14] = 0.0f;
black_color[15] = alpha;
coords.vertices = 4;
coords.vertex = vertex;
coords.tex_coord = tex_coord;
coords.lut_tex_coord = tex_coord;
coords.color = black_color;
coords.color = (const float*)coord_color;
if (gl->shader && gl->shader->use)
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);

View File

@ -40,8 +40,8 @@ void menu_video_frame_background(
gl_t *gl,
GLuint texture,
float handle_alpha,
float alpha,
bool force_transparency);
bool force_transparency,
GRfloat *color);
#endif
const char *menu_video_get_ident(void);