mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Create menu_display_ctl
This commit is contained in:
parent
6f4c97d697
commit
26e1ec35cb
@ -1176,7 +1176,7 @@ bool event_command(enum event_command cmd)
|
||||
input->poll(driver->input_data);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_display_fb_set_dirty();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
|
||||
|
||||
if (menu_driver_alive())
|
||||
event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE);
|
||||
|
@ -403,7 +403,7 @@ static void glui_frame(void)
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
menu_display_set_viewport();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
@ -523,7 +523,7 @@ static void glui_frame(void)
|
||||
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
|
||||
menu_display_unset_viewport();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
|
||||
}
|
||||
|
||||
static void glui_allocate_white_texture(glui_handle_t *glui)
|
||||
|
@ -435,8 +435,8 @@ static void rgui_render(void)
|
||||
rgui->last_height = frame_buf->height;
|
||||
}
|
||||
|
||||
/* ensures the framebuffer will be rendered on the screen */
|
||||
menu_display_fb_set_dirty();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
|
||||
|
||||
menu_animation_clear_active(anim);
|
||||
rgui->force_redraw = false;
|
||||
|
||||
@ -697,7 +697,7 @@ static void rgui_set_texture(void)
|
||||
if (!frame_buf->dirty)
|
||||
return;
|
||||
|
||||
menu_display_fb_unset_dirty();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG, NULL);
|
||||
|
||||
video_driver_set_texture_frame(
|
||||
frame_buf->data,
|
||||
|
@ -1671,7 +1671,7 @@ static void xmb_frame(void)
|
||||
xmb_draw_cursor(gl, xmb, &coord_color2[0], mouse_x, mouse_y, width, height);
|
||||
}
|
||||
|
||||
menu_display_unset_viewport();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
|
||||
}
|
||||
|
||||
static void xmb_init_horizontal_list(menu_handle_t *menu, xmb_handle_t *xmb)
|
||||
|
@ -15,8 +15,10 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "../config.def.h"
|
||||
|
||||
#include "menu.h"
|
||||
#include "../../config.def.h"
|
||||
#include "menu_display.h"
|
||||
#include "../gfx/video_context_driver.h"
|
||||
#include "../gfx/video_thread_wrapper.h"
|
||||
|
||||
@ -36,20 +38,6 @@ menu_framebuf_t *menu_display_fb_get_ptr(void)
|
||||
return &disp->frame_buf;
|
||||
}
|
||||
|
||||
void menu_display_fb_set_dirty(void)
|
||||
{
|
||||
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||
if (frame_buf && frame_buf->data)
|
||||
frame_buf->dirty = true;
|
||||
}
|
||||
|
||||
void menu_display_fb_unset_dirty(void)
|
||||
{
|
||||
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||
if (frame_buf && frame_buf->data)
|
||||
frame_buf->dirty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
** menu_display_fb:
|
||||
*
|
||||
@ -250,21 +238,34 @@ bool menu_display_init_main_font(void *data,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void menu_display_set_viewport(void)
|
||||
bool menu_display_ctl(enum menu_display_ctl_state state, void *data)
|
||||
{
|
||||
unsigned width, height;
|
||||
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
video_driver_set_viewport(width, height, true, false);
|
||||
}
|
||||
switch (state)
|
||||
{
|
||||
case MENU_DISPLAY_CTL_SET_VIEWPORT:
|
||||
video_driver_get_size(&width, &height);
|
||||
video_driver_set_viewport(width,
|
||||
height, true, false);
|
||||
return true;
|
||||
case MENU_DISPLAY_CTL_UNSET_VIEWPORT:
|
||||
video_driver_get_size(&width, &height);
|
||||
video_driver_set_viewport(width,
|
||||
height, false, true);
|
||||
return true;
|
||||
case MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG:
|
||||
if (frame_buf && frame_buf->data)
|
||||
frame_buf->dirty = true;
|
||||
return true;
|
||||
case MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG:
|
||||
if (frame_buf && frame_buf->data)
|
||||
frame_buf->dirty = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void menu_display_unset_viewport(void)
|
||||
{
|
||||
unsigned width, height;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
video_driver_set_viewport(width,
|
||||
height, false, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
void menu_display_timedate(char *s, size_t len, unsigned time_mode)
|
||||
|
@ -29,6 +29,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum menu_display_ctl_state
|
||||
{
|
||||
MENU_DISPLAY_CTL_SET_VIEWPORT = 0,
|
||||
MENU_DISPLAY_CTL_UNSET_VIEWPORT,
|
||||
MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG,
|
||||
MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG
|
||||
};
|
||||
|
||||
typedef struct menu_framebuf
|
||||
{
|
||||
uint16_t *data;
|
||||
@ -65,10 +73,6 @@ menu_framebuf_t *menu_display_fb_get_ptr(void);
|
||||
|
||||
void menu_display_libretro(void);
|
||||
|
||||
void menu_display_fb_set_dirty(void);
|
||||
|
||||
void menu_display_fb_unset_dirty(void);
|
||||
|
||||
void menu_display_free(void *data);
|
||||
|
||||
bool menu_display_init(void *data);
|
||||
@ -92,9 +96,8 @@ bool menu_display_init_main_font(void *data,
|
||||
|
||||
void menu_display_free_main_font(void *data);
|
||||
|
||||
void menu_display_set_viewport(void);
|
||||
|
||||
void menu_display_unset_viewport(void);
|
||||
bool menu_display_ctl(enum menu_display_ctl_state state, void *data);
|
||||
|
||||
void menu_display_timedate(char *s, size_t len, unsigned time_mode);
|
||||
|
||||
|
@ -544,7 +544,7 @@ int menu_iterate_render(void)
|
||||
BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);
|
||||
|
||||
if (BIT64_GET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER))
|
||||
menu_display_fb_set_dirty();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
|
||||
|
||||
if (BIT64_GET(menu->state, MENU_STATE_RENDER_MESSAGEBOX) && menu->menu_state.msg[0] != '\0')
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ void menu_video_frame_background(
|
||||
if (gl->shader && gl->shader->use)
|
||||
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
||||
|
||||
menu_display_set_viewport();
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);
|
||||
|
||||
if ((settings->menu.pause_libretro
|
||||
|| !global->inited.main || (global->inited.core.type == CORE_TYPE_DUMMY))
|
||||
|
Loading…
x
Reference in New Issue
Block a user