From e66e1081b432f163226170dae8f2b9ac2300bf15 Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Mon, 19 Oct 2020 01:51:11 +0300 Subject: process_karaoke_effects: place line at infinity except during \kf Fixes \k and \ko in https://github.com/libass/libass/issues/357. --- libass/ass_parse.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libass/ass_parse.c b/libass/ass_parse.c index 6e0f6f3..c0e2660 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -997,22 +997,21 @@ void process_karaoke_effects(ASS_Renderer *render_priv) int tm_end = tm_start + start->effect_timing; timing = tm_end; - int x_start = 1000000; - int x_end = -1000000; - for (GlyphInfo *info = start; info < end; info++) { - x_start = FFMIN(x_start, d6_to_int(info->bbox.x_min + info->pos.x)); - 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 (tm_current < tm_start) - x = x_start; + x = -1000000; else if (tm_current >= tm_end) - x = x_end + 1; + x = 1000000; else { + int x_start = 1000000; + int x_end = -1000000; + for (GlyphInfo *info = start; info < end; info++) { + x_start = FFMIN(x_start, d6_to_int(info->bbox.x_min + info->pos.x)); + x_end = FFMAX(x_end, d6_to_int(info->bbox.x_max + info->pos.x)); + } double dt = (double) (tm_current - tm_start) / (tm_end - tm_start); x = x_start + (x_end - x_start) * dt; } -- cgit v1.2.3