This commit is contained in:
twinaphex 2020-09-30 19:18:40 +02:00
parent f8b828e623
commit 1e6828fd63
6 changed files with 15 additions and 21 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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')

View File

@ -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;