gfx_display_draw_text - cleanups

This commit is contained in:
twinaphex 2020-06-25 23:45:14 +02:00
parent 2f235f0abb
commit 7027b094c1
4 changed files with 35 additions and 26 deletions

View File

@ -2226,10 +2226,10 @@ static void materialui_render_messagebox(materialui_handle_t *mui,
if (!string_is_empty(line)) if (!string_is_empty(line))
gfx_display_draw_text( gfx_display_draw_text(
mui->font_data.list.font, line, mui->font_data.list.font, line,
x - longest_width/2.0, x - longest_width / 2.0f,
y + (i * mui->font_data.list.line_height) + mui->font_data.list.line_ascender, y + (i * mui->font_data.list.line_height) + mui->font_data.list.line_ascender,
video_width, video_height, mui->colors.list_text, video_width, video_height, mui->colors.list_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, true); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f, true);
} }
end: end:
@ -3571,7 +3571,8 @@ static void materialui_render_menu_entry_default(
video_width, video_height, video_width, video_height,
(entry_selected || touch_feedback_active) ? (entry_selected || touch_feedback_active) ?
mui->colors.list_hint_text_highlighted : mui->colors.list_hint_text, mui->colors.list_hint_text_highlighted : mui->colors.list_hint_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, draw_text_outside || (sublabel_y < 0)); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f,
draw_text_outside || (sublabel_y < 0));
} }
else else
{ {
@ -3652,7 +3653,7 @@ static void materialui_render_menu_entry_default(
video_width, video_height, video_width, video_height,
(entry_selected || touch_feedback_active) ? (entry_selected || touch_feedback_active) ?
mui->colors.list_text_highlighted : mui->colors.list_text, mui->colors.list_text_highlighted : mui->colors.list_text,
TEXT_ALIGN_RIGHT, 1.0f, false, 0, draw_text_outside); TEXT_ALIGN_RIGHT, 1.0f, false, 0.0f, draw_text_outside);
} }
break; break;
case MUI_ENTRY_VALUE_SWITCH_ON: case MUI_ENTRY_VALUE_SWITCH_ON:
@ -3737,7 +3738,7 @@ static void materialui_render_menu_entry_default(
video_width, video_height, video_width, video_height,
(entry_selected || touch_feedback_active) ? (entry_selected || touch_feedback_active) ?
mui->colors.list_text_highlighted : mui->colors.list_text, mui->colors.list_text_highlighted : mui->colors.list_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, draw_text_outside); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f, draw_text_outside);
} }
} }
} }
@ -3890,7 +3891,8 @@ static void materialui_render_menu_entry_playlist_list(
video_width, video_height, video_width, video_height,
(entry_selected || touch_feedback_active) ? (entry_selected || touch_feedback_active) ?
mui->colors.list_hint_text_highlighted : mui->colors.list_hint_text, mui->colors.list_hint_text_highlighted : mui->colors.list_hint_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, draw_text_outside || (sublabel_y < 0)); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f,
draw_text_outside || (sublabel_y < 0));
} }
/* If we don't have a sublabel, entry label is drawn /* If we don't have a sublabel, entry label is drawn
* at the vertical centre of the current node */ * at the vertical centre of the current node */
@ -3934,7 +3936,8 @@ static void materialui_render_menu_entry_playlist_list(
video_width, video_height, video_width, video_height,
(entry_selected || touch_feedback_active) ? (entry_selected || touch_feedback_active) ?
mui->colors.list_text_highlighted : mui->colors.list_text, mui->colors.list_text_highlighted : mui->colors.list_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, draw_text_outside); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f,
draw_text_outside);
} }
} }
@ -4095,7 +4098,8 @@ static void materialui_render_menu_entry_playlist_dual_icon(
video_width, video_height, video_width, video_height,
(entry_selected || touch_feedback_active) ? (entry_selected || touch_feedback_active) ?
mui->colors.list_text_highlighted : mui->colors.list_text, mui->colors.list_text_highlighted : mui->colors.list_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, draw_text_outside); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f,
draw_text_outside);
} }
} }
@ -4188,7 +4192,8 @@ static void materialui_render_menu_entry_playlist_desktop(
video_width, video_height, video_width, video_height,
(entry_selected || touch_feedback_active) ? (entry_selected || touch_feedback_active) ?
mui->colors.list_text_highlighted : mui->colors.list_text, mui->colors.list_text_highlighted : mui->colors.list_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, draw_text_outside); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f,
draw_text_outside);
} }
} }
@ -4453,7 +4458,8 @@ static void materialui_render_selected_entry_aux_playlist_desktop(
(float)mui->font_data.hint.line_centre_offset, (float)mui->font_data.hint.line_centre_offset,
video_width, video_height, video_width, video_height,
text_color, text_color,
TEXT_ALIGN_LEFT, 1.0f, false, 0, draw_text_outside); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f,
draw_text_outside);
} }
} }
} }
@ -4976,7 +4982,8 @@ static void materialui_render_header(
mui->sys_bar_cache.battery_percent_str, mui->sys_bar_cache.battery_percent_str,
(int)video_width - ((int)mui->sys_bar_cache.battery_percent_width + (int)mui->sys_bar_margin + (int)mui->nav_bar_layout_width), (int)video_width - ((int)mui->sys_bar_cache.battery_percent_width + (int)mui->sys_bar_margin + (int)mui->nav_bar_layout_width),
sys_bar_text_y, sys_bar_text_y,
video_width, video_height, mui->colors.sys_bar_text, TEXT_ALIGN_LEFT, 1.0f, false, 0, false); video_width, video_height, mui->colors.sys_bar_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0.0f, false);
sys_bar_battery_width = mui->sys_bar_cache.battery_percent_width + sys_bar_battery_width = mui->sys_bar_cache.battery_percent_width +
mui->sys_bar_margin + mui->sys_bar_icon_size; mui->sys_bar_margin + mui->sys_bar_icon_size;
@ -5034,7 +5041,7 @@ static void materialui_render_header(
+ (int)mui->nav_bar_layout_width), + (int)mui->nav_bar_layout_width),
sys_bar_text_y, sys_bar_text_y,
video_width, video_height, mui->colors.sys_bar_text, video_width, video_height, mui->colors.sys_bar_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0, false); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f, false);
usable_sys_bar_width -= sys_bar_clock_width; usable_sys_bar_width -= sys_bar_clock_width;
} }
@ -5080,7 +5087,8 @@ static void materialui_render_header(
gfx_display_draw_text(mui->font_data.hint.font, core_title_buf, gfx_display_draw_text(mui->font_data.hint.font, core_title_buf,
(int)mui->ticker_x_offset + (int)mui->sys_bar_margin, (int)mui->ticker_x_offset + (int)mui->sys_bar_margin,
sys_bar_text_y, sys_bar_text_y,
video_width, video_height, mui->colors.sys_bar_text, TEXT_ALIGN_LEFT, 1.0f, false, 0, false); video_width, video_height, mui->colors.sys_bar_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0.0f, false);
} }
/* Title bar items */ /* Title bar items */
@ -5224,7 +5232,8 @@ static void materialui_render_header(
gfx_display_draw_text(mui->font_data.title.font, menu_title_buf, gfx_display_draw_text(mui->font_data.title.font, menu_title_buf,
title_x, title_x,
(int)(mui->sys_bar_height + (mui->title_bar_height / 2.0f) + mui->font_data.title.line_centre_offset), (int)(mui->sys_bar_height + (mui->title_bar_height / 2.0f) + mui->font_data.title.line_centre_offset),
video_width, video_height, mui->colors.header_text, TEXT_ALIGN_LEFT, 1.0f, false, 0, false); video_width, video_height, mui->colors.header_text,
TEXT_ALIGN_LEFT, 1.0f, false, 0.0f, false);
} }
/* Use separate functions for bottom/right navigation /* Use separate functions for bottom/right navigation

View File

@ -120,7 +120,7 @@ void ozone_draw_text(
gfx_display_draw_text(font_data->font, str, x, y, gfx_display_draw_text(font_data->font, str, x, y,
width, height, color, text_align, 1.0f, width, height, color, text_align, 1.0f,
false, false,
1.0, draw_outside); 1.0f, draw_outside);
} }
static void ozone_draw_cursor_slice( static void ozone_draw_cursor_slice(

View File

@ -739,8 +739,8 @@ static void stripes_render_keyboard(
userdata, userdata,
video_width, video_width,
video_height, video_height,
video_width / 2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width, video_width / 2.0f - (11 * ptr_width) / 2.0f + (i % 11) * ptr_width,
video_height / 2.0 + ptr_height*1.5 + line_y, video_height / 2.0f + ptr_height * 1.5f + line_y,
ptr_width, ptr_height, ptr_width, ptr_height,
video_width, video_width,
video_height, video_height,
@ -751,14 +751,14 @@ static void stripes_render_keyboard(
} }
gfx_display_draw_text(stripes->font, grid[i], gfx_display_draw_text(stripes->font, grid[i],
video_width / 2.0 - (11*ptr_width)/2.0 + (i % 11) * ptr_width + ptr_width/2.0, video_width / 2.0f - (11 * ptr_width) / 2.0f + (i % 11) * ptr_width + ptr_width / 2.0f,
video_height / 2.0 + ptr_height + line_y + stripes->font->size / 3, video_height / 2.0f + ptr_height + line_y + stripes->font->size / 3,
video_width, video_width,
video_height, video_height,
0xffffffff, 0xffffffff,
TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER,
1.0f, 1.0f,
false, 0, false); false, 0.0f, false);
} }
} }
@ -857,7 +857,7 @@ static void stripes_render_messagebox_internal(
video_width, video_width,
video_height, video_height,
NULL, NULL,
stripes->margins_slice, 1.0, stripes->margins_slice, 1.0f,
stripes->textures.list[STRIPES_TEXTURE_DIALOG_SLICE]); stripes->textures.list[STRIPES_TEXTURE_DIALOG_SLICE]);
for (i = 0; i < list->size; i++) for (i = 0; i < list->size; i++)
@ -866,13 +866,13 @@ static void stripes_render_messagebox_internal(
if (msg) if (msg)
gfx_display_draw_text(stripes->font, msg, gfx_display_draw_text(stripes->font, msg,
x - longest_width/2.0, x - longest_width / 2.0f,
y + (i+0.75) * line_height, y + (i + 0.75f) * line_height,
video_width, video_width,
video_height, video_height,
0x444444ff, 0x444444ff,
TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT,
1.0f, false, 0, false); 1.0f, false, 0.0f, false);
} }
if (menu_input_dialog_get_display_kb()) if (menu_input_dialog_get_display_kb())

View File

@ -979,7 +979,7 @@ static void xmb_render_messagebox_internal(
x - longest_width/2.0, x - longest_width/2.0,
y + (i+0.75) * line_height, y + (i+0.75) * line_height,
video_width, video_height, 0x444444ff, video_width, video_height, 0x444444ff,
TEXT_ALIGN_LEFT, 1.0f, false, 0, false); TEXT_ALIGN_LEFT, 1.0f, false, 0.0f, false);
} }
if (menu_input_dialog_get_display_kb()) if (menu_input_dialog_get_display_kb())