mirror of
https://github.com/libretro/RetroArch
synced 2025-03-17 10:21:26 +00:00
Merge pull request #10714 from jdgleaver/glui-divider-fix
(GLUI) Fix rendering of last on-screen entry divider in thumbnail views
This commit is contained in:
commit
434f046244
@ -3418,7 +3418,6 @@ static void materialui_render_menu_entry_default(
|
||||
materialui_node_t *node,
|
||||
menu_entry_t *entry,
|
||||
bool entry_selected,
|
||||
bool entry_is_last,
|
||||
bool touch_feedback_active,
|
||||
unsigned header_height,
|
||||
int x_offset)
|
||||
@ -3743,7 +3742,6 @@ static void materialui_render_menu_entry_playlist_list(
|
||||
materialui_node_t *node,
|
||||
menu_entry_t *entry,
|
||||
bool entry_selected,
|
||||
bool entry_is_last,
|
||||
bool touch_feedback_active,
|
||||
unsigned header_height,
|
||||
int x_offset)
|
||||
@ -3752,10 +3750,12 @@ static void materialui_render_menu_entry_playlist_list(
|
||||
const char *entry_sublabel = NULL;
|
||||
int entry_x = x_offset + node->x;
|
||||
int entry_y = header_height - mui->scroll_y + node->y;
|
||||
int divider_y = entry_y + (int)node->entry_height;
|
||||
int entry_margin = (int)mui->margin;
|
||||
int usable_width = (int)node->entry_width - (int)(mui->margin * 2);
|
||||
int label_y = 0;
|
||||
bool draw_text_outside = (x_offset != 0);
|
||||
bool draw_divider;
|
||||
|
||||
/* Initial ticker configuration
|
||||
* > Note: ticker is only used for labels,
|
||||
@ -3932,16 +3932,23 @@ static void materialui_render_menu_entry_playlist_list(
|
||||
* We can partially mitigate the visual 'emptiness' of this
|
||||
* by drawing a divider between entries. This is particularly
|
||||
* beneficial when dual thumbnails are enabled, since it
|
||||
* 'ties' the left/right thumbnails together */
|
||||
if (!entry_is_last &&
|
||||
(mui->list_view_type != MUI_LIST_VIEW_PLAYLIST) &&
|
||||
(usable_width > 0))
|
||||
* 'ties' the left/right thumbnails together
|
||||
* > To prevent any ugly alignment issues, we
|
||||
* only draw a divider if its bottom edge is
|
||||
* more than two times the divider thickness from
|
||||
* the bottom edge of the list region */
|
||||
draw_divider = (mui->list_view_type != MUI_LIST_VIEW_PLAYLIST) &&
|
||||
(usable_width > 0) &&
|
||||
((divider_y + (mui->entry_divider_width * 2)) <
|
||||
(video_height - mui->nav_bar_layout_height - mui->status_bar.height));
|
||||
|
||||
if (draw_divider)
|
||||
gfx_display_draw_quad(
|
||||
userdata,
|
||||
video_width,
|
||||
video_height,
|
||||
(float)(entry_x + entry_margin),
|
||||
entry_y + (float)node->entry_height,
|
||||
(float)divider_y,
|
||||
(unsigned)usable_width,
|
||||
mui->entry_divider_width,
|
||||
video_width,
|
||||
@ -3959,7 +3966,6 @@ static void materialui_render_menu_entry_playlist_dual_icon(
|
||||
materialui_node_t *node,
|
||||
menu_entry_t *entry,
|
||||
bool entry_selected,
|
||||
bool entry_is_last,
|
||||
bool touch_feedback_active,
|
||||
unsigned header_height,
|
||||
int x_offset)
|
||||
@ -3968,7 +3974,17 @@ static void materialui_render_menu_entry_playlist_dual_icon(
|
||||
float entry_x = (float)x_offset + node->x;
|
||||
float entry_y = (float)header_height - mui->scroll_y + node->y;
|
||||
int usable_width = (int)node->entry_width - (int)(mui->margin * 2);
|
||||
float thumbnail_y;
|
||||
float thumbnail_y = entry_y + ((float)mui->dip_base_unit_size / 10.0f);
|
||||
float divider_y = thumbnail_y + (float)mui->thumbnail_height_max +
|
||||
((float)mui->dip_base_unit_size / 10.0f) +
|
||||
(float)mui->font_data.list.line_height;
|
||||
/* To prevent any ugly alignment issues, we
|
||||
* only draw a divider if its bottom edge is
|
||||
* more than two times the divider thickness from
|
||||
* the bottom edge of the list region */
|
||||
bool draw_divider = (usable_width > 0) &&
|
||||
((divider_y + (mui->entry_divider_width * 2)) <
|
||||
(video_height - mui->nav_bar_layout_height - mui->status_bar.height));
|
||||
|
||||
/* Initial ticker configuration
|
||||
* > Note: ticker is only used for labels */
|
||||
@ -3986,7 +4002,6 @@ static void materialui_render_menu_entry_playlist_dual_icon(
|
||||
/* Draw thumbnails
|
||||
* > These go at the top of the entry, with a
|
||||
* small vertical margin */
|
||||
thumbnail_y = entry_y + ((float)mui->dip_base_unit_size / 10.0f);
|
||||
|
||||
/* > Primary thumbnail */
|
||||
materialui_draw_thumbnail(
|
||||
@ -4073,15 +4088,13 @@ static void materialui_render_menu_entry_playlist_dual_icon(
|
||||
}
|
||||
|
||||
/* Draw divider */
|
||||
if (!entry_is_last && (usable_width > 0))
|
||||
if (draw_divider)
|
||||
gfx_display_draw_quad(
|
||||
userdata,
|
||||
video_width,
|
||||
video_height,
|
||||
entry_x + (float)mui->margin,
|
||||
thumbnail_y + (float)mui->thumbnail_height_max +
|
||||
((float)mui->dip_base_unit_size / 10.0f) +
|
||||
(float)mui->font_data.list.line_height,
|
||||
divider_y,
|
||||
(unsigned)usable_width,
|
||||
mui->entry_divider_width,
|
||||
video_width,
|
||||
@ -4099,7 +4112,6 @@ static void materialui_render_menu_entry_playlist_desktop(
|
||||
materialui_node_t *node,
|
||||
menu_entry_t *entry,
|
||||
bool entry_selected,
|
||||
bool entry_is_last,
|
||||
bool touch_feedback_active,
|
||||
unsigned header_height,
|
||||
int x_offset)
|
||||
@ -4107,7 +4119,7 @@ static void materialui_render_menu_entry_playlist_desktop(
|
||||
const char *entry_label = NULL;
|
||||
int entry_x = x_offset + node->x;
|
||||
int entry_y = header_height - mui->scroll_y + node->y;
|
||||
int divider_y = entry_y + (float)node->entry_height;
|
||||
int divider_y = entry_y + (int)node->entry_height;
|
||||
int entry_margin = (int)mui->margin;
|
||||
int usable_width = node->entry_width - (int)(mui->margin * 2);
|
||||
/* Entry label is drawn at the vertical centre
|
||||
@ -4115,7 +4127,13 @@ static void materialui_render_menu_entry_playlist_desktop(
|
||||
int label_y = entry_y + (node->entry_height / 2.0f) +
|
||||
mui->font_data.list.line_centre_offset;
|
||||
bool draw_text_outside = (x_offset != 0);
|
||||
bool draw_divider = !entry_is_last;
|
||||
/* To prevent any ugly alignment issues, we
|
||||
* only draw a divider if its bottom edge is
|
||||
* more than two times the divider thickness from
|
||||
* the bottom edge of the list region */
|
||||
bool draw_divider = (usable_width > 0) &&
|
||||
((divider_y + (mui->entry_divider_width * 2)) <
|
||||
(video_height - mui->nav_bar_layout_height - mui->status_bar.height));
|
||||
|
||||
/* Read entry parameters */
|
||||
menu_entry_get_rich_label(entry, &entry_label);
|
||||
@ -4162,17 +4180,7 @@ static void materialui_render_menu_entry_playlist_desktop(
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw divider
|
||||
* > To prevent any ugly alignment issues, we
|
||||
* only draw a divider if its bottom edge is
|
||||
* more than two times the divider thickness from
|
||||
* the top edge of the status bar... */
|
||||
draw_divider = draw_divider && (usable_width > 0) &&
|
||||
(mui->status_bar.enabled ?
|
||||
((divider_y + (mui->entry_divider_width * 2)) <
|
||||
(video_height - mui->nav_bar_layout_height - mui->status_bar.height)) :
|
||||
true);
|
||||
|
||||
/* Draw divider */
|
||||
if (draw_divider)
|
||||
gfx_display_draw_quad(
|
||||
userdata,
|
||||
@ -4195,7 +4203,6 @@ static void (*materialui_render_menu_entry)(
|
||||
materialui_node_t *node,
|
||||
menu_entry_t *entry,
|
||||
bool entry_selected,
|
||||
bool entry_is_last,
|
||||
bool touch_feedback_active,
|
||||
unsigned header_height,
|
||||
int x_offset) = materialui_render_menu_entry_default;
|
||||
@ -4505,7 +4512,6 @@ static void materialui_render_menu_list(
|
||||
for (i = first_entry; i <= last_entry; i++)
|
||||
{
|
||||
bool entry_selected = (selection == i);
|
||||
bool entry_is_last = (i == last_entry);
|
||||
bool touch_feedback_active = touch_feedback_enabled && (mui->touch_feedback_selection == i);
|
||||
materialui_node_t *node = (materialui_node_t*)file_list_get_userdata_at_offset(list, i);
|
||||
menu_entry_t entry;
|
||||
@ -4530,7 +4536,6 @@ static void materialui_render_menu_list(
|
||||
node,
|
||||
&entry,
|
||||
entry_selected,
|
||||
entry_is_last,
|
||||
touch_feedback_active,
|
||||
header_height,
|
||||
x_offset);
|
||||
|
Loading…
x
Reference in New Issue
Block a user