[stripes] Remove most of draw_frame

This commit is contained in:
Jean-André Santoni 2018-04-08 13:31:19 +07:00
parent 7a7cb730c5
commit 65626c188a

View File

@ -2948,37 +2948,6 @@ static void stripes_frame(void *data, video_frame_info_t *video_info)
selection = menu_navigation_get_selection();
strlcpy(title_truncated,
stripes->title_name, sizeof(title_truncated));
if (selection > 1)
{
/* skip 25 utf8 multi-byte chars */
char *end = title_truncated;
for(i = 0; i < 25 && *end; i++)
{
end++;
while((*end & 0xC0) == 0x80)
end++;
}
*end = '\0';
}
/* Title text */
stripes_draw_text(video_info, stripes,
title_truncated, stripes->margins_title_left,
stripes->margins_title_top,
1, 1, TEXT_ALIGN_LEFT,
width, height, stripes->font);
if (settings->bools.menu_core_enable &&
menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0)
stripes_draw_text(video_info, stripes, title_msg, stripes->margins_title_left,
height - stripes->margins_title_bottom, 1, 1, TEXT_ALIGN_LEFT,
width, height, stripes->font);
rotate_draw.matrix = &mymat;
rotate_draw.rotation = 0;
rotate_draw.scale_x = 1;
@ -2989,357 +2958,6 @@ static void stripes_frame(void *data, video_frame_info_t *video_info)
menu_display_rotate_z(&rotate_draw, video_info);
menu_display_blend_begin(video_info);
/* Save State thumbnail, right side */
if (stripes->savestate_thumbnail)
{
stripes_draw_thumbnail(video_info,
stripes, &stripes_coord_white[0], width, height,
stripes->margins_screen_left * stripes_scale_mod[5] +
stripes->icon_spacing_horizontal + pseudo_font_length,
stripes->margins_screen_top + stripes->icon_size +
stripes->savestate_thumbnail_height * stripes_scale_mod[4],
stripes->savestate_thumbnail_width * stripes_scale_mod[4],
stripes->savestate_thumbnail_height * stripes_scale_mod[4],
stripes->savestate_thumbnail);
}
/* Right thumbnail big size */
if (!settings->bools.menu_xmb_vertical_thumbnails ||
(settings->bools.menu_xmb_vertical_thumbnails && !stripes->left_thumbnail))
{
/* Do not draw the right thumbnail if there is no space available */
if (((stripes->margins_screen_top +
stripes->icon_size + min_thumb_size) <= height) &&
((stripes->margins_screen_left * stripes_scale_mod[5] +
stripes->icon_spacing_horizontal +
pseudo_font_length + min_thumb_size) <= width))
{
if (stripes->thumbnail
&& !string_is_equal(stripes_thumbnails_ident('R'),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
{
/* Limit thumbnail width */
float thumb_width = 0.0f;
float thumb_height = 0.0f;
float thumb_max_width = (float)width - (stripes->icon_size / 6)
- (stripes->margins_screen_left * stripes_scale_mod[5]) -
stripes->icon_spacing_horizontal - pseudo_font_length;
#ifdef STRIPES_DEBUG
RARCH_LOG("[XMB thumbnail] width: %.2f, height: %.2f\n",
stripes->thumbnail_width, stripes->thumbnail_height);
RARCH_LOG("[XMB thumbnail] w: %.2f, h: %.2f\n", width, height);
#endif
if (stripes->thumbnail_width * stripes_scale_mod[4] > thumb_max_width)
{
thumb_width = (stripes->thumbnail_width * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->thumbnail_width * stripes_scale_mod[4]));
thumb_height = (stripes->thumbnail_height * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->thumbnail_width * stripes_scale_mod[4]));
}
else
{
thumb_width = stripes->thumbnail_width * stripes_scale_mod[4];
thumb_height = stripes->thumbnail_height * stripes_scale_mod[4];
}
/* Limit thumbnail height to screen height + margin. */
if (stripes->margins_screen_top + stripes->icon_size + thumb_height >=
((float)height * under_thumb_margin))
{
thumb_width = thumb_width *
((((float)height * under_thumb_margin) -
stripes->margins_screen_top - stripes->icon_size) /
thumb_height);
thumb_height = thumb_height *
((((float)height * under_thumb_margin) -
stripes->margins_screen_top - stripes->icon_size) /
thumb_height);
}
stripes_draw_thumbnail(video_info,
stripes, &stripes_coord_white[0], width, height,
(float)width - (stripes->icon_size / 6) - thumb_max_width +
((thumb_max_width - thumb_width) / 2),
stripes->margins_screen_top + stripes->icon_size + thumb_height,
thumb_width, thumb_height,
stripes->thumbnail);
}
}
}
/* Left thumbnail in the left margin */
/* Do not draw the left thumbnail if there is no space available */
if (!settings->bools.menu_xmb_vertical_thumbnails &&
(stripes->margins_screen_top + stripes->icon_size *
(!(stripes->depth == 1)? 2.1 : 1) + min_thumb_size)
<= (float)height)
{
/* Left Thumbnail in the left margin */
if (stripes->left_thumbnail
&& !string_is_equal(stripes_thumbnails_ident('L'),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
{
/* Limit left thumbnail width */
float left_thumb_width = 0.0f;
float left_thumb_height = 0.0f;
float thumb_max_width = stripes->icon_size * 3.4;
#ifdef STRIPES_DEBUG
RARCH_LOG("[XMB left thumbnail] width: %.2f, height: %.2f\n",
stripes->left_thumbnail_width, stripes->left_thumbnail_height);
RARCH_LOG("[XMB left thumbnail] w: %.2f, h: %.2f\n", width, height);
#endif
if (stripes->left_thumbnail_width * stripes_scale_mod[4] > thumb_max_width)
{
left_thumb_width = (stripes->left_thumbnail_width * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->left_thumbnail_width * stripes_scale_mod[4]));
left_thumb_height = (stripes->left_thumbnail_height * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->left_thumbnail_width * stripes_scale_mod[4]));
}
else
{
left_thumb_width = stripes->left_thumbnail_width * stripes_scale_mod[4];
left_thumb_height = stripes->left_thumbnail_height * stripes_scale_mod[4];
}
/* Limit left thumbnail height to screen height + margin. */
if (stripes->margins_screen_top + stripes->icon_size *
(!(stripes->depth == 1)? 2.1 : 1) +
left_thumb_height >=
((float)height - (96.0 * scale_factor)))
{
left_thumb_width = left_thumb_width *
((((float)height - (96.0 * scale_factor))
- stripes->margins_screen_top -
(stripes->icon_size * (!(stripes->depth == 1)? 2.1 : 1))) /
left_thumb_height);
left_thumb_height = left_thumb_height *
((((float)height - (96.0 * scale_factor))
- stripes->margins_screen_top -
(stripes->icon_size * (!(stripes->depth == 1)? 2.1 : 1))) /
left_thumb_height);
}
else
{
left_thumb_width = left_thumb_width;
left_thumb_height = left_thumb_height;
}
stripes_draw_thumbnail(video_info,
stripes, &stripes_coord_white[0], width, height,
(stripes->icon_size / 6) +
((thumb_max_width - left_thumb_width) / 2),
stripes->margins_screen_top + stripes->icon_size *
(!(stripes->depth == 1)? 2.1 : 1) + left_thumb_height,
left_thumb_width, left_thumb_height,
stripes->left_thumbnail);
}
}
/* No Right Thumbnail, draw only the left one big size */
if (settings->bools.menu_xmb_vertical_thumbnails && !stripes->thumbnail)
{
/* Do not draw the left thumbnail if there is no space available */
if (((stripes->margins_screen_top +
stripes->icon_size + min_thumb_size) <= height) &&
((stripes->margins_screen_left * stripes_scale_mod[5] +
stripes->icon_spacing_horizontal +
pseudo_font_length + min_thumb_size) <= width))
{
if (stripes->left_thumbnail
&& !string_is_equal(stripes_thumbnails_ident('L'),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
{
/* Limit left thumbnail width */
float left_thumb_width = 0.0f;
float left_thumb_height = 0.0f;
float thumb_max_width = (float)width - (stripes->icon_size / 6)
- (stripes->margins_screen_left * stripes_scale_mod[5]) -
stripes->icon_spacing_horizontal - pseudo_font_length;
#ifdef STRIPES_DEBUG
RARCH_LOG("[XMB thumbnail] width: %.2f, height: %.2f\n",
stripes->thumbnail_width, stripes->thumbnail_height);
RARCH_LOG("[XMB thumbnail] w: %.2f, h: %.2f\n", width, height);
#endif
if (stripes->left_thumbnail_width * stripes_scale_mod[4] > thumb_max_width)
{
left_thumb_width = (stripes->left_thumbnail_width * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->left_thumbnail_width * stripes_scale_mod[4]));
left_thumb_height = (stripes->left_thumbnail_height * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->left_thumbnail_width * stripes_scale_mod[4]));
}
else
{
left_thumb_width = stripes->left_thumbnail_width * stripes_scale_mod[4];
left_thumb_height = stripes->left_thumbnail_height * stripes_scale_mod[4];
}
/* Limit left thumbnail height to screen height + margin. */
if (stripes->margins_screen_top + stripes->icon_size + left_thumb_height >=
((float)height * under_thumb_margin))
{
left_thumb_width = left_thumb_width *
((((float)height * under_thumb_margin) -
stripes->margins_screen_top - stripes->icon_size) /
left_thumb_height);
left_thumb_height = left_thumb_height *
((((float)height * under_thumb_margin) -
stripes->margins_screen_top - stripes->icon_size) /
left_thumb_height);
}
stripes_draw_thumbnail(video_info,
stripes, &stripes_coord_white[0], width, height,
(float)width - (stripes->icon_size / 6) - thumb_max_width +
((thumb_max_width - left_thumb_width) / 2),
stripes->margins_screen_top + stripes->icon_size + left_thumb_height,
left_thumb_width, left_thumb_height,
stripes->left_thumbnail);
}
}
}
/* Clock image */
menu_display_set_alpha(stripes_coord_white, MIN(stripes->alpha, 1.00f));
if (video_info->battery_level_enable)
{
char msg[12];
static retro_time_t last_time = 0;
bool charging = false;
retro_time_t current_time = cpu_features_get_time_usec();
int percent = 0;
enum frontend_powerstate state = get_last_powerstate(&percent);
if (state == FRONTEND_POWERSTATE_CHARGING)
charging = true;
if (current_time - last_time >= BATTERY_LEVEL_CHECK_INTERVAL)
{
last_time = current_time;
task_push_get_powerstate();
}
*msg = '\0';
if (percent > 0)
{
size_t x_pos = stripes->icon_size / 6;
size_t x_pos_icon = stripes->margins_title_left;
if (stripes_coord_white[3] != 0)
stripes_draw_icon(video_info,
stripes->icon_size,
&mymat,
stripes->textures.list[charging
? STRIPES_TEXTURE_BATTERY_CHARGING : STRIPES_TEXTURE_BATTERY_FULL],
width - (stripes->icon_size / 2) - x_pos_icon,
stripes->icon_size,
width,
height,
1,
0,
1,
&stripes_coord_white[0],
stripes->shadow_offset);
snprintf(msg, sizeof(msg), "%d%%", percent);
percent_width = (unsigned)
font_driver_get_message_width(
stripes->font, msg, (unsigned)strlen(msg), 1);
stripes_draw_text(video_info, stripes, msg,
width - stripes->margins_title_left - x_pos,
stripes->margins_title_top, 1, 1, TEXT_ALIGN_RIGHT,
width, height, stripes->font);
}
}
if (video_info->timedate_enable)
{
menu_display_ctx_datetime_t datetime;
char timedate[255];
int x_pos = 0;
if (stripes_coord_white[3] != 0)
{
int x_pos = 0;
if (percent_width)
x_pos = percent_width + (stripes->icon_size / 2.5);
stripes_draw_icon(video_info,
stripes->icon_size,
&mymat,
stripes->textures.list[STRIPES_TEXTURE_CLOCK],
width - stripes->icon_size - x_pos,
stripes->icon_size,
width,
height,
1,
0,
1,
&stripes_coord_white[0],
stripes->shadow_offset);
}
timedate[0] = '\0';
datetime.s = timedate;
datetime.len = sizeof(timedate);
datetime.time_mode = 4;
menu_display_timedate(&datetime);
if (percent_width)
x_pos = percent_width + (stripes->icon_size / 2.5);
stripes_draw_text(video_info, stripes, timedate,
width - stripes->margins_title_left - stripes->icon_size / 4 - x_pos,
stripes->margins_title_top, 1, 1, TEXT_ALIGN_RIGHT,
width, height, stripes->font);
}
/* Arrow image */
menu_display_set_alpha(stripes_coord_white,
MIN(stripes->textures_arrow_alpha, stripes->alpha));
if (stripes_coord_white[3] != 0)
stripes_draw_icon(video_info,
stripes->icon_size,
&mymat,
stripes->textures.list[STRIPES_TEXTURE_ARROW],
stripes->x + stripes->margins_screen_left +
stripes->icon_spacing_horizontal -
stripes->icon_size / 2.0 + stripes->icon_size,
stripes->margins_screen_top +
stripes->icon_size / 2.0 + stripes->icon_spacing_vertical
* stripes->active_item_factor,
width,
height,
stripes->textures_arrow_alpha,
0,
1,
&stripes_coord_white[0],
stripes->shadow_offset);
menu_display_blend_begin(video_info);
/* Horizontal tab icons */
for (i = 0; i <= stripes_list_get_size(stripes, MENU_LIST_HORIZONTAL)
+ stripes->system_tab_end; i++)
@ -3390,139 +3008,6 @@ static void stripes_frame(void *data, video_frame_info_t *video_info)
}
}
/* Right side 2 thumbnails on top of each other */
/* here to be displayed above the horizontal icons */
if (stripes->left_thumbnail && stripes->thumbnail && settings->bools.menu_xmb_vertical_thumbnails)
{
/* Do not draw the right thumbnail if there is no space available */
if (((stripes->margins_screen_top +
stripes->icon_size + min_thumb_size) <= height) &&
((stripes->margins_screen_left * stripes_scale_mod[5] +
stripes->icon_spacing_horizontal +
pseudo_font_length + min_thumb_size) <= width))
{
if (stripes->thumbnail &&
!string_is_equal(stripes_thumbnails_ident('R'),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
{
/* Limit right thumbnail width */
float thumb_width = 0.0f;
float thumb_height = 0.0f;
float thumb_max_width = (float)width - (stripes->icon_size / 6) -
(stripes->margins_screen_left * stripes_scale_mod[5]) -
stripes->icon_spacing_horizontal - pseudo_font_length;
#ifdef STRIPES_DEBUG
RARCH_LOG("[XMB thumbnail] width: %.2f, height: %.2f\n",
stripes->thumbnail_width, stripes->thumbnail_height);
RARCH_LOG("[XMB thumbnail] w: %.2f, h: %.2f\n", width, height);
#endif
if (stripes->thumbnail_width * stripes_scale_mod[4] > thumb_max_width)
{
thumb_width = (stripes->thumbnail_width * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->thumbnail_width * stripes_scale_mod[4]));
thumb_height = (stripes->thumbnail_height * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->thumbnail_width * stripes_scale_mod[4]));
}
else
{
thumb_width = stripes->thumbnail_width * stripes_scale_mod[4];
thumb_height = stripes->thumbnail_height * stripes_scale_mod[4];
}
/* Limit right thumbnail height to usable area. */
if (thumb_height >=
((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2)
{
thumb_width = thumb_width *
((((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2) /
thumb_height);
thumb_height = thumb_height *
((((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2) /
thumb_height);
}
stripes_draw_thumbnail(video_info,
stripes, &stripes_coord_white[0], width, height,
(float)width - (stripes->icon_size / 6) - thumb_max_width +
((thumb_max_width - thumb_width) / 2),
stripes->icon_size + ((((float)height / 2 -
(stripes->icon_size + (stripes->icon_size/12))) - thumb_height) / 2) +
thumb_height,
thumb_width, thumb_height,
stripes->thumbnail);
}
}
/* Do not draw the left thumbnail if there is no space available */
if (((stripes->margins_screen_top +
stripes->icon_size + min_thumb_size) <= height) &&
((stripes->margins_screen_left * stripes_scale_mod[5] +
stripes->icon_spacing_horizontal +
pseudo_font_length + min_thumb_size) <= width))
{
if (stripes->left_thumbnail &&
!string_is_equal(stripes_thumbnails_ident('L'),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
{
/* Limit left thumbnail width */
float left_thumb_width = 0.0f;
float left_thumb_height = 0.0f;
float thumb_max_width = (float)width - (stripes->icon_size / 6) -
(stripes->margins_screen_left * stripes_scale_mod[5]) -
stripes->icon_spacing_horizontal - pseudo_font_length;
#ifdef STRIPES_DEBUG
RARCH_LOG("[XMB left thumbnail] width: %.2f, height: %.2f\n",
stripes->left_thumbnail_width, stripes->left_thumbnail_height);
RARCH_LOG("[XMB left thumbnail] w: %.2f, h: %.2f\n", width, height);
#endif
if (stripes->left_thumbnail_width * stripes_scale_mod[4] > thumb_max_width)
{
left_thumb_width = (stripes->left_thumbnail_width * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->left_thumbnail_width * stripes_scale_mod[4]));
left_thumb_height = (stripes->left_thumbnail_height * stripes_scale_mod[4]) *
(thumb_max_width / (stripes->left_thumbnail_width * stripes_scale_mod[4]));
}
else
{
left_thumb_width = stripes->left_thumbnail_width * stripes_scale_mod[4];
left_thumb_height = stripes->left_thumbnail_height * stripes_scale_mod[4];
}
/* Limit left thumbnail height to usable area. */
if (left_thumb_height >=
((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2)
{
left_thumb_width = left_thumb_width *
((((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2) /
left_thumb_height);
left_thumb_height = left_thumb_height *
((((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2) /
left_thumb_height);
}
stripes_draw_thumbnail(video_info,
stripes, &stripes_coord_white[0], width, height,
(float)width - (stripes->icon_size / 6) - thumb_max_width +
((thumb_max_width - left_thumb_width) / 2),
stripes->icon_size +
(((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2) +
(((((float)height - ((stripes->icon_size / 6) * 2) - stripes->icon_size) / 2) -
left_thumb_height) / 2) + left_thumb_height,
left_thumb_width, left_thumb_height,
stripes->left_thumbnail);
}
}
}
menu_display_blend_end(video_info);
/* Vertical icons */