(XMB) Cleanups

This commit is contained in:
twinaphex 2015-09-06 23:24:51 +02:00
parent 10340174de
commit a38829dc2d

View File

@ -379,16 +379,10 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
GRuint texture, GRuint texture,
float x, float y, float x, float y,
unsigned width, unsigned height, unsigned width, unsigned height,
float alpha, float rotation, float scale_factor) float alpha, float rotation, float scale_factor,
GRfloat *color)
{ {
struct gfx_coords coords; struct gfx_coords coords;
GRfloat color[16];
if (alpha > xmb->alpha)
alpha = xmb->alpha;
if (alpha == 0)
return;
if ( if (
x < -xmb->icon.size/2 || x < -xmb->icon.size/2 ||
@ -397,23 +391,6 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb,
y > height + xmb->icon.size) y > height + xmb->icon.size)
return; return;
color[ 0] = 1.0f;
color[ 1] = 1.0f;
color[ 2] = 1.0f;
color[ 3] = alpha;
color[ 4] = 1.0f;
color[ 5] = 1.0f;
color[ 6] = 1.0f;
color[ 7] = alpha;
color[ 8] = 1.0f;
color[ 9] = 1.0f;
color[10] = 1.0f;
color[11] = alpha;
color[12] = 1.0f;
color[13] = 1.0f;
color[14] = 1.0f;
color[15] = alpha;
if (gl->shader && gl->shader->use) if (gl->shader && gl->shader->use)
gl->shader->use(gl, GL_SHADER_STOCK_BLEND); gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
@ -1374,16 +1351,17 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
xmb_draw_icon_begin(gl); xmb_draw_icon_begin(gl);
alpha = node->alpha; /* set alpha components of color */
if (alpha > xmb->alpha) color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
alpha = xmb->alpha;
color[3] = color[7] = color[11] = color[15] = alpha;
if (alpha != 0) if (color[3] != 0)
xmb_draw_icon(gl, xmb, icon, icon_x, icon_y, width, height, xmb_draw_icon(gl, xmb, icon, icon_x, icon_y, width, height,
0, node->zoom, &color[0]); 0, node->zoom, &color[0]);
if (texture_switch != 0) /* set alpha components of color */
color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
if (texture_switch != 0 && color[3] != 0)
xmb_draw_icon_predone(gl, xmb, &mymat, xmb_draw_icon_predone(gl, xmb, &mymat,
texture_switch, texture_switch,
node->x + xmb->margins.screen.left + xmb->icon.spacing.horizontal node->x + xmb->margins.screen.left + xmb->icon.spacing.horizontal
@ -1392,7 +1370,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
width, height, width, height,
node->alpha, node->alpha,
0, 0,
1); 1, &color[0]);
xmb_draw_icon_end(); xmb_draw_icon_end();
} }
@ -1487,7 +1465,6 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
for (i = 0; i <= list_size; i++) for (i = 0; i <= list_size; i++)
{ {
float alpha;
xmb_node_t *node = &xmb->settings_node; xmb_node_t *node = &xmb->settings_node;
if (i > 0) if (i > 0)
@ -1498,12 +1475,10 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
xmb_draw_icon_begin(gl); xmb_draw_icon_begin(gl);
alpha = node->alpha; /* set alpha components of color */
if (alpha > xmb->alpha) color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
alpha = xmb->alpha;
color[3] = color[7] = color[11] = color[15] = alpha;
if (alpha != 0) if (color[3] != 0)
xmb_draw_icon(gl, xmb, node->icon, xmb_draw_icon(gl, xmb, node->icon,
xmb->x + xmb->categories.x_pos + xmb->x + xmb->categories.x_pos +
xmb->margins.screen.left + xmb->margins.screen.left +
@ -1568,6 +1543,7 @@ static void xmb_frame(void)
item_color[i] = 1.0f; item_color[i] = 1.0f;
} }
/* set alpha components of colors */
coord_color[3] = coord_color[7] = coord_color[11] = coord_color[15] = (0.75f > xmb->alpha) ? xmb->alpha : 0.75f; coord_color[3] = coord_color[7] = coord_color[11] = coord_color[15] = (0.75f > xmb->alpha) ? xmb->alpha : 0.75f;
coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] = xmb->alpha; coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] = xmb->alpha;
@ -1623,24 +1599,32 @@ static void xmb_frame(void)
if (settings->menu.boxart_enable && xmb->boxart) if (settings->menu.boxart_enable && xmb->boxart)
xmb_draw_boxart(gl, xmb, &coord_color2[0], width, height); xmb_draw_boxart(gl, xmb, &coord_color2[0], width, height);
if (settings->menu.timedate_enable) /* set alpha components of colors */
xmb_draw_icon_predone(gl, xmb, &mymat, xmb->textures.list[XMB_TEXTURE_CLOCK].id, coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] = (1.00f > xmb->alpha) ? xmb->alpha : 1.00f;
width - xmb->icon.size, xmb->icon.size, width, height, 1, 0, 1);
xmb_draw_icon_predone(gl, if (settings->menu.timedate_enable && coord_color2[3] != 0)
xmb, xmb_draw_icon_predone(gl, xmb, &mymat, xmb->textures.list[XMB_TEXTURE_CLOCK].id,
&mymat, width - xmb->icon.size, xmb->icon.size, width, height, 1, 0, 1, &coord_color2[0]);
xmb->textures.list[XMB_TEXTURE_ARROW].id,
xmb->x + xmb->margins.screen.left + /* set alpha components of colors */
xmb->icon.spacing.horizontal - xmb->icon.size / 2.0 + xmb->icon.size, coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] = (xmb->textures.arrow.alpha > xmb->alpha)
xmb->margins.screen.top + ? xmb->alpha : xmb->textures.arrow.alpha;
xmb->icon.size / 2.0 + xmb->icon.spacing.vertical
* xmb->item.active.factor, if (coord_color2[3] != 0)
width, xmb_draw_icon_predone(gl,
height, xmb,
xmb->textures.arrow.alpha, &mymat,
0, xmb->textures.list[XMB_TEXTURE_ARROW].id,
1); xmb->x + xmb->margins.screen.left +
xmb->icon.spacing.horizontal - xmb->icon.size / 2.0 + xmb->icon.size,
xmb->margins.screen.top +
xmb->icon.size / 2.0 + xmb->icon.spacing.vertical
* xmb->item.active.factor,
width,
height,
xmb->textures.arrow.alpha,
0,
1, &coord_color2[0]);
xmb_frame_horizontal_list(xmb, menu, gl, width, height, &item_color[0]); xmb_frame_horizontal_list(xmb, menu, gl, width, height, &item_color[0]);