mirror of
https://github.com/libretro/RetroArch
synced 2024-07-05 09:48:42 +00:00
(gfx_animation.c) Small cleanups
This commit is contained in:
parent
57273faa5a
commit
a758b13fac
|
@ -1394,26 +1394,26 @@ static void build_ticker_loop_string(
|
|||
|
||||
static void build_line_ticker_string(
|
||||
size_t num_display_lines, size_t line_offset,
|
||||
struct string_list *lines,
|
||||
char *dest_str, size_t dest_str_len)
|
||||
struct string_list *lines, size_t lines_size,
|
||||
char *s, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < (num_display_lines-1); i++)
|
||||
{
|
||||
size_t offset = i + line_offset;
|
||||
size_t line_index = offset % (lines->size + 1);
|
||||
size_t line_index = offset % (lines_size + 1);
|
||||
/* Is line valid? */
|
||||
if (line_index < lines->size)
|
||||
strlcat(dest_str, lines->elems[line_index].data, dest_str_len);
|
||||
strlcat(dest_str, "\n", dest_str_len);
|
||||
if (line_index < lines_size)
|
||||
strlcat(s, lines->elems[line_index].data, len);
|
||||
strlcat(s, "\n", len);
|
||||
}
|
||||
{
|
||||
size_t offset = (num_display_lines-1) + line_offset;
|
||||
size_t line_index = offset % (lines->size + 1);
|
||||
size_t line_index = offset % (lines_size + 1);
|
||||
/* Is line valid? */
|
||||
if (line_index < lines->size)
|
||||
strlcat(dest_str, lines->elems[line_index].data, dest_str_len);
|
||||
if (line_index < lines_size)
|
||||
strlcat(s, lines->elems[line_index].data, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1898,15 +1898,15 @@ bool gfx_animation_line_ticker(gfx_animation_ctx_line_ticker_t *line_ticker)
|
|||
if (!line_ticker)
|
||||
return false;
|
||||
|
||||
if (string_is_empty(line_ticker->str) ||
|
||||
(line_ticker->line_len < 1) ||
|
||||
(line_ticker->max_lines < 1))
|
||||
if ( string_is_empty(line_ticker->str)
|
||||
|| (line_ticker->line_len < 1)
|
||||
|| (line_ticker->max_lines < 1))
|
||||
goto end;
|
||||
|
||||
/* Line wrap input string */
|
||||
line_ticker_str_len = strlen(line_ticker->str);
|
||||
wrapped_str_len = line_ticker_str_len + 1 + 10; /* 10 bytes use for inserting '\n' */
|
||||
if (!(wrapped_str = (char*)malloc(wrapped_str_len)))
|
||||
if (!(wrapped_str = (char*)malloc(wrapped_str_len)))
|
||||
goto end;
|
||||
wrapped_str[0] = '\0';
|
||||
|
||||
|
@ -1957,7 +1957,7 @@ bool gfx_animation_line_ticker(gfx_animation_ctx_line_ticker_t *line_ticker)
|
|||
|
||||
/* Build output string from required lines */
|
||||
build_line_ticker_string(
|
||||
line_ticker->max_lines, line_offset, &lines,
|
||||
line_ticker->max_lines, line_offset, &lines, lines.size,
|
||||
line_ticker->s, line_ticker->len);
|
||||
|
||||
success = true;
|
||||
|
@ -2136,7 +2136,7 @@ bool gfx_animation_line_ticker_smooth(gfx_animation_ctx_line_ticker_smooth_t *li
|
|||
|
||||
/* Build output string from required lines */
|
||||
build_line_ticker_string(
|
||||
num_display_lines, line_offset, &lines,
|
||||
num_display_lines, line_offset, &lines, lines.size,
|
||||
line_ticker->dst_str, line_ticker->dst_str_len);
|
||||
|
||||
/* Extract top/bottom fade strings, if required */
|
||||
|
@ -2146,11 +2146,11 @@ bool gfx_animation_line_ticker_smooth(gfx_animation_ctx_line_ticker_smooth_t *li
|
|||
* build_line_ticker_string() here, but it saves
|
||||
* rewriting a heap of code... */
|
||||
build_line_ticker_string(
|
||||
1, top_fade_line_offset, &lines,
|
||||
1, top_fade_line_offset, &lines, lines.size,
|
||||
line_ticker->top_fade_str, line_ticker->top_fade_str_len);
|
||||
|
||||
build_line_ticker_string(
|
||||
1, bottom_fade_line_offset, &lines,
|
||||
1, bottom_fade_line_offset, &lines, lines.size,
|
||||
line_ticker->bottom_fade_str, line_ticker->bottom_fade_str_len);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user