(Gfx widgets) get rid of this early return - already done outside

This commit is contained in:
twinaphex 2020-06-07 23:26:37 +02:00
parent 6b5e9a3224
commit 797d3f871c
3 changed files with 14 additions and 21 deletions

View File

@ -35,16 +35,17 @@ static gfx_widget_generic_message_state_t p_w_generic_message_st = {
{'\0'} {'\0'}
}; };
static gfx_widget_generic_message_state_t* gfx_widget_generic_message_get_ptr() static gfx_widget_generic_message_state_t* gfx_widget_generic_message_get_ptr(void)
{ {
return &p_w_generic_message_st; return &p_w_generic_message_st;
} }
static void gfx_widget_generic_message_fadeout(void *userdata) static void gfx_widget_generic_message_fadeout(void *userdata)
{ {
gfx_widget_generic_message_state_t* state = gfx_widget_generic_message_get_ptr();
gfx_animation_ctx_entry_t entry; gfx_animation_ctx_entry_t entry;
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer; gfx_widget_generic_message_state_t* state =
gfx_widget_generic_message_get_ptr();
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
/* Start fade out animation */ /* Start fade out animation */
entry.cb = NULL; entry.cb = NULL;
@ -60,12 +61,10 @@ static void gfx_widget_generic_message_fadeout(void *userdata)
void gfx_widget_set_message(char *msg) void gfx_widget_set_message(char *msg)
{ {
gfx_widget_generic_message_state_t* state = gfx_widget_generic_message_get_ptr();
gfx_timer_ctx_entry_t timer; gfx_timer_ctx_entry_t timer;
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer; gfx_widget_generic_message_state_t* state =
gfx_widget_generic_message_get_ptr();
if (!gfx_widgets_active()) gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
return;
strlcpy(state->message, msg, sizeof(state->message)); strlcpy(state->message, msg, sizeof(state->message));
@ -84,7 +83,8 @@ void gfx_widget_set_message(char *msg)
static void gfx_widget_generic_message_frame(void* data) static void gfx_widget_generic_message_frame(void* data)
{ {
gfx_widget_generic_message_state_t* state = gfx_widget_generic_message_get_ptr(); gfx_widget_generic_message_state_t* state =
gfx_widget_generic_message_get_ptr();
if (state->alpha > 0.0f) if (state->alpha > 0.0f)
{ {

View File

@ -63,13 +63,10 @@ static void gfx_widget_libretro_message_fadeout(void *userdata)
void gfx_widget_set_libretro_message(const char *msg, unsigned duration) void gfx_widget_set_libretro_message(const char *msg, unsigned duration)
{ {
gfx_timer_ctx_entry_t timer;
gfx_widget_libretro_message_state_t* state = gfx_widget_libretro_message_get_state(); gfx_widget_libretro_message_state_t* state = gfx_widget_libretro_message_get_state();
gfx_animation_ctx_tag tag = (uintptr_t) &state->timer; gfx_animation_ctx_tag tag = (uintptr_t) &state->timer;
gfx_widget_font_data_t* font_regular = gfx_widgets_get_font_regular(); gfx_widget_font_data_t* font_regular = gfx_widgets_get_font_regular();
gfx_timer_ctx_entry_t timer;
if (!gfx_widgets_active())
return;
strlcpy(state->message, msg, sizeof(state->message)); strlcpy(state->message, msg, sizeof(state->message));

View File

@ -106,12 +106,7 @@ static void gfx_widgets_play_screenshot_flash(void)
void gfx_widget_screenshot_taken(const char *shotname, const char *filename) void gfx_widget_screenshot_taken(const char *shotname, const char *filename)
{ {
gfx_widget_screenshot_state_t* state = NULL; gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
if (!gfx_widgets_active())
return;
state = gfx_widget_screenshot_get_ptr();
gfx_widgets_play_screenshot_flash(); gfx_widgets_play_screenshot_flash();
strlcpy(state->filename, filename, sizeof(state->filename)); strlcpy(state->filename, filename, sizeof(state->filename));
strlcpy(state->shotname, shotname, sizeof(state->shotname)); strlcpy(state->shotname, shotname, sizeof(state->shotname));
@ -127,8 +122,8 @@ static void gfx_widget_screenshot_dispose(void *userdata)
static void gfx_widget_screenshot_end(void *userdata) static void gfx_widget_screenshot_end(void *userdata)
{ {
gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
gfx_animation_ctx_entry_t entry; gfx_animation_ctx_entry_t entry;
gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
entry.cb = gfx_widget_screenshot_dispose; entry.cb = gfx_widget_screenshot_dispose;
entry.duration = MSG_QUEUE_ANIMATION_DURATION; entry.duration = MSG_QUEUE_ANIMATION_DURATION;
@ -230,7 +225,8 @@ static void gfx_widget_screenshot_frame(void* data)
} }
} }
static void gfx_widget_screenshot_iterate(unsigned width, unsigned height, bool fullscreen, static void gfx_widget_screenshot_iterate(unsigned width,
unsigned height, bool fullscreen,
const char *dir_assets, char *font_path, const char *dir_assets, char *font_path,
bool is_threaded) bool is_threaded)
{ {