(gfx_animation.c) Small cleanups

This commit is contained in:
libretroadmin 2024-07-24 09:25:59 +02:00
parent 6b8025fdca
commit ac85405598

View File

@ -396,20 +396,12 @@ static void ticker_smooth_scan_string_fw(
unsigned *char_offset, unsigned *num_chars_to_copy, unsigned *char_offset, unsigned *num_chars_to_copy,
unsigned *x_offset) unsigned *x_offset)
{ {
/* Initialise output variables to 'sane' values */
*num_chars_to_copy = 0;
/* Determine index of first character to copy */ /* Determine index of first character to copy */
if (scroll_offset > 0) if (scroll_offset > 0)
{ {
*char_offset = (scroll_offset / glyph_width) + 1; *char_offset = (scroll_offset / glyph_width) + 1;
*x_offset = glyph_width - (scroll_offset % glyph_width); *x_offset = glyph_width - (scroll_offset % glyph_width);
} }
else
{
*char_offset = 0;
*x_offset = 0;
}
/* Determine number of characters remaining in /* Determine number of characters remaining in
* string once offset has been subtracted */ * string once offset has been subtracted */
@ -510,6 +502,9 @@ static void gfx_animation_ticker_smooth_loop_fw(uint64_t idx,
unsigned scroll_offset = 0; unsigned scroll_offset = 0;
unsigned x_offset2 = 0; unsigned x_offset2 = 0;
*char_offset2 = 0;
*num_chars_to_copy2 = 0;
/* Check whether we've passed the end of string 1 */ /* Check whether we've passed the end of string 1 */
if (phase > str_width) if (phase > str_width)
scroll_offset = phase - str_width; scroll_offset = phase - str_width;
@ -1370,10 +1365,10 @@ bool gfx_animation_ticker_smooth(gfx_animation_ctx_ticker_smooth_t *ticker)
gfx_animation_t *p_anim = &anim_st; gfx_animation_t *p_anim = &anim_st;
/* Sanity check */ /* Sanity check */
if (string_is_empty(ticker->src_str) || if ( string_is_empty(ticker->src_str)
(ticker->dst_str_len < 1) || || (ticker->dst_str_len < 1)
(ticker->field_width < 1) || || (ticker->field_width < 1)
(!ticker->font && (ticker->glyph_width < 1))) || (!ticker->font && (ticker->glyph_width < 1)))
goto end; goto end;
/* If we are using a fixed width font (ticker->font == NULL), /* If we are using a fixed width font (ticker->font == NULL),