From 1e6828fd636584f68abdf277e57522b8031a5e66 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 30 Sep 2020 19:18:40 +0200 Subject: [PATCH] Cleanups --- gfx/gfx_widgets.c | 6 ------ gfx/gfx_widgets.h | 2 -- gfx/widgets/gfx_widget_load_content_animation.c | 12 ++++++------ gfx/widgets/gfx_widget_progress_message.c | 6 +++--- gfx/widgets/gfx_widget_screenshot.c | 4 ++-- gfx/widgets/gfx_widget_volume.c | 6 ++++-- 6 files changed, 15 insertions(+), 21 deletions(-) diff --git a/gfx/gfx_widgets.c b/gfx/gfx_widgets.c index 39582f3351..a44a8cc076 100644 --- a/gfx/gfx_widgets.c +++ b/gfx/gfx_widgets.c @@ -100,12 +100,6 @@ static void gfx_widgets_free(dispgfx_widget_t *p_dispwidget); static void gfx_widgets_layout(dispgfx_widget_t *p_dispwidget, bool is_threaded, const char *dir_assets, char *font_path); -gfx_widget_font_data_t* gfx_widgets_get_font_regular(void *data) -{ - dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data; - return &p_dispwidget->gfx_widget_fonts.regular; -} - gfx_widget_font_data_t* gfx_widgets_get_font_bold(void *data) { dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data; diff --git a/gfx/gfx_widgets.h b/gfx/gfx_widgets.h index f80ae93e23..23dac00a09 100644 --- a/gfx/gfx_widgets.h +++ b/gfx/gfx_widgets.h @@ -276,8 +276,6 @@ unsigned gfx_widgets_get_divider_width(void *data); unsigned gfx_widgets_get_height(void *data); -gfx_widget_font_data_t* gfx_widgets_get_font_regular(void *data); - gfx_widget_font_data_t* gfx_widgets_get_font_bold(void *data); gfx_widget_font_data_t* gfx_widgets_get_font_msg_queue(void *data); diff --git a/gfx/widgets/gfx_widget_load_content_animation.c b/gfx/widgets/gfx_widget_load_content_animation.c index 0af6671473..9cad164c05 100644 --- a/gfx/widgets/gfx_widget_load_content_animation.c +++ b/gfx/widgets/gfx_widget_load_content_animation.c @@ -531,8 +531,8 @@ static void gfx_widget_load_content_animation_layout( unsigned last_video_height = gfx_widgets_get_last_video_height(p_dispwidget); unsigned widget_padding = gfx_widgets_get_padding(p_dispwidget); - gfx_widget_font_data_t *font_regular = gfx_widgets_get_font_regular(p_dispwidget); - gfx_widget_font_data_t *font_bold = gfx_widgets_get_font_bold(p_dispwidget); + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; + gfx_widget_font_data_t *font_bold = &p_dispwidget->gfx_widget_fonts.bold; /* Icon layout */ state->icon_size = (unsigned)((((float)font_regular->line_height + @@ -587,8 +587,8 @@ static void gfx_widget_load_content_animation_iterate(void *user_data, unsigned last_video_width = gfx_widgets_get_last_video_width(p_dispwidget); unsigned widget_padding = gfx_widgets_get_padding(p_dispwidget); - gfx_widget_font_data_t *font_regular = gfx_widgets_get_font_regular(p_dispwidget); - gfx_widget_font_data_t *font_bold = gfx_widgets_get_font_bold(p_dispwidget); + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; + gfx_widget_font_data_t *font_bold = &p_dispwidget->gfx_widget_fonts.bold; uintptr_t alpha_tag = (uintptr_t)&state->alpha; @@ -663,8 +663,8 @@ static void gfx_widget_load_content_animation_frame(void *data, void *user_data) unsigned video_height = video_info->height; void *userdata = video_info->userdata; - gfx_widget_font_data_t *font_regular = gfx_widgets_get_font_regular(p_dispwidget); - gfx_widget_font_data_t *font_bold = gfx_widgets_get_font_bold(p_dispwidget); + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; + gfx_widget_font_data_t *font_bold = &p_dispwidget->gfx_widget_fonts.bold; size_t msg_queue_size = gfx_widgets_get_msg_queue_size(p_dispwidget); gfx_display_t *p_disp = disp_get_ptr(); gfx_display_ctx_driver_t *dispctx = p_disp->dispctx; diff --git a/gfx/widgets/gfx_widget_progress_message.c b/gfx/widgets/gfx_widget_progress_message.c index 5b40e338f1..a45b0a1872 100644 --- a/gfx/widgets/gfx_widget_progress_message.c +++ b/gfx/widgets/gfx_widget_progress_message.c @@ -134,7 +134,7 @@ void gfx_widget_set_progress_message(void *data, gfx_timer_ctx_entry_t timer; dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data; gfx_widget_progress_message_state_t *state = gfx_widget_progress_message_get_ptr(); - gfx_widget_font_data_t *font_regular = gfx_widgets_get_font_regular(p_dispwidget); + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; uintptr_t alpha_tag = (uintptr_t)&state->alpha; /* Ensure we have a valid message string */ @@ -188,7 +188,7 @@ static void gfx_widget_progress_message_layout( unsigned last_video_width = gfx_widgets_get_last_video_width(p_dispwidget); unsigned last_video_height = gfx_widgets_get_last_video_height(p_dispwidget); unsigned widget_padding = gfx_widgets_get_padding(p_dispwidget); - gfx_widget_font_data_t *font_regular = gfx_widgets_get_font_regular(p_dispwidget); + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; /* Base widget layout */ state->widget_width = last_video_width; @@ -235,7 +235,7 @@ static void gfx_widget_progress_message_frame(void *data, void *user_data) float *backdrop_color = gfx_widgets_get_backdrop_orig(); unsigned text_color = COLOR_TEXT_ALPHA(0xFFFFFFFF, (unsigned)(state->alpha * 255.0f)); - gfx_widget_font_data_t *font_regular = gfx_widgets_get_font_regular(p_dispwidget); + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; size_t msg_queue_size = gfx_widgets_get_msg_queue_size(p_dispwidget); unsigned bar_width = state->bar_max_width; diff --git a/gfx/widgets/gfx_widget_screenshot.c b/gfx/widgets/gfx_widget_screenshot.c index f252fe86b2..7460dad45e 100644 --- a/gfx/widgets/gfx_widget_screenshot.c +++ b/gfx/widgets/gfx_widget_screenshot.c @@ -209,7 +209,7 @@ static void gfx_widget_screenshot_frame(void* data, void *user_data) unsigned video_height = video_info->height; dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)user_data; gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr(); - gfx_widget_font_data_t* font_regular = gfx_widgets_get_font_regular(p_dispwidget); + gfx_widget_font_data_t* font_regular = &p_dispwidget->gfx_widget_fonts.regular; int padding = (state->height - (font_regular->line_height * 2.0f)) / 2.0f; /* Screenshot */ @@ -293,7 +293,7 @@ static void gfx_widget_screenshot_iterate( dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)user_data; gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr(); unsigned padding = gfx_widgets_get_padding(p_dispwidget); - gfx_widget_font_data_t* font_regular = gfx_widgets_get_font_regular(p_dispwidget); + gfx_widget_font_data_t* font_regular = &p_dispwidget->gfx_widget_fonts.regular; /* Load screenshot and start its animation */ if (state->filename[0] != '\0') diff --git a/gfx/widgets/gfx_widget_volume.c b/gfx/widgets/gfx_widget_volume.c index b7f53096e2..4cd978b954 100644 --- a/gfx/widgets/gfx_widget_volume.c +++ b/gfx/widgets/gfx_widget_volume.c @@ -101,7 +101,8 @@ static void gfx_widget_volume_frame(void* data, void *user_data) char msg[255]; char percentage_msg[255]; video_frame_info_t *video_info = (video_frame_info_t*)data; - gfx_widget_font_data_t* font_regular = gfx_widgets_get_font_regular(user_data); + dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)user_data; + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; void *userdata = video_info->userdata; unsigned video_width = video_info->width; @@ -316,7 +317,8 @@ static void gfx_widget_volume_layout( { gfx_widget_volume_state_t* state = gfx_widget_volume_get_ptr(); unsigned last_video_width = gfx_widgets_get_last_video_width(data); - gfx_widget_font_data_t* font_regular = gfx_widgets_get_font_regular(data); + dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data; + gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; state->widget_height = font_regular->line_height * 4; state->widget_width = state->widget_height * 4;