Move framebuffer is dirty and other menu-related state flags

to menu_handle_t
This commit is contained in:
twinaphex 2015-05-11 18:46:06 +02:00
parent 1a152677a3
commit a014f2db88
13 changed files with 59 additions and 58 deletions

View File

@ -1091,9 +1091,15 @@ bool event_command(enum event_command cmd)
input_driver_poll();
#ifdef HAVE_MENU
runloop->frames.video.current.menu.framebuf.dirty = true;
if (runloop->is_menu)
event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE);
{
menu_handle_t *menu = menu_driver_get_ptr();
if (menu)
menu->framebuf.dirty = true;
if (runloop->is_menu)
event_command(EVENT_CMD_VIDEO_SET_BLOCKING_STATE);
}
#endif
break;
case EVENT_CMD_CHEATS_DEINIT:

View File

@ -368,9 +368,8 @@ static void glui_frame(void)
menu->navigation.selection_ptr,
global->video_data.width, glui->line_height, 1, 1, 1, 0.1);
runloop->frames.video.current.menu.animation.is_active = true;
runloop->frames.video.current.menu.label.is_updated = false;
runloop->frames.video.current.menu.framebuf.dirty = false;
menu->animation_is_active = true;
menu->label.is_updated = false;
glui_render_quad(gl, 0, 0, global->video_data.width,
menu->header_height, 0.2, 0.2, 0.2, 1);

View File

@ -356,9 +356,9 @@ static void rgui_render(void)
return;
/* ensures the framebuffer will be rendered on the screen */
runloop->frames.video.current.menu.framebuf.dirty = true;
runloop->frames.video.current.menu.animation.is_active = false;
runloop->frames.video.current.menu.label.is_updated = false;
menu->framebuf.dirty = true;
menu->animation_is_active = false;
menu->label.is_updated = false;
if (settings->menu.pointer.enable)
{
@ -571,10 +571,10 @@ static void rgui_set_texture(void)
if (!menu)
return;
if (!runloop->frames.video.current.menu.framebuf.dirty)
if (!menu->framebuf.dirty)
return;
runloop->frames.video.current.menu.framebuf.dirty = false;
menu->framebuf.dirty = false;
video_driver_set_texture_frame(
menu->frame_buf.data, false,

View File

@ -1164,9 +1164,8 @@ static void xmb_render(void)
}
}
runloop->frames.video.current.menu.animation.is_active = false;
runloop->frames.video.current.menu.label.is_updated = false;
runloop->frames.video.current.menu.framebuf.dirty = false;
menu->animation_is_active = false;
menu->label.is_updated = false;
}
static void xmb_frame(void)

View File

