mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Cut down on code duplication - draw_bg callback no longer necessary
This commit is contained in:
parent
0e984f6c95
commit
31c6bba86a
@ -165,42 +165,6 @@ static void menu_display_d3d_draw(void *data)
|
||||
0, draw->coords->vertices);
|
||||
}
|
||||
|
||||
static void menu_display_d3d_draw_bg(void *data)
|
||||
{
|
||||
struct gfx_coords coords;
|
||||
const float *new_vertex = NULL;
|
||||
const float *new_tex_coord = NULL;
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
|
||||
if (!draw)
|
||||
return;
|
||||
|
||||
new_vertex = draw->vertex;
|
||||
new_tex_coord = draw->tex_coord;
|
||||
|
||||
if (!new_vertex)
|
||||
new_vertex = menu_display_d3d_get_default_vertices();
|
||||
if (!new_tex_coord)
|
||||
new_tex_coord = menu_display_d3d_get_default_tex_coords()
|
||||
|
||||
coords.vertices = draw->vertex_count;
|
||||
coords.vertex = new_vertex;
|
||||
coords.tex_coord = new_tex_coord;
|
||||
coords.lut_tex_coord = new_tex_coord;
|
||||
coords.color = (const float*)draw->color;
|
||||
|
||||
if (!draw->texture)
|
||||
draw->texture = menu_display_white_texture;
|
||||
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
draw->coords = &coords;
|
||||
draw->matrix_data = (math_matrix_4x4*)
|
||||
menu_display_d3d_get_default_mvp();
|
||||
|
||||
menu_display_d3d_draw(draw);
|
||||
}
|
||||
|
||||
static void menu_display_d3d_restore_clear_color(void)
|
||||
{
|
||||
d3d_video_t *d3d = d3d_get_ptr();
|
||||
@ -239,7 +203,6 @@ static bool menu_display_d3d_font_init_first(
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_d3d = {
|
||||
menu_display_d3d_draw,
|
||||
menu_display_d3d_draw_bg,
|
||||
menu_display_d3d_blend_begin,
|
||||
menu_display_d3d_blend_end,
|
||||
menu_display_d3d_restore_clear_color,
|
||||
|
@ -146,43 +146,6 @@ static void menu_display_gl_draw(void *data)
|
||||
gl->coords.color = gl->white_color_ptr;
|
||||
}
|
||||
|
||||
static void menu_display_gl_draw_bg(void *data)
|
||||
{
|
||||
struct gfx_coords coords;
|
||||
const float *new_vertex = NULL;
|
||||
const float *new_tex_coord = NULL;
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
|
||||
if (!draw)
|
||||
return;
|
||||
|
||||
new_vertex = draw->vertex;
|
||||
new_tex_coord = draw->tex_coord;
|
||||
|
||||
if (!new_vertex)
|
||||
new_vertex = menu_display_gl_get_default_vertices();
|
||||
if (!new_tex_coord)
|
||||
new_tex_coord = menu_display_gl_get_default_tex_coords();
|
||||
|
||||
coords.vertices = draw->vertex_count;
|
||||
coords.vertex = new_vertex;
|
||||
coords.tex_coord = new_tex_coord;
|
||||
coords.lut_tex_coord = new_tex_coord;
|
||||
coords.color = (const float*)draw->color;
|
||||
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
draw->coords = &coords;
|
||||
|
||||
if (!draw->texture)
|
||||
draw->texture = menu_display_white_texture;
|
||||
|
||||
draw->matrix_data = (math_matrix_4x4*)
|
||||
menu_display_gl_get_default_mvp();
|
||||
|
||||
menu_display_gl_draw(draw);
|
||||
}
|
||||
|
||||
static void menu_display_gl_restore_clear_color(void)
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.00f);
|
||||
@ -210,7 +173,6 @@ static bool menu_display_gl_font_init_first(
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_gl = {
|
||||
menu_display_gl_draw,
|
||||
menu_display_gl_draw_bg,
|
||||
menu_display_gl_blend_begin,
|
||||
menu_display_gl_blend_end,
|
||||
menu_display_gl_restore_clear_color,
|
||||
|
@ -42,11 +42,6 @@ static void menu_display_null_draw(void *data)
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void menu_display_null_draw_bg(void *data)
|
||||
{
|
||||
(void)data;
|
||||
}
|
||||
|
||||
static void menu_display_null_restore_clear_color(void)
|
||||
{
|
||||
}
|
||||
@ -77,7 +72,6 @@ static const float *menu_display_null_get_default_tex_coords(void)
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_null = {
|
||||
menu_display_null_draw,
|
||||
menu_display_null_draw_bg,
|
||||
menu_display_null_blend_begin,
|
||||
menu_display_null_blend_end,
|
||||
menu_display_null_restore_clear_color,
|
||||
|
@ -145,38 +145,6 @@ static const float *menu_display_vk_get_default_tex_coords(void)
|
||||
return &vk_tex_coords[0];
|
||||
}
|
||||
|
||||
static void menu_display_vk_draw_bg(void *data)
|
||||
{
|
||||
struct gfx_coords coords;
|
||||
const float *new_vertex = NULL;
|
||||
const float *new_tex_coord = NULL;
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
|
||||
if (!draw)
|
||||
return;
|
||||
|
||||
if (!new_vertex)
|
||||
new_vertex = menu_display_vk_get_default_vertices();
|
||||
if (!new_tex_coord)
|
||||
new_tex_coord = menu_display_vk_get_default_tex_coords();
|
||||
|
||||
coords.vertices = draw->vertex_count;
|
||||
coords.vertex = new_vertex;
|
||||
coords.tex_coord = new_tex_coord;
|
||||
coords.color = (const float*)draw->color;
|
||||
|
||||
if (!draw->texture)
|
||||
draw->texture = menu_display_white_texture;
|
||||
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
draw->coords = &coords;
|
||||
draw->matrix_data = (math_matrix_4x4*)
|
||||
menu_display_vk_get_default_mvp();
|
||||
|
||||
menu_display_vk_draw(draw);
|
||||
}
|
||||
|
||||
static void menu_display_vk_restore_clear_color(void)
|
||||
{
|
||||
}
|
||||
@ -227,7 +195,6 @@ static bool menu_display_vk_font_init_first(
|
||||
|
||||
menu_display_ctx_driver_t menu_display_ctx_vulkan = {
|
||||
menu_display_vk_draw,
|
||||
menu_display_vk_draw_bg,
|
||||
menu_display_vk_blend_begin,
|
||||
menu_display_vk_blend_end,
|
||||
menu_display_vk_restore_clear_color,
|
||||
|
@ -463,10 +463,39 @@ bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||
menu_disp->draw(data);
|
||||
break;
|
||||
case MENU_DISPLAY_CTL_DRAW_BG:
|
||||
if (!menu_disp || !menu_disp->draw_bg)
|
||||
return false;
|
||||
{
|
||||
struct gfx_coords coords;
|
||||
const float *new_vertex = NULL;
|
||||
const float *new_tex_coord = NULL;
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
if (!menu_disp || !draw)
|
||||
return false;
|
||||
|
||||
menu_disp->draw_bg(data);
|
||||
new_vertex = draw->vertex;
|
||||
new_tex_coord = draw->tex_coord;
|
||||
|
||||
if (!new_vertex)
|
||||
new_vertex = menu_disp->get_default_vertices();
|
||||
if (!new_tex_coord)
|
||||
new_tex_coord = menu_disp->get_default_tex_coords();
|
||||
|
||||
coords.vertices = draw->vertex_count;
|
||||
coords.vertex = new_vertex;
|
||||
coords.tex_coord = new_tex_coord;
|
||||
coords.lut_tex_coord = new_tex_coord;
|
||||
coords.color = (const float*)draw->color;
|
||||
|
||||
draw->x = 0;
|
||||
draw->y = 0;
|
||||
draw->coords = &coords;
|
||||
|
||||
if (!draw->texture)
|
||||
draw->texture = menu_display_white_texture;
|
||||
|
||||
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
|
||||
|
||||
menu_disp->draw(draw);
|
||||
}
|
||||
break;
|
||||
case MENU_DISPLAY_CTL_ROTATE_Z:
|
||||
{
|
||||
|
@ -146,7 +146,6 @@ typedef struct menu_display_ctx_datetime
|
||||
typedef struct menu_display_ctx_driver
|
||||
{
|
||||
void (*draw)(void *data);
|
||||
void (*draw_bg)(void *data);
|
||||
void (*blend_begin)(void);
|
||||
void (*blend_end)(void);
|
||||
void (*restore_clear_color)(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user