Get rid of gfx_ctx_animation_tag

This commit is contained in:
twinaphex 2020-06-08 04:09:12 +02:00
parent eb20c10713
commit 9707f1f622
14 changed files with 84 additions and 83 deletions

View File

@ -2237,7 +2237,7 @@ bool gfx_animation_is_active(void)
return p_anim->animation_is_active || p_anim->ticker_is_active;
}
bool gfx_animation_kill_by_tag(gfx_animation_ctx_tag *tag)
bool gfx_animation_kill_by_tag(uintptr_t *tag)
{
unsigned i;
gfx_animation_t *p_anim = anim_get_ptr();
@ -2353,11 +2353,11 @@ bool gfx_animation_ctl(enum gfx_animation_ctl_state state, void *data)
void gfx_timer_start(gfx_timer_t *timer, gfx_timer_ctx_entry_t *timer_entry)
{
gfx_animation_ctx_entry_t entry;
gfx_animation_ctx_tag tag = (uintptr_t) timer;
uintptr_t tag = (uintptr_t) timer;
gfx_timer_kill(timer);
*timer = 0.0f;
*timer = 0.0f;
entry.easing_enum = EASING_LINEAR;
entry.tag = tag;
@ -2372,7 +2372,7 @@ void gfx_timer_start(gfx_timer_t *timer, gfx_timer_ctx_entry_t *timer_entry)
void gfx_timer_kill(gfx_timer_t *timer)
{
gfx_animation_ctx_tag tag = (uintptr_t) timer;
uintptr_t tag = (uintptr_t) timer;
gfx_animation_kill_by_tag(&tag);
}

View File

@ -100,8 +100,6 @@ enum gfx_animation_ticker_type
TICKER_TYPE_LAST
};
typedef uintptr_t gfx_animation_ctx_tag;
typedef struct gfx_animation_ctx_subject
{
size_t count;
@ -219,7 +217,7 @@ float gfx_animation_get_delta_time(void);
bool gfx_animation_is_active(void);
bool gfx_animation_kill_by_tag(gfx_animation_ctx_tag *tag);
bool gfx_animation_kill_by_tag(uintptr_t *tag);
void gfx_animation_kill_by_subject(gfx_animation_ctx_subject_t *subject);

View File

@ -470,7 +470,7 @@ void gfx_thumbnail_reset(gfx_thumbnail_t *thumbnail)
/* Ensure any 'fade in' animation is killed */
if (thumbnail->fade_active)
{
gfx_animation_ctx_tag tag = (uintptr_t)&thumbnail->alpha;
uintptr_t tag = (uintptr_t)&thumbnail->alpha;
gfx_animation_kill_by_tag(&tag);
}

View File

@ -717,7 +717,7 @@ static void gfx_widgets_msg_queue_free(
menu_widget_msg_t *msg, bool touch_list)
{
size_t i;
gfx_animation_ctx_tag tag = (uintptr_t)msg;
uintptr_t tag = (uintptr_t)msg;
if (msg->task_ptr)
{
@ -1003,16 +1003,16 @@ static void gfx_widgets_hourglass_end(void *userdata)
static void gfx_widgets_hourglass_tick(void *userdata)
{
gfx_animation_ctx_entry_t entry;
menu_widget_msg_t *msg = (menu_widget_msg_t*)userdata;
gfx_animation_ctx_tag tag = (uintptr_t)msg;
menu_widget_msg_t *msg = (menu_widget_msg_t*)userdata;
uintptr_t tag = (uintptr_t)msg;
entry.easing_enum = EASING_OUT_QUAD;
entry.tag = tag;
entry.duration = HOURGLASS_DURATION;
entry.target_value = -(2 * M_PI);
entry.subject = &msg->hourglass_rotation;
entry.cb = gfx_widgets_hourglass_end;
entry.userdata = msg;
entry.easing_enum = EASING_OUT_QUAD;
entry.tag = tag;
entry.duration = HOURGLASS_DURATION;
entry.target_value = -(2 * M_PI);
entry.subject = &msg->hourglass_rotation;
entry.cb = gfx_widgets_hourglass_end;
entry.userdata = msg;
gfx_animation_push(&entry);
}

View File

@ -45,7 +45,7 @@ static void gfx_widget_generic_message_fadeout(void *userdata)
gfx_animation_ctx_entry_t entry;
gfx_widget_generic_message_state_t* state =
gfx_widget_generic_message_get_ptr();
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
uintptr_t tag = (uintptr_t) &state->timer;
/* Start fade out animation */
entry.cb = NULL;
@ -64,7 +64,7 @@ void gfx_widget_set_message(char *msg)
gfx_timer_ctx_entry_t timer;
gfx_widget_generic_message_state_t* state =
gfx_widget_generic_message_get_ptr();
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
uintptr_t tag = (uintptr_t) &state->timer;
strlcpy(state->message, msg, sizeof(state->message));

View File

@ -45,9 +45,9 @@ static gfx_widget_libretro_message_state_t* gfx_widget_libretro_message_get_stat
static void gfx_widget_libretro_message_fadeout(void *userdata)
{
gfx_widget_libretro_message_state_t* state = gfx_widget_libretro_message_get_state();
gfx_animation_ctx_entry_t entry;
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
gfx_widget_libretro_message_state_t* state = gfx_widget_libretro_message_get_state();
uintptr_t tag = (uintptr_t)&state->timer;
/* Start fade out animation */
entry.cb = NULL;
@ -66,7 +66,7 @@ void gfx_widget_set_libretro_message(void *data,
{
gfx_timer_ctx_entry_t timer;
gfx_widget_libretro_message_state_t* state = gfx_widget_libretro_message_get_state();
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
uintptr_t tag = (uintptr_t)&state->timer;
gfx_widget_font_data_t* font_regular = gfx_widgets_get_font_regular(data);
strlcpy(state->message, msg, sizeof(state->message));
@ -129,8 +129,8 @@ static void gfx_widget_libretro_message_frame(void *data, void *user_data)
static void gfx_widget_libretro_message_free(void)
{
gfx_widget_libretro_message_state_t* state = gfx_widget_libretro_message_get_state();
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
gfx_widget_libretro_message_state_t* state = gfx_widget_libretro_message_get_state();
uintptr_t tag = (uintptr_t) &state->timer;
state->alpha = 0.0f;
gfx_timer_kill(&state->timer);

View File

@ -49,7 +49,7 @@ struct gfx_widget_volume_state
float alpha;
float text_alpha;
gfx_animation_ctx_tag tag;
uintptr_t tag;
bool mute;
unsigned widget_width;

View File

@ -2723,7 +2723,7 @@ static size_t materialui_auto_select_onscreen_entry(
static INLINE void materialui_kill_scroll_animation(
materialui_handle_t *mui)
{
gfx_animation_ctx_tag scroll_tag = (uintptr_t)&mui->scroll_y;
uintptr_t scroll_tag = (uintptr_t)&mui->scroll_y;
gfx_animation_kill_by_tag(&scroll_tag);
menu_input_set_pointer_y_accel(0.0f);
@ -2884,7 +2884,7 @@ static bool materialui_render_process_entry_playlist_desktop(
/* Fetch metadata for selected entry */
if (mui->status_bar.enabled)
{
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&mui->status_bar.alpha;
uintptr_t alpha_tag = (uintptr_t)&mui->status_bar.alpha;
/* Reset metadata if current selection
* has changed */
@ -5519,7 +5519,7 @@ static bool materialui_get_selected_thumbnails(
static void materialui_hide_fullscreen_thumbnails(
materialui_handle_t *mui, bool animate)
{
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&mui->fullscreen_thumbnail_alpha;
uintptr_t alpha_tag = (uintptr_t)&mui->fullscreen_thumbnail_alpha;
/* Kill any existing fade in/out animations */
gfx_animation_kill_by_tag(&alpha_tag);
@ -5558,8 +5558,9 @@ static void materialui_show_fullscreen_thumbnails(
gfx_animation_ctx_entry_t animation_entry;
gfx_thumbnail_t *primary_thumbnail = NULL;
gfx_thumbnail_t *secondary_thumbnail = NULL;
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&mui->fullscreen_thumbnail_alpha;
const char *thumbnail_label = NULL;
uintptr_t alpha_tag = (uintptr_t)
&mui->fullscreen_thumbnail_alpha;
const char *thumbnail_label = NULL;
/* Before showing fullscreen thumbnails, must
* ensure that any existing fullscreen thumbnail
@ -6514,8 +6515,8 @@ static void materialui_set_landscape_optimisations_enable(
static void materialui_status_bar_init(
materialui_handle_t *mui, settings_t *settings)
{
bool playlist_show_sublabels = settings->bools.playlist_show_sublabels;
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&mui->status_bar.alpha;
bool playlist_show_sublabels = settings->bools.playlist_show_sublabels;
uintptr_t alpha_tag = (uintptr_t)&mui->status_bar.alpha;
/* Kill any existing fade in animation */
if (mui->status_bar.enabled ||
@ -7322,8 +7323,8 @@ static void materialui_scroll_animation_end(void *userdata)
static void materialui_animate_scroll(
materialui_handle_t *mui, float scroll_pos, float duration)
{
gfx_animation_ctx_tag animation_tag = (uintptr_t)&mui->scroll_y;
gfx_animation_ctx_entry_t animation_entry;
uintptr_t animation_tag = (uintptr_t)&mui->scroll_y;
/* Kill any existing scroll animation */
gfx_animation_kill_by_tag(&animation_tag);
@ -7472,9 +7473,10 @@ static void materialui_init_transition_animation(
{
gfx_animation_ctx_entry_t alpha_entry;
gfx_animation_ctx_entry_t x_offset_entry;
size_t stack_size = materialui_list_get_size(mui, MENU_LIST_PLAIN);
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&mui->transition_alpha;
gfx_animation_ctx_tag x_offset_tag = (uintptr_t)&mui->transition_x_offset;
size_t stack_size =
materialui_list_get_size(mui, MENU_LIST_PLAIN);
uintptr_t alpha_tag = (uintptr_t)&mui->transition_alpha;
uintptr_t x_offset_tag = (uintptr_t)&mui->transition_x_offset;
unsigned transition_animation = settings->uints.menu_materialui_transition_animation;
/* If animations are disabled, reset alpha/x offset

View File

@ -875,8 +875,8 @@ static void INLINE ozone_font_free(ozone_font_data_t *font_data)
static void ozone_context_destroy(void *data)
{
unsigned i;
uintptr_t tag;
ozone_handle_t *ozone = (ozone_handle_t*) data;
gfx_animation_ctx_tag tag;
if (!ozone)
return;
@ -1176,7 +1176,7 @@ static size_t ozone_list_get_selection(void *data)
static void ozone_list_clear(file_list_t *list)
{
gfx_animation_ctx_tag tag = (uintptr_t)list;
uintptr_t tag = (uintptr_t)list;
gfx_animation_kill_by_tag(&tag);
ozone_free_list_nodes(list, false);
@ -1288,8 +1288,8 @@ static void ozone_render(void *data,
/* Process pointer input, if required */
if (pointer_enabled)
{
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
gfx_animation_ctx_tag animation_tag = (uintptr_t)selection_buf;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
uintptr_t animation_tag = (uintptr_t)selection_buf;
int entry_padding = (ozone->depth == 1) ?
ozone->dimensions.entry_padding_horizontal_half :
@ -2255,7 +2255,7 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
{
menu_entry_t entry;
unsigned entry_type;
gfx_animation_ctx_tag tag = (uintptr_t)selection_buf;
uintptr_t tag = (uintptr_t)selection_buf;
size_t selection = menu_navigation_get_selection();
menu_entry_init(&entry);
@ -2393,7 +2393,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
settings_t *settings = config_get_ptr();
unsigned color_theme = settings->uints.menu_ozone_color_theme;
bool use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme;
gfx_animation_ctx_tag messagebox_tag = (uintptr_t)ozone->pending_message;
uintptr_t messagebox_tag = (uintptr_t)ozone->pending_message;
bool draw_osk = menu_input_dialog_get_display_kb();
static bool draw_osk_old = false;
float *background_color = NULL;
@ -2705,21 +2705,21 @@ static void ozone_animation_end(void *userdata)
static void ozone_list_open(ozone_handle_t *ozone)
{
gfx_animation_ctx_tag sidebar_tag = (uintptr_t)&ozone->sidebar_offset;
struct gfx_animation_ctx_entry entry;
uintptr_t sidebar_tag = (uintptr_t)&ozone->sidebar_offset;
ozone->draw_old_list = true;
ozone->draw_old_list = true;
/* Left/right animation */
ozone->animations.list_alpha = 0.0f;
entry.cb = ozone_animation_end;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = EASING_OUT_QUAD;
entry.subject = &ozone->animations.list_alpha;
entry.tag = (uintptr_t) NULL;
entry.target_value = 1.0f;
entry.userdata = ozone;
entry.cb = ozone_animation_end;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = EASING_OUT_QUAD;
entry.subject = &ozone->animations.list_alpha;
entry.tag = (uintptr_t)NULL;
entry.target_value = 1.0f;
entry.userdata = ozone;
gfx_animation_push(&entry);
@ -2947,8 +2947,8 @@ static void ozone_list_insert(void *userdata,
static void ozone_list_deep_copy(const file_list_t *src, file_list_t *dst,
size_t first, size_t last)
{
size_t i, j = 0;
gfx_animation_ctx_tag tag = (uintptr_t)dst;
size_t i, j = 0;
uintptr_t tag = (uintptr_t)dst;
gfx_animation_kill_by_tag(&tag);
@ -3150,7 +3150,8 @@ static bool ozone_get_load_content_animation_data(void *userdata, uintptr_t *ico
void ozone_hide_fullscreen_thumbnails(ozone_handle_t *ozone, bool animate)
{
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&ozone->animations.fullscreen_thumbnail_alpha;
uintptr_t alpha_tag = (uintptr_t)
&ozone->animations.fullscreen_thumbnail_alpha;
/* Kill any existing fade in/out animations */
gfx_animation_kill_by_tag(&alpha_tag);
@ -3186,8 +3187,8 @@ void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
gfx_animation_ctx_entry_t animation_entry;
const char *thumbnail_label = NULL;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&ozone->animations.fullscreen_thumbnail_alpha;
gfx_animation_ctx_tag scroll_tag = (uintptr_t)selection_buf;
uintptr_t alpha_tag = (uintptr_t)&ozone->animations.fullscreen_thumbnail_alpha;
uintptr_t scroll_tag = (uintptr_t)selection_buf;
/* Before showing fullscreen thumbnails, must
* ensure that any existing fullscreen thumbnail
@ -3305,7 +3306,7 @@ static bool INLINE ozone_metadata_override_available(ozone_handle_t *ozone)
void ozone_toggle_metadata_override(ozone_handle_t *ozone)
{
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&ozone->animations.left_thumbnail_alpha;
uintptr_t alpha_tag = (uintptr_t)&ozone->animations.left_thumbnail_alpha;
gfx_animation_ctx_entry_t animation_entry;
/* Kill any existing fade in/out animations */
@ -3349,13 +3350,12 @@ static int ozone_pointer_up(void *userdata,
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
{
unsigned width, height;
ozone_handle_t *ozone = (ozone_handle_t*)userdata;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
gfx_animation_ctx_tag sidebar_tag = (uintptr_t)selection_buf;
uintptr_t sidebar_tag = (uintptr_t)selection_buf;
size_t selection = menu_navigation_get_selection();
size_t entries_end = menu_entries_get_size();
unsigned width;
unsigned height;
if (!ozone)
return -1;
@ -3576,11 +3576,11 @@ static size_t ozone_get_onscreen_category_selection(
static enum menu_action ozone_parse_menu_entry_action(
ozone_handle_t *ozone, enum menu_action action)
{
uintptr_t tag;
int new_selection;
enum menu_action new_action = action;
file_list_t *selection_buf = NULL;
unsigned horizontal_list_size = 0;
gfx_animation_ctx_tag tag;
/* If fullscreen thumbnail view is active, any
* valid menu action will disable it... */

View File

@ -96,7 +96,7 @@ static void ozone_cursor_animation_cb(void *userdata)
void ozone_restart_cursor_animation(ozone_handle_t *ozone)
{
gfx_animation_ctx_tag tag = (uintptr_t) &ozone_default_theme;
uintptr_t tag = (uintptr_t) &ozone_default_theme;
if (!ozone->has_all_assets)
return;

View File

@ -150,7 +150,7 @@ void ozone_update_scroll(ozone_handle_t *ozone, bool allow_animation, ozone_node
float new_scroll = 0, entries_middle;
float bottom_boundary, current_selection_middle_onscreen;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
gfx_animation_ctx_tag tag = (uintptr_t) selection_buf;
uintptr_t tag = (uintptr_t) selection_buf;
video_driver_get_size(NULL, &video_info_height);
@ -323,7 +323,7 @@ static void ozone_thumbnail_bar_hide_end(void *userdata)
void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist, bool allow_animation)
{
struct gfx_animation_ctx_entry entry;
gfx_animation_ctx_tag tag = (uintptr_t) &ozone->show_thumbnail_bar;
uintptr_t tag = (uintptr_t)&ozone->show_thumbnail_bar;
entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD;

View File

@ -468,7 +468,7 @@ void ozone_sidebar_update_collapse(ozone_handle_t *ozone, bool allow_animation)
struct gfx_animation_ctx_entry entry;
settings_t *settings = config_get_ptr();
bool is_playlist = ozone_is_playlist(ozone, false);
gfx_animation_ctx_tag tag = (uintptr_t) &ozone->sidebar_collapsed;
uintptr_t tag = (uintptr_t)&ozone->sidebar_collapsed;
bool collapse_sidebar = settings->bools.ozone_collapse_sidebar;
entry.easing_enum = EASING_OUT_QUAD;
@ -564,7 +564,7 @@ void ozone_sidebar_goto(ozone_handle_t *ozone, unsigned new_selection)
{
unsigned video_info_height;
struct gfx_animation_ctx_entry entry;
gfx_animation_ctx_tag tag = (uintptr_t)ozone;
uintptr_t tag = (uintptr_t)ozone;
video_driver_get_size(NULL, &video_info_height);
@ -616,10 +616,10 @@ void ozone_sidebar_goto(ozone_handle_t *ozone, unsigned new_selection)
void ozone_refresh_sidebars(ozone_handle_t *ozone, unsigned video_height)
{
settings_t *settings = config_get_ptr();
gfx_animation_ctx_tag collapsed_tag = (uintptr_t)&ozone->sidebar_collapsed;
gfx_animation_ctx_tag offset_tag = (uintptr_t)&ozone->sidebar_offset;
gfx_animation_ctx_tag thumbnail_tag = (uintptr_t)&ozone->show_thumbnail_bar;
gfx_animation_ctx_tag scroll_tag = (uintptr_t)ozone;
uintptr_t collapsed_tag = (uintptr_t)&ozone->sidebar_collapsed;
uintptr_t offset_tag = (uintptr_t)&ozone->sidebar_offset;
uintptr_t thumbnail_tag = (uintptr_t)&ozone->show_thumbnail_bar;
uintptr_t scroll_tag = (uintptr_t)ozone;
bool is_playlist = ozone_is_playlist(ozone, false);
bool collapse_sidebar = settings->bools.ozone_collapse_sidebar;

View File

@ -1192,8 +1192,8 @@ static unsigned stripes_get_system_tab(stripes_handle_t *stripes, unsigned i)
static void stripes_selection_pointer_changed(
stripes_handle_t *stripes, bool allow_animations)
{
uintptr_t tag;
unsigned i, end, height;
gfx_animation_ctx_tag tag;
menu_entry_t entry;
size_t num = 0;
int threshold = 0;
@ -3896,7 +3896,7 @@ static void stripes_list_insert(void *userdata,
static void stripes_list_clear(file_list_t *list)
{
gfx_animation_ctx_tag tag = (uintptr_t)list;
uintptr_t tag = (uintptr_t)list;
gfx_animation_kill_by_tag(&tag);
@ -3911,8 +3911,8 @@ static void stripes_list_free(file_list_t *list, size_t a, size_t b)
static void stripes_list_deep_copy(const file_list_t *src, file_list_t *dst,
size_t first, size_t last)
{
size_t i, j = 0;
gfx_animation_ctx_tag tag = (uintptr_t)dst;
size_t i, j = 0;
uintptr_t tag = (uintptr_t)dst;
gfx_animation_kill_by_tag(&tag);

View File

@ -1320,7 +1320,7 @@ static void xmb_selection_pointer_changed(
xmb_handle_t *xmb, bool allow_animations)
{
unsigned i, end, height;
gfx_animation_ctx_tag tag;
uintptr_t tag;
size_t num = 0;
int threshold = 0;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
@ -3864,7 +3864,7 @@ static void xmb_draw_dark_layer(
static void xmb_hide_fullscreen_thumbnails(
xmb_handle_t *xmb, bool animate)
{
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&xmb->fullscreen_thumbnail_alpha;
uintptr_t alpha_tag = (uintptr_t)&xmb->fullscreen_thumbnail_alpha;
/* Kill any existing fade in/out animations */
gfx_animation_kill_by_tag(&alpha_tag);
@ -3899,11 +3899,12 @@ static void xmb_hide_fullscreen_thumbnails(
static void xmb_show_fullscreen_thumbnails(
xmb_handle_t *xmb, size_t selection)
{
menu_entry_t selected_entry;
gfx_animation_ctx_entry_t animation_entry;
const char *core_name = NULL;
const char *thumbnail_label = NULL;
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&xmb->fullscreen_thumbnail_alpha;
gfx_animation_ctx_entry_t animation_entry;
menu_entry_t selected_entry;
uintptr_t alpha_tag = (uintptr_t)
&xmb->fullscreen_thumbnail_alpha;
/* Before showing fullscreen thumbnails, must
* ensure that any existing fullscreen thumbnail
@ -6128,7 +6129,7 @@ static void xmb_list_insert(void *userdata,
static void xmb_list_clear(file_list_t *list)
{
gfx_animation_ctx_tag tag = (uintptr_t)list;
uintptr_t tag = (uintptr_t)list;
gfx_animation_kill_by_tag(&tag);
@ -6143,8 +6144,8 @@ static void xmb_list_free(file_list_t *list, size_t a, size_t b)
static void xmb_list_deep_copy(const file_list_t *src, file_list_t *dst,
size_t first, size_t last)
{
size_t i, j = 0;
gfx_animation_ctx_tag tag = (uintptr_t)dst;
size_t i, j = 0;
uintptr_t tag = (uintptr_t)dst;
gfx_animation_kill_by_tag(&tag);