More cleanups - almost completely remove gl_t * usage

This commit is contained in:
twinaphex 2015-11-02 20:02:06 +01:00
parent b34fb9e081
commit 080213f5b3
4 changed files with 41 additions and 49 deletions

View File

@ -173,7 +173,7 @@ static void glui_context_reset_textures(glui_handle_t *glui, const char *iconpat
}
}
static void glui_draw_icon(gl_t *gl, glui_handle_t *glui,
static void glui_draw_icon(glui_handle_t *glui,
GRuint texture,
float x, float y,
unsigned width, unsigned height,
@ -233,7 +233,7 @@ static void glui_blit_line(float x, float y, unsigned width, unsigned height,
video_driver_set_osd_msg(message, &params, fb_buf);
}
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
static void glui_render_quad(int x, int y, int w, int h,
unsigned width, unsigned height,
GRfloat *coord_color)
{
@ -256,14 +256,12 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
w,
h,
&coords, NULL, glui->textures.white,
MENU_DISPLAY_PRIM_TRIANGLESTRIP );
gl->coords.color = gl->white_color_ptr;
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
menu_display_blend_end();
}
static void glui_draw_scrollbar(gl_t *gl, unsigned width, unsigned height, GRfloat *coord_color)
static void glui_draw_scrollbar(unsigned width, unsigned height, GRfloat *coord_color)
{
unsigned header_height;
float content_height, total_height, scrollbar_width, scrollbar_height, y;
@ -287,7 +285,7 @@ static void glui_draw_scrollbar(gl_t *gl, unsigned width, unsigned height, GRflo
if (scrollbar_height <= header_height / 12)
scrollbar_height = header_height / 12;
glui_render_quad(gl,
glui_render_quad(
width - scrollbar_width - (header_height / 12),
header_height + y + (header_height / 12),
scrollbar_width,
@ -428,7 +426,7 @@ static void glui_render(void)
menu_entries_set_start(menu->scroll_y / glui->line_height);
}
static void glui_render_label_value(glui_handle_t *glui, gl_t *gl,
static void glui_render_label_value(glui_handle_t *glui,
int y, unsigned width, unsigned height,
uint64_t index, uint32_t color, bool selected, const char *label,
const char *value, GRfloat *pure_white)
@ -521,12 +519,12 @@ static void glui_render_label_value(glui_handle_t *glui, gl_t *gl,
glui_blit_line(width - glui->margin, y, width, height, value_str, color, TEXT_ALIGN_RIGHT);
if (texture_switch)
glui_draw_icon(gl, glui, texture_switch,
glui_draw_icon(glui, texture_switch,
width - glui->margin - glui->icon_size, y, width, height, 0, 1, &pure_white[0]);
}
static void glui_render_menu_list(glui_handle_t *glui, gl_t *gl,
static void glui_render_menu_list(glui_handle_t *glui,
unsigned width, unsigned height,
menu_handle_t *menu,
uint32_t normal_color,
@ -565,13 +563,13 @@ static void glui_render_menu_list(glui_handle_t *glui, gl_t *gl,
entry_selected = selection == i;
glui_render_label_value(glui, gl, y, width, height, *frame_count / 40,
glui_render_label_value(glui, y, width, height, *frame_count / 40,
entry_selected ? hover_color : normal_color, entry_selected,
entry.path, entry.value, pure_white);
}
}
static void glui_draw_cursor(gl_t *gl, glui_handle_t *glui,
static void glui_draw_cursor(glui_handle_t *glui,
GRfloat *color,
float x, float y, unsigned width, unsigned height)
{
@ -674,7 +672,6 @@ static void glui_frame(void)
char title_buf[PATH_MAX_LENGTH];
size_t selection;
size_t title_margin;
gl_t *gl = NULL;
glui_handle_t *glui = NULL;
const struct font_renderer *font_driver = NULL;
driver_t *driver = driver_get_ptr();
@ -695,11 +692,6 @@ static void glui_frame(void)
if (!menu || !menu->userdata)
return;
gl = (gl_t*)video_driver_get_ptr(NULL);
if (!gl)
return;
glui = (glui_handle_t*)menu->userdata;
msg[0] = '\0';
@ -723,7 +715,7 @@ static void glui_frame(void)
}
else
{
menu_display_clear_color(gl, 1.0f, 1.0f, 1.0f, 0.75f);
menu_display_clear_color(1.0f, 1.0f, 1.0f, 0.75f);
if (glui->textures.bg.id)
{
@ -776,7 +768,7 @@ static void glui_frame(void)
lightblue_bg[15] = 1.00;
}
/* highlighted entry */
glui_render_quad(gl, 0,
glui_render_quad(0,
header_height - menu->scroll_y + glui->line_height *
selection, width, glui->line_height,
width, height,
@ -784,14 +776,14 @@ static void glui_frame(void)
menu_display_font_bind_block(menu, font_driver, &glui->list_block);
glui_render_menu_list(glui, gl, width, height, menu, normal_color, hover_color, &pure_white[0]);
glui_render_menu_list(glui, width, height, menu, normal_color, hover_color, &pure_white[0]);
menu_display_font_flush_block(menu, font_driver);
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
/* header */
glui_render_quad(gl, 0, 0, width,
glui_render_quad( 0, 0, width,
header_height,
width, height,
&blue_bg[0]);
@ -805,13 +797,13 @@ static void glui_frame(void)
glui->tabs_height = scale_factor / 3;
/* tabs background */
glui_render_quad(gl, 0, height - glui->tabs_height, width,
glui_render_quad(0, height - glui->tabs_height, width,
glui->tabs_height,
width, height,
&white_bg[0]);
/* tabs separator */
glui_render_quad(gl, 0, height - glui->tabs_height, width,
glui_render_quad(0, height - glui->tabs_height, width,
1,
width, height,
&grey_bg[0]);
@ -838,7 +830,7 @@ static void glui_frame(void)
break;
}
glui_draw_icon(gl, glui, glui->textures.list[tab_icon].id,
glui_draw_icon(glui, glui->textures.list[tab_icon].id,
width / (GLUI_SYSTEM_TAB_END+1) * (i+0.5) - glui->icon_size/2,
height - glui->tabs_height,
width, height, 0, 1, &pure_white[0]);
@ -846,7 +838,7 @@ static void glui_frame(void)
/* active tab marker */
tab_width = width / (GLUI_SYSTEM_TAB_END+1);
glui_render_quad(gl, glui->categories.selection_ptr * tab_width,
glui_render_quad(glui->categories.selection_ptr * tab_width,
height - (header_height/16),
tab_width,
header_height/16,
@ -858,7 +850,7 @@ static void glui_frame(void)
glui->tabs_height = 0;
}
glui_render_quad(gl, 0, header_height, width,
glui_render_quad(0, header_height, width,
header_height/12,
width, height,
&shadow_bg[0]);
@ -868,7 +860,7 @@ static void glui_frame(void)
if (menu_entries_show_back())
{
title_margin = glui->icon_size;
glui_draw_icon(gl, glui, glui->textures.list[GLUI_TEXTURE_BACK].id,
glui_draw_icon(glui, glui->textures.list[GLUI_TEXTURE_BACK].id,
0, 0, width, height, 0, 1, &pure_white[0]);
}
@ -880,7 +872,7 @@ static void glui_frame(void)
glui_blit_line(title_margin, 0, width, height, title_buf,
title_color, TEXT_ALIGN_LEFT);
glui_draw_scrollbar(gl, width, height, &grey_bg[0]);
glui_draw_scrollbar(width, height, &grey_bg[0]);
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);
@ -892,14 +884,14 @@ static void glui_frame(void)
if (!str)
str = "";
glui_render_quad(gl, 0, 0, width, height, width, height, &black_bg[0]);
glui_render_quad(0, 0, width, height, width, height, &black_bg[0]);
snprintf(msg, sizeof(msg), "%s\n%s", label, str);
glui_render_messagebox(msg);
}
if (glui->box_message[0] != '\0')
{
glui_render_quad(gl, 0, 0, width, height, width, height, &black_bg[0]);
glui_render_quad(0, 0, width, height, width, height, &black_bg[0]);
glui_render_messagebox(glui->box_message);
glui->box_message[0] = '\0';
}
@ -909,10 +901,10 @@ static void glui_frame(void)
int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
glui_draw_cursor(gl, glui, &white_bg[0], mouse_x, mouse_y, width, height);
glui_draw_cursor(glui, &white_bg[0], mouse_x, mouse_y, width, height);
}
menu_display_restore_clear_color(gl);
menu_display_restore_clear_color();
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
}

View File

@ -344,7 +344,7 @@ static float xmb_item_y(xmb_handle_t *xmb, int i, size_t current)
return iy;
}
static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
static void xmb_draw_icon(xmb_handle_t *xmb,
GRuint texture,
float x, float y,
unsigned width, unsigned height,
@ -410,7 +410,7 @@ static void xmb_draw_icon_predone(xmb_handle_t *xmb,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
}
static void xmb_draw_boxart(gl_t *gl, xmb_handle_t *xmb, GRfloat *color, unsigned width, unsigned height)
static void xmb_draw_boxart(xmb_handle_t *xmb, GRfloat *color, unsigned width, unsigned height)
{
struct gfx_coords coords;
math_matrix_4x4 mymat;
@ -1175,7 +1175,7 @@ static GRuint xmb_icon_get_id(xmb_handle_t *xmb,
return xmb->textures.list[XMB_TEXTURE_SUBSETTING].id;
}
static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
static void xmb_draw_items(xmb_handle_t *xmb,
file_list_t *list, file_list_t *stack,
size_t current, size_t cat_selection_ptr, GRfloat *color,
unsigned width, unsigned height)
@ -1382,7 +1382,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
if (color[3] != 0)
xmb_draw_icon(gl, xmb, icon, icon_x, icon_y, width, height,
xmb_draw_icon(xmb, icon, icon_x, icon_y, width, height,
0, node->zoom, &color[0]);
/* set alpha components of color */
@ -1486,7 +1486,7 @@ static void xmb_render(void)
}
static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
menu_handle_t *menu, gl_t *gl, unsigned width, unsigned height,
menu_handle_t *menu, unsigned width, unsigned height,
GRfloat *color)
{
unsigned i;
@ -1505,7 +1505,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
color[3] = color[7] = color[11] = color[15] = (node->alpha > xmb->alpha) ? xmb->alpha : node->alpha;
if (color[3] != 0)
xmb_draw_icon(gl, xmb, node->icon,
xmb_draw_icon(xmb, node->icon,
xmb->x + xmb->categories.x_pos +
xmb->margins.screen.left +
xmb->icon.spacing.horizontal * (i + 1) - xmb->icon.size / 2.0,
@ -1603,7 +1603,7 @@ static void xmb_frame(void)
depth = xmb_list_get_size(menu, MENU_LIST_PLAIN);
xmb_draw_items(xmb, gl,
xmb_draw_items(xmb,
xmb->selection_buf_old,
xmb->menu_stack_old,
xmb->selection_ptr_old,
@ -1611,7 +1611,7 @@ static void xmb_frame(void)
xmb->categories.selection_ptr_old,
&item_color[0], width, height);
xmb_draw_items(xmb, gl,
xmb_draw_items(xmb,
selection_buf,
menu_stack,
selection,
@ -1623,7 +1623,7 @@ static void xmb_frame(void)
menu_display_blend_begin();
if (settings->menu.boxart_enable && xmb->boxart)
xmb_draw_boxart(gl, xmb, &coord_color2[0], width, height);
xmb_draw_boxart(xmb, &coord_color2[0], width, height);
/* set alpha components of colors */
coord_color2[3] = coord_color2[7] = coord_color2[11] = coord_color2[15] = (1.00f > xmb->alpha) ? xmb->alpha : 1.00f;
@ -1652,7 +1652,7 @@ static void xmb_frame(void)
0,
1, &coord_color2[0]);
xmb_frame_horizontal_list(xmb, menu, gl, width, height, &item_color[0]);
xmb_frame_horizontal_list(xmb, menu, width, height, &item_color[0]);
menu_display_font_flush_block(menu, font_driver);

View File

@ -579,6 +579,8 @@ void menu_display_draw_frame(
gl->shader->set_mvp(driver->video_data, mat);
glDrawArrays(menu_display_prim_to_gl_enum(prim_type), 0, coords->vertices);
gl->coords.color = gl->white_color_ptr;
}
void menu_display_frame_background(
@ -628,14 +630,12 @@ void menu_display_frame_background(
gl->coords.color = gl->white_color_ptr;
}
void menu_display_restore_clear_color(void *data)
void menu_display_restore_clear_color(void)
{
(void)data;
glClearColor(0.0f, 0.0f, 0.0f, 0.00f);
}
void menu_display_clear_color(void *data, float r, float g, float b, float a)
void menu_display_clear_color(float r, float g, float b, float a)
{
glClearColor(r, g, b, a);
glClear(GL_COLOR_BUFFER_BIT);

View File

@ -121,9 +121,9 @@ void menu_display_frame_background(
enum menu_display_prim_type prim_type
);
void menu_display_restore_clear_color(void *data);
void menu_display_restore_clear_color(void);
void menu_display_clear_color(void *data, float r, float g, float b, float a);
void menu_display_clear_color(float r, float g, float b, float a);
#endif