1
0
mirror of https://github.com/libretro/RetroArch synced 2025-01-30 21:32:45 +00:00

(XMB) Refactor ribbon

This commit is contained in:
twinaphex 2016-04-18 01:52:16 +02:00
parent 3264426a96
commit 38cc90d0e0
2 changed files with 25 additions and 7 deletions

@ -62,6 +62,7 @@ typedef struct gfx_coords
const float *lut_tex_coord;
unsigned vertices;
const unsigned *index;
unsigned indexes;
} gfx_coords_t;
typedef struct gfx_mut_coords
@ -71,6 +72,8 @@ typedef struct gfx_mut_coords
float *tex_coord;
float *lut_tex_coord;
unsigned vertices;
unsigned *index;
unsigned indexes;
} gfx_mut_coords_t;
typedef struct gfx_coord_array

@ -238,7 +238,6 @@ typedef struct xmb_handle
} xmb_handle_t;
#ifdef XMB_RIBBON_ENABLE
static float ribbon_verts[XMB_RIBBON_VERTICES];
static unsigned ribbon_idx[XMB_RIBBON_INDEXES];
#endif
@ -1905,7 +1904,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
}
}
static void xmb_draw_ribbon(menu_display_ctx_draw_t *draw)
static void xmb_draw_ribbon(xmb_handle_t *xmb, menu_display_ctx_draw_t *draw)
{
#ifdef XMB_RIBBON_ENABLE
struct uniform_info uniform_param = {0};
@ -1929,7 +1928,7 @@ static void xmb_draw_ribbon(menu_display_ctx_draw_t *draw)
xmb_blend_begin();
coords.vertex = ribbon_verts;
coords.vertex = xmb->ribbon_coords.coords.vertex;
coords.index = ribbon_idx;
coords.color = white;
@ -1970,12 +1969,12 @@ static void xmb_draw_ribbon(menu_display_ctx_draw_t *draw)
#endif
}
static void xmb_draw_bg(menu_display_ctx_draw_t *draw)
static void xmb_draw_bg(xmb_handle_t *xmb, menu_display_ctx_draw_t *draw)
{
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_BEGIN, NULL);
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
xmb_draw_ribbon(draw);
xmb_draw_ribbon(xmb, draw);
menu_display_ctl(MENU_DISPLAY_CTL_BLEND_END, NULL);
}
@ -2050,7 +2049,7 @@ static void xmb_frame(void *data)
&& !draw.force_transparency && draw.texture)
draw.color = &coord_color2[0];
xmb_draw_bg(&draw);
xmb_draw_bg(xmb, &draw);
xmb_draw_text(xmb,
xmb->title_name, xmb->margins.title.left,
@ -2189,7 +2188,7 @@ static void xmb_frame(void *data)
&& !draw.force_transparency && draw.texture)
draw.color = &coord_color2[0];
xmb_draw_bg(&draw);
xmb_draw_bg(xmb, &draw);
xmb_render_messagebox_internal(xmb, msg);
}
@ -2342,6 +2341,8 @@ static void xmb_layout(xmb_handle_t *xmb)
static void xmb_init_ribbon(xmb_handle_t * xmb)
{
#ifdef XMB_RIBBON_ENABLE
float ribbon_verts[XMB_RIBBON_VERTICES];
unsigned r, c;
unsigned i = 0;
@ -2359,6 +2360,20 @@ static void xmb_init_ribbon(xmb_handle_t * xmb)
}
}
gfx_coords_t coords;
menu_display_ctx_coord_draw_t coord_draw;
float white[XMB_RIBBON_VERTICES*4] = { 1.0f };
menu_display_ctl(MENU_DISPLAY_CTL_TEX_COORDS_GET, &coord_draw);
coords.color = white;
coords.vertex = ribbon_verts;
coords.tex_coord = coord_draw.ptr;
coords.lut_tex_coord = coord_draw.ptr;
coords.vertices = XMB_RIBBON_VERTICES;
gfx_coord_array_append(&xmb->ribbon_coords, &coords, XMB_RIBBON_VERTICES);
for (r = 0; r < XMB_RIBBON_ROWS - 1; ++r)
{
ribbon_idx[i++] = r * XMB_RIBBON_COLS;