From 8ecfa76ab9d40b55cf096c2feb75a37f50629dd3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 24 Oct 2015 07:28:49 +0200 Subject: [PATCH] Add vertex count variable to menu_display drawing functions --- menu/drivers/glui.c | 4 ++-- menu/drivers/xmb.c | 12 ++++++------ menu/drivers/zarch.c | 2 +- menu/menu_display.c | 12 +++++++----- menu/menu_display.h | 6 ++++-- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 1e87a0713e..3e32759126 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -120,7 +120,7 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h, w, h, gl->shader, &coords, - &gl->mvp_no_rot, true, glui->textures.white); + &gl->mvp_no_rot, true, glui->textures.white, 4); gl->coords.color = gl->white_color_ptr; } @@ -450,7 +450,7 @@ static void glui_frame(void) gl, width, height, glui->textures.bg.id, 0.75f, false, &coord_color[0], &coord_color2[0], - &glui_vertexes[0], &glui_tex_coords[0]); + &glui_vertexes[0], &glui_tex_coords[0], 4); menu_entries_get_title(title, sizeof(title)); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index f0499aa511..d4f0de0c7a 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -383,7 +383,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb, height - y, xmb->icon.size, xmb->icon.size, - gl->shader, &coords, &mymat, false, texture); + gl->shader, &coords, &mymat, false, texture, 4); } static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb, @@ -417,7 +417,7 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb, height - y, xmb->icon.size, xmb->icon.size, - gl->shader, &coords, mymat, false, texture); + gl->shader, &coords, mymat, false, texture, 4); } static void xmb_draw_boxart(gl_t *gl, xmb_handle_t *xmb, GRfloat *color, unsigned width, unsigned height) @@ -448,7 +448,7 @@ static void xmb_draw_boxart(gl_t *gl, xmb_handle_t *xmb, GRfloat *color, unsigne height - y, xmb->boxart_size, xmb->boxart_size, - gl->shader, &coords, &mymat, false, xmb->boxart); + gl->shader, &coords, &mymat, false, xmb->boxart, 4); } static void xmb_draw_text(menu_handle_t *menu, @@ -1435,7 +1435,7 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, height - y, xmb->cursor.size, xmb->cursor.size, - gl->shader, &coords, &mymat, true, xmb->textures.list[XMB_TEXTURE_POINTER].id); + gl->shader, &coords, &mymat, true, xmb->textures.list[XMB_TEXTURE_POINTER].id, 4); } static void xmb_render(void) @@ -1603,7 +1603,7 @@ static void xmb_frame(void) menu_display_frame_background(menu, settings, gl, width, height, xmb->textures.bg.id, xmb->alpha, false, &coord_color[0], - &coord_color2[0], &rmb_vertex[0], &rmb_tex_coord[0]); + &coord_color2[0], &rmb_vertex[0], &rmb_tex_coord[0], 4); xmb_draw_text(menu, xmb, xmb->title_name, xmb->margins.title.left, @@ -1712,7 +1712,7 @@ static void xmb_frame(void) width, height, xmb->textures.bg.id, xmb->alpha, true, &coord_color[0], &coord_color2[0], - &rmb_vertex[0], &rmb_tex_coord[0]); + &rmb_vertex[0], &rmb_tex_coord[0], 4); xmb_frame_messagebox(msg); } diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index fbe64d6eb9..8488d11bc5 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -943,7 +943,7 @@ static void zarch_frame(void) gl, zui->width, zui->height, zui->textures.bg.id, 0.75f, false, &coord_color[0], &coord_color2[0], - &zarch_vertexes[0], &zarch_tex_coords[0]); + &zarch_vertexes[0], &zarch_tex_coords[0], 4); if (gl && gl->shader && gl->shader->use) gl->shader->use(gl, GL_SHADER_STOCK_BLEND); diff --git a/menu/menu_display.c b/menu/menu_display.c index fce124b03c..d97bd11620 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -490,7 +490,8 @@ void menu_display_draw_frame( struct gfx_coords *coords, math_matrix_4x4 *mat, bool blend, - GLuint texture + GLuint texture, + size_t vertex_count ) { const shader_backend_t *shader = (const shader_backend_t*)shader_data; @@ -505,7 +506,7 @@ void menu_display_draw_frame( if (blend) glEnable(GL_BLEND); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glDrawArrays(GL_TRIANGLE_STRIP, 0, vertex_count); if (blend) glDisable(GL_BLEND); @@ -523,13 +524,14 @@ void menu_display_frame_background( GRfloat *coord_color, GRfloat *coord_color2, const GRfloat *vertex, - const GRfloat *tex_coord) + const GRfloat *tex_coord, + size_t vertex_count) { struct gfx_coords coords; global_t *global = global_get_ptr(); - coords.vertices = 4; + coords.vertices = vertex_count; coords.vertex = vertex; coords.tex_coord = tex_coord; coords.lut_tex_coord = tex_coord; @@ -548,7 +550,7 @@ void menu_display_frame_background( menu_display_draw_frame(0, 0, width, height, gl->shader, &coords, - &gl->mvp_no_rot, true, texture); + &gl->mvp_no_rot, true, texture, vertex_count); gl->coords.color = gl->white_color_ptr; } diff --git a/menu/menu_display.h b/menu/menu_display.h index 8ad44a5ae3..8af6741ae3 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -92,7 +92,8 @@ void menu_display_draw_frame( struct gfx_coords *coords, math_matrix_4x4 *mat, bool blend, - GLuint texture + GLuint texture, + size_t vertex_count ); void menu_display_frame_background( @@ -106,7 +107,8 @@ void menu_display_frame_background( GRfloat *color, GRfloat *color2, const GRfloat *vertex, - const GRfloat *tex_coord); + const GRfloat *tex_coord, + size_t vertex_count); #endif const char *menu_video_get_ident(void);