From 88307565c1e888a4f1ddf1ea40809dcf41019712 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 25 Sep 2015 23:39:02 +0200 Subject: [PATCH] Refactor away menu_animation_clear_active --- menu/drivers/rgui.c | 2 +- menu/drivers/xmb.c | 2 +- menu/menu_animation.c | 14 ++++++-------- menu/menu_animation.h | 3 +-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 87e52484c9..d2f9ee4ee8 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -453,8 +453,8 @@ static void rgui_render(void) } menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL); + menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL); - menu_animation_clear_active(); rgui->force_redraw = false; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index a4f6bbe8e9..1bc0363290 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1444,7 +1444,7 @@ static void xmb_render(void) if (menu_entries_get_start() >= end) menu_entries_set_start(0); - menu_animation_clear_active(); + menu_animation_ctl(MENU_ANIMATION_CTL_CLEAR_ACTIVE, NULL); } static void xmb_frame_horizontal_list(xmb_handle_t *xmb, diff --git a/menu/menu_animation.c b/menu/menu_animation.c index 1d2c27125d..76ef0f18f4 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -678,22 +678,20 @@ void menu_animation_set_active(void) anim->is_active = true; } -void menu_animation_clear_active(void) -{ - menu_animation_t *anim = menu_animation_get_ptr(); - if (!anim) - return; - anim->is_active = false; -} - bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data) { menu_animation_t *anim = menu_animation_get_ptr(); + if (!anim) + return false; + switch (state) { case MENU_ANIMATION_CTL_IS_ACTIVE: return anim->is_active; + case MENU_ANIMATION_CTL_CLEAR_ACTIVE: + anim->is_active = false; + return true; case MENU_ANIMATION_CTL_DELTA_TIME: { float *ptr = (float*)data; diff --git a/menu/menu_animation.h b/menu/menu_animation.h index fc88390577..29cfbf2e69 100644 --- a/menu/menu_animation.h +++ b/menu/menu_animation.h @@ -37,6 +37,7 @@ typedef void (*tween_cb) (void); enum menu_animation_ctl_state { MENU_ANIMATION_CTL_IS_ACTIVE = 0, + MENU_ANIMATION_CTL_CLEAR_ACTIVE, MENU_ANIMATION_CTL_DELTA_TIME }; @@ -116,8 +117,6 @@ void menu_animation_update_time(void); void menu_animation_set_active(void); -void menu_animation_clear_active(void); - bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data); #ifdef __cplusplus