Get rid of gfx_animation_ctl

This commit is contained in:
twinaphex 2020-10-14 04:40:20 +02:00
parent fd17661e02
commit 379bd80cda
8 changed files with 26 additions and 40 deletions

View File

@ -2197,28 +2197,6 @@ void gfx_animation_deinit(gfx_animation_t *p_anim)
memset(p_anim, 0, sizeof(*p_anim));
}
bool gfx_animation_ctl(enum gfx_animation_ctl_state state, void *data)
{
gfx_animation_t *p_anim = anim_get_ptr();
switch (state)
{
case MENU_ANIMATION_CTL_CLEAR_ACTIVE:
p_anim->animation_is_active = false;
p_anim->ticker_is_active = false;
break;
case MENU_ANIMATION_CTL_SET_ACTIVE:
p_anim->animation_is_active = true;
p_anim->ticker_is_active = true;
break;
case MENU_ANIMATION_CTL_NONE:
default:
break;
}
return true;
}
void gfx_timer_start(gfx_timer_t *timer, gfx_timer_ctx_entry_t *timer_entry)
{
gfx_animation_ctx_entry_t entry;

View File

@ -31,18 +31,23 @@ RETRO_BEGIN_DECLS
#define ANIM_IS_ACTIVE(_p) ((_p)->animation_is_active || (_p)->ticker_is_active)
#define GFX_ANIMATION_CLEAR_ACTIVE(anim) \
{ \
(anim)->animation_is_active = false; \
(anim)->ticker_is_active = false; \
}
#define GFX_ANIMATION_SET_ACTIVE(anim) \
{ \
(anim)->animation_is_active = true; \
(anim)->ticker_is_active = true; \
}
typedef void (*tween_cb) (void*);
typedef void (*update_time_cb) (float *ticker_pixel_increment,
unsigned width, unsigned height);
enum gfx_animation_ctl_state
{
MENU_ANIMATION_CTL_NONE = 0,
MENU_ANIMATION_CTL_CLEAR_ACTIVE,
MENU_ANIMATION_CTL_SET_ACTIVE
};
enum gfx_animation_easing_type
{
/* Linear */
@ -251,8 +256,6 @@ bool gfx_animation_push(gfx_animation_ctx_entry_t *entry);
void gfx_animation_push_delayed(unsigned delay, gfx_animation_ctx_entry_t *entry);
bool gfx_animation_ctl(enum gfx_animation_ctl_state state, void *data);
void gfx_animation_set_update_time_cb(update_time_cb cb);
void gfx_animation_unset_update_time_cb(void);

View File

@ -707,13 +707,14 @@ static void general_disp_set_label_perf_counters(
const char *path, unsigned *w
)
{
gfx_animation_t *p_anim = anim_get_ptr();
*s = '\0';
*w = 19;
strlcpy(s2, path, len2);
menu_action_setting_disp_set_label_perf_counters_common(
counters, offset, s, len);
gfx_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
GFX_ANIMATION_CLEAR_ACTIVE(p_anim);
}
static void menu_action_setting_disp_set_label_perf_counters(

View File

@ -1671,6 +1671,7 @@ static void ozone_render(void *data,
unsigned language = *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE);
ozone_handle_t *ozone = (ozone_handle_t*)data;
gfx_display_t *p_disp = disp_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
if (!ozone)
return;
@ -2044,7 +2045,7 @@ static void ozone_render(void *data,
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i);
}
gfx_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
GFX_ANIMATION_CLEAR_ACTIVE(p_anim);
}
static void ozone_draw_header(ozone_handle_t *ozone,

View File

@ -3536,7 +3536,7 @@ static void rgui_render(void *data,
rgui->bg_modified = false;
p_disp->framebuf_dirty = true;
gfx_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
GFX_ANIMATION_CLEAR_ACTIVE(p_anim);
rgui->force_redraw = false;

View File

@ -2623,6 +2623,7 @@ static void stripes_render(void *data,
settings_t *settings = config_get_ptr();
stripes_handle_t *stripes = (stripes_handle_t*)data;
unsigned end = (unsigned)menu_entries_get_size();
gfx_animation_t *p_anim = anim_get_ptr();
if (!stripes)
return;
@ -2661,7 +2662,7 @@ static void stripes_render(void *data,
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i);
}
gfx_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
GFX_ANIMATION_CLEAR_ACTIVE(p_anim);
}
static bool stripes_shader_pipeline_active(unsigned menu_shader_pipeline)

View File

@ -3839,6 +3839,7 @@ static void xmb_render(void *data,
settings_t *settings = config_get_ptr();
unsigned end = (unsigned)menu_entries_get_size();
gfx_display_t *p_disp = disp_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
if (!xmb)
return;
@ -4009,7 +4010,7 @@ static void xmb_render(void *data,
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i);
}
gfx_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL);
GFX_ANIMATION_CLEAR_ACTIVE(p_anim);
}
static bool xmb_shader_pipeline_active(unsigned menu_shader_pipeline)

View File

@ -6826,6 +6826,7 @@ setting_get_string_representation_st_float_video_refresh_rate_auto(
double video_refresh_rate = 0.0;
double deviation = 0.0;
unsigned sample_points = 0;
gfx_animation_t *p_anim = anim_get_ptr();
if (!setting)
return;
@ -6834,7 +6835,7 @@ setting_get_string_representation_st_float_video_refresh_rate_auto(
{
snprintf(s, len, "%.3f Hz (%.1f%% dev, %u samples)",
video_refresh_rate, 100.0 * deviation, sample_points);
gfx_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
GFX_ANIMATION_SET_ACTIVE(p_anim);
}
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len);