diff --git a/menu/drivers/ozone/ozone_display.c b/menu/drivers/ozone/ozone_display.c index 68d3153eca..b8e45da8a1 100644 --- a/menu/drivers/ozone/ozone_display.c +++ b/menu/drivers/ozone/ozone_display.c @@ -46,15 +46,16 @@ static float ozone_osk_backdrop[16] = { static void ozone_cursor_animation_cb(void *userdata); -static void ozone_animate_cursor(ozone_handle_t *ozone, float *dst, float *target) +static void ozone_animate_cursor(ozone_handle_t *ozone, + float *dst, float *target) { - gfx_animation_ctx_entry_t entry; int i; + gfx_animation_ctx_entry_t entry; entry.easing_enum = EASING_OUT_QUAD; - entry.tag = (uintptr_t) &ozone_default_theme; - entry.duration = ANIMATION_CURSOR_PULSE; - entry.userdata = ozone; + entry.tag = (uintptr_t)&ozone_default_theme; + entry.duration = ANIMATION_CURSOR_PULSE; + entry.userdata = ozone; for (i = 0; i < 16; i++) { @@ -75,10 +76,9 @@ static void ozone_animate_cursor(ozone_handle_t *ozone, float *dst, float *targe static void ozone_cursor_animation_cb(void *userdata) { + float *target = NULL; ozone_handle_t *ozone = (ozone_handle_t*) userdata; - float *target = NULL; - switch (ozone->theme_dynamic_cursor_state) { case 0: @@ -89,7 +89,8 @@ static void ozone_cursor_animation_cb(void *userdata) break; } - ozone->theme_dynamic_cursor_state = (ozone->theme_dynamic_cursor_state + 1) % 2; + ozone->theme_dynamic_cursor_state = + (ozone->theme_dynamic_cursor_state + 1) % 2; ozone_animate_cursor(ozone, ozone->theme_dynamic.cursor_border, target); } @@ -239,10 +240,14 @@ void ozone_restart_cursor_animation(ozone_handle_t *ozone) return; ozone->theme_dynamic_cursor_state = 1; - memcpy(ozone->theme_dynamic.cursor_border, ozone->theme->cursor_border_0, sizeof(ozone->theme_dynamic.cursor_border)); + memcpy(ozone->theme_dynamic.cursor_border, + ozone->theme->cursor_border_0, + sizeof(ozone->theme_dynamic.cursor_border)); gfx_animation_kill_by_tag(&tag); - ozone_animate_cursor(ozone, ozone->theme_dynamic.cursor_border, ozone->theme->cursor_border_1); + ozone_animate_cursor(ozone, + ozone->theme_dynamic.cursor_border, + ozone->theme->cursor_border_1); } void ozone_draw_text( @@ -361,22 +366,20 @@ void ozone_draw_osk(ozone_handle_t *ozone, const char *text; char message[2048]; unsigned text_color; - struct string_list *list= NULL; - - float scale_factor = ozone->last_scale_factor; - unsigned margin = 75 * scale_factor; - unsigned padding = 10 * scale_factor; - unsigned bottom_end = video_height / 2; - unsigned y_offset = 0; - bool draw_placeholder = string_is_empty(str); - - retro_time_t current_time = menu_driver_get_current_time(); static retro_time_t last_time = 0; + struct string_list *list = NULL; + float scale_factor = ozone->last_scale_factor; + unsigned margin = 75 * scale_factor; + unsigned padding = 10 * scale_factor; + unsigned bottom_end = video_height / 2; + unsigned y_offset = 0; + bool draw_placeholder = string_is_empty(str); + retro_time_t current_time = menu_driver_get_current_time(); if (current_time - last_time >= INTERVAL_OSK_CURSOR) { - ozone->osk_cursor = !ozone->osk_cursor; - last_time = current_time; + ozone->osk_cursor = !ozone->osk_cursor; + last_time = current_time; } /* Border */ @@ -476,13 +479,23 @@ void ozone_draw_osk(ozone_handle_t *ozone, { if (ozone->osk_cursor) { - unsigned cursor_x = draw_placeholder ? 0 : font_driver_get_message_width(ozone->fonts.entries_label.font, msg, (unsigned)strlen(msg), 1); + unsigned cursor_x = draw_placeholder + ? 0 + : font_driver_get_message_width( + ozone->fonts.entries_label.font, msg, + (unsigned)strlen(msg), 1); gfx_display_draw_quad( userdata, video_width, video_height, - margin + padding*2 + cursor_x, - margin + padding + y_offset + ozone->fonts.entries_label.line_height - ozone->fonts.entries_label.line_ascender + ozone->dimensions.spacer_3px, + margin + + padding * 2 + + cursor_x, + margin + + padding + + y_offset + + ozone->fonts.entries_label.line_height - ozone->fonts.entries_label.line_ascender + + ozone->dimensions.spacer_3px, ozone->dimensions.spacer_1px, ozone->fonts.entries_label.line_ascender, video_width, @@ -518,21 +531,21 @@ void ozone_draw_messagebox( const char *message) { unsigned i, y_position; + char wrapped_message[MENU_SUBLABEL_MAX_LENGTH]; int x, y, longest_width = 0; int usable_width = 0; struct string_list *list = NULL; float scale_factor = 0.0f; unsigned width = video_width; unsigned height = video_height; - char wrapped_message[MENU_SUBLABEL_MAX_LENGTH]; - wrapped_message[0] = '\0'; + wrapped_message[0] = '\0'; /* Sanity check */ if (string_is_empty(message) || !ozone || !ozone->fonts.footer.font) - goto end; + return; scale_factor = ozone->last_scale_factor; usable_width = (int)width - (48 * 8 * scale_factor);