diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-25 03:29:38 +0200 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-27 01:24:12 +0200 |
commit | 9b7237a89b143558c77a9ef7a8ba71fffa6ee1fb (patch) | |
tree | 712b4765e798467eb6bf69ea64f48a810c195d63 | |
parent | 42aedd59dd650d4f8567c48ecd03eb78178a29da (diff) | |
download | libass-9b7237a89b143558c77a9ef7a8ba71fffa6ee1fb.tar.bz2 libass-9b7237a89b143558c77a9ef7a8ba71fffa6ee1fb.tar.xz |
process_karaoke_effects: reuse \kf logic for \k and \ko
-rw-r--r-- | libass/ass_parse.c | 25 |
1 files 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++) { |