Cut down on menu_display_libretro_running usage

This commit is contained in:
twinaphex 2017-01-20 14:25:00 +01:00
parent 58a47e860a
commit 526072ccdf
8 changed files with 40 additions and 24 deletions

View File

@ -2280,6 +2280,15 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->height = video_driver_height;
video_info->use_rgba = video_driver_supports_rgba();
video_info->libretro_running = false;
#ifdef HAVE_MENU
video_info->menu_wallpaper_opacity = settings->menu.wallpaper.opacity;
if (!settings->menu.pause_libretro)
video_info->libretro_running = (rarch_ctl(RARCH_CTL_IS_INITED, NULL)
&& !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL));
#endif
video_driver_threaded_unlock();
}

View File

@ -86,6 +86,7 @@ typedef struct video_info
typedef struct video_frame_info
{
float menu_wallpaper_opacity;
float refresh_rate;
bool shared_context;
bool black_frame_insertion;
@ -112,6 +113,7 @@ typedef struct video_frame_info
float font_msg_color_g;
float font_msg_color_b;
bool use_rgba;
bool libretro_running;
} video_frame_info_t;
/* Optionally implemented interface to poke more

View File

@ -924,7 +924,8 @@ static int mui_get_core_title(char *s, size_t len)
return 0;
}
static void mui_draw_bg(menu_display_ctx_draw_t *draw)
static void mui_draw_bg(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
menu_display_blend_begin();
@ -933,7 +934,7 @@ static void mui_draw_bg(menu_display_ctx_draw_t *draw)
draw->pipeline.id = 0;
draw->pipeline.active = false;
menu_display_draw_bg(draw, false);
menu_display_draw_bg(draw, video_info, false);
menu_display_draw(draw);
menu_display_blend_end();
}
@ -1039,7 +1040,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
uint64_t frame_count = video_info->frame_count;
settings_t *settings = config_get_ptr();
bool background_rendered = false;
bool libretro_running = menu_display_libretro_running();
bool libretro_running = video_info->libretro_running;
/* Default is blue theme */
float *header_bg_color = NULL;
@ -1226,10 +1227,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_libretro_running() && draw.texture)
draw.color = &white_bg[0];
mui_draw_bg(&draw);
mui_draw_bg(&draw, video_info);
}
else
{
@ -1252,10 +1250,10 @@ static void mui_frame(void *data, video_frame_info_t *video_info)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_libretro_running() && draw.texture)
if (draw.texture)
draw.color = &white_bg[0];
mui_draw_bg(&draw);
mui_draw_bg(&draw, video_info);
/* Restore opacity of transposed white background */
menu_display_set_alpha(white_transp_bg, 0.90);

View File

@ -316,7 +316,7 @@ static void nk_menu_frame(void *data, video_frame_info_t *video_info)
settings_t *settings = config_get_ptr();
unsigned width = video_info->width;
unsigned height = video_info->height;
bool libretro_running = menu_display_libretro_running();
bool libretro_running = video_info->libretro_running;
float white_bg[16] = {
0.98, 0.98, 0.98, 1,
0.98, 0.98, 0.98, 1,

View File

@ -2424,7 +2424,7 @@ static void xmb_draw_bg(
RARCH_LOG("DRAW BG %d %d \n",width,height);
#endif
bool running = menu_display_libretro_running();
bool running = video_info->libretro_running;
draw.x = 0;
draw.y = 0;
@ -2454,7 +2454,7 @@ static void xmb_draw_bg(
else
menu_display_set_alpha(draw.color, coord_white[3]);
menu_display_draw_gradient(&draw);
menu_display_draw_gradient(&draw, video_info);
draw.pipeline.id = VIDEO_SHADER_MENU_2;
@ -2492,7 +2492,7 @@ static void xmb_draw_bg(
menu_display_set_alpha(draw.color, coord_white[3]);
if (settings->menu.xmb.menu_color_theme != XMB_THEME_WALLPAPER)
menu_display_draw_gradient(&draw);
menu_display_draw_gradient(&draw, video_info);
{
bool add_opacity = false;
@ -2505,7 +2505,7 @@ static void xmb_draw_bg(
if (settings->menu.xmb.menu_color_theme == XMB_THEME_WALLPAPER)
add_opacity = true;
menu_display_draw_bg(&draw, add_opacity);
menu_display_draw_bg(&draw, video_info, add_opacity);
}
}

View File

@ -970,13 +970,13 @@ static void zarch_frame(void *data, video_frame_info_t *video_info)
draw.vertex_count = 4;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
if (!menu_display_libretro_running() && draw.texture)
if (!video_info->libretro_running && draw.texture)
draw.color = &coord_color2[0];
menu_display_blend_begin();
draw.x = 0;
draw.y = 0;
menu_display_draw_bg(&draw, false);
menu_display_draw_bg(&draw, video_info, false);
menu_display_draw(&draw);
menu_display_blend_end();

View File

@ -495,7 +495,8 @@ void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw)
menu_disp->draw_pipeline(draw);
}
void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wallpaper)
void menu_display_draw_bg(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info, bool add_opacity_to_wallpaper)
{
static struct video_coords coords;
const float *new_vertex = NULL;
@ -519,7 +520,7 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal
draw->coords = &coords;
if (!menu_display_libretro_running() && !draw->pipeline.active)
if (!video_info->libretro_running && !draw->pipeline.active)
add_opacity_to_wallpaper = true;
if (add_opacity_to_wallpaper)
@ -534,13 +535,14 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity_to_wal
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
}
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw)
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
draw->texture = 0;
draw->x = 0;
draw->y = 0;
menu_display_draw_bg(draw, false);
menu_display_draw_bg(draw, video_info, false);
menu_display_draw(draw);
}

View File

@ -240,8 +240,13 @@ void menu_display_clear_color(menu_display_ctx_clearcolor_t *color);
void menu_display_draw(menu_display_ctx_draw_t *draw);
void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw);
void menu_display_draw_bg(menu_display_ctx_draw_t *draw, bool add_opacity);
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw);
void menu_display_draw_bg(
menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info,
bool add_opacity);
void menu_display_draw_gradient(
menu_display_ctx_draw_t *draw,
video_frame_info_t *video_info);
void menu_display_draw_quad(int x, int y, unsigned w, unsigned h,
unsigned width, unsigned height,
float *color);