@ -171,7 +171,7 @@ void *menu_init(const void *data)
rarch_assert(menu->msg_queue = msg_queue_new(8));
runloop->frames.video.current.menu.framebuf.dirty = true;
menu->framebuf.dirty = true;
return menu;
error:
@ -349,7 +349,7 @@ int menu_iterate(retro_input_t input,
if (menu->cur_time - last_clock_update > 1000000 && settings->menu.timedate_enable)
{
runloop->frames.video.current.menu.label.is_updated = true;
menu->label.is_updated = true;
last_clock_update = menu->cur_time;
}

View File

@ -439,7 +439,7 @@ bool menu_animation_update(animation_t *animation, float dt)
{
unsigned i;
unsigned active_tweens = 0;
runloop_t *runloop = rarch_main_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
for(i = 0; i < animation->size; i++)
menu_animation_iterate(&animation->list[i], dt, &active_tweens);
@ -450,7 +450,7 @@ bool menu_animation_update(animation_t *animation, float dt)
return false;
}
runloop->frames.video.current.menu.animation.is_active = true;
menu->animation_is_active = true;
return true;
}
@ -473,7 +473,7 @@ void menu_animation_ticker_line(char *buf, size_t len, uint64_t idx,
unsigned phase_left_moving, phase_right_stop;
unsigned left_offset, right_offset;
size_t str_len = strlen(str);
runloop_t *runloop = rarch_main_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (str_len <= len)
{
@ -514,5 +514,5 @@ void menu_animation_ticker_line(char *buf, size_t len, uint64_t idx,
else
strlcpy(buf, str + right_offset, len + 1);
runloop->frames.video.current.menu.animation.is_active = true;
menu->animation_is_active = true;
}

View File

@ -24,12 +24,10 @@
bool menu_display_update_pending(void)
{
runloop_t *runloop = rarch_main_get_ptr();
if (runloop)
menu_handle_t *menu = menu_driver_get_ptr();
if (menu)
{
if (runloop->frames.video.current.menu.animation.is_active ||
runloop->frames.video.current.menu.label.is_updated ||
runloop->frames.video.current.menu.framebuf.dirty)
if (menu->animation_is_active || menu->label.is_updated || menu->framebuf.dirty)
return true;
}
return false;

View File

@ -210,12 +210,29 @@ typedef struct
unsigned idx;
} keyboard;
struct
{
bool is_updated;
} label;
struct
{
bool dirty;
} framebuf;
struct
{
bool active;
} action;
rarch_setting_t *list_settings;
animation_t *animation;
bool animation_is_active;
content_playlist_t *db_playlist;
char db_playlist_file[PATH_MAX_LENGTH];
database_info_handle_t *db;
} menu_handle_t;
typedef struct menu_file_list_cbs

View File

@ -388,10 +388,10 @@ static void menu_action_setting_disp_set_label_perf_counters(
const char *path,
char *path_buf, size_t path_buf_size)
{
menu_handle_t *menu = menu_driver_get_ptr();
const struct retro_perf_counter **counters =
(const struct retro_perf_counter **)perf_counters_rarch;
unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN;
runloop_t *runloop = rarch_main_get_ptr();
*type_str = '\0';
*w = 19;
@ -412,7 +412,7 @@ static void menu_action_setting_disp_set_label_perf_counters(
(unsigned long long)counters[offset]->call_cnt),
(unsigned long long)counters[offset]->call_cnt);
runloop->frames.video.current.menu.label.is_updated = true;
menu->label.is_updated = true;
}
static void menu_action_setting_disp_set_label_libretro_perf_counters(
@ -424,10 +424,10 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters(
const char *path,
char *path_buf, size_t path_buf_size)
{
menu_handle_t *menu = menu_driver_get_ptr();
const struct retro_perf_counter **counters =
(const struct retro_perf_counter **)perf_counters_libretro;
unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN;
runloop_t *runloop = rarch_main_get_ptr();
*type_str = '\0';
*w = 19;
@ -448,7 +448,7 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters(
(unsigned long long)counters[offset]->call_cnt),
(unsigned long long)counters[offset]->call_cnt);
runloop->frames.video.current.menu.label.is_updated = true;
menu->label.is_updated = true;
}
static void menu_action_setting_disp_set_label_menu_more(

View File

@ -359,7 +359,7 @@ int menu_entry_iterate(unsigned action)
return -1;
if (action != MENU_ACTION_NOOP || menu->need_refresh || menu_display_update_pending())
runloop->frames.video.current.menu.framebuf.dirty = true;
menu->framebuf.dirty = true;
cbs = (menu_file_list_cbs_t*)menu_list_get_last_stack_actiondata(menu_list);

View File

@ -657,7 +657,7 @@ static int menu_input_mouse(unsigned *action)
|| menu->mouse.wheelup || menu->mouse.wheeldown
|| menu->mouse.hwheelup || menu->mouse.hwheeldown
|| menu->mouse.scrollup || menu->mouse.scrolldown)
runloop->frames.video.current.menu.animation.is_active = true;
menu->animation_is_active = true;
return 0;
}
@ -699,7 +699,7 @@ static int menu_input_pointer(unsigned *action)
if (menu->pointer.pressed[0] || menu->pointer.oldpressed[0]
|| menu->pointer.back || menu->pointer.dragging
|| menu->pointer.dy != 0 || menu->pointer.dx != 0)
runloop->frames.video.current.menu.animation.is_active = true;
menu->animation_is_active = true;
return 0;
}

View File

@ -55,31 +55,6 @@ typedef struct runloop
struct
{
unsigned max;
struct
{
struct
{
struct
{
bool is_updated;
} label;
struct
{
bool is_active;
} animation;
struct
{
bool dirty;
} framebuf;
struct
{
bool active;
} action;
} menu;
} current;
} video;
struct

View File

@ -1145,7 +1145,14 @@ static void setting_get_string_representation_st_float_video_refresh_rate_auto(v
snprintf(type_str, type_str_size, "%.3f Hz (%.1f%% dev, %u samples)",
video_refresh_rate, 100.0 * deviation, sample_points);
runloop->frames.video.current.menu.label.is_updated = true;
#ifdef HAVE_MENU
{
menu_handle_t *menu = menu_driver_get_ptr();
if (menu)
menu->label.is_updated = true;
}
#endif
}
else
strlcpy(type_str, "N/A", type_str_size);