From 9b7237a89b143558c77a9ef7a8ba71fffa6ee1fb Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Sun, 25 Oct 2020 03:29:38 +0200 Subject: process_karaoke_effects: reuse \kf logic for \k and \ko --- libass/ass_parse.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/libass/ass_parse.c b/libass/ass_parse.c index 9ab4ab8..6e0f6f3 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -1004,22 +1004,17 @@ void process_karaoke_effects(ASS_Renderer *render_priv) x_end = FFMAX(x_end, d6_to_int(info->bbox.x_max + info->pos.x)); } + if (effect_type != EF_KARAOKE_KF) + tm_end = tm_start; + int x; - if (effect_type == EF_KARAOKE || effect_type == EF_KARAOKE_KO) { - x = tm_current < tm_start ? x_start : x_end + 1; - } else if (effect_type == EF_KARAOKE_KF) { - if (tm_current < tm_start) - x = x_start; - else if (tm_current >= tm_end) - x = x_end + 1; - else { - double dt = (double) (tm_current - tm_start) / (tm_end - tm_start); - x = x_start + (x_end - x_start) * dt; - } - } else { - ass_msg(render_priv->library, MSGL_ERR, - "Unknown effect type"); - continue; + if (tm_current < tm_start) + x = x_start; + else if (tm_current >= tm_end) + x = x_end + 1; + else { + double dt = (double) (tm_current - tm_start) / (tm_end - tm_start); + x = x_start + (x_end - x_start) * dt; } for (GlyphInfo *info = start; info < end; info++) { -- cgit v1.2.3