diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-24 02:29:38 +0300 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-27 01:24:26 +0200 |
commit | 53feabddc038b03bd7cd3b1e24f93e18a3de35a8 (patch) | |
tree | 00adf222b6870bf95896fd9469736820fa260d42 | |
parent | 512444c15e69a78ae82a8e9ff0e7bdef9f93bbcf (diff) | |
download | libass-53feabddc038b03bd7cd3b1e24f93e18a3de35a8.tar.bz2 libass-53feabddc038b03bd7cd3b1e24f93e18a3de35a8.tar.xz |
process_karaoke_effects: honor info->skip in \kf calculations
This mainly affects trimmed trailing whitespace.
-rw-r--r-- | libass/ass_parse.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c index 9107545..2e35e2b 100644 --- a/libass/ass_parse.c +++ b/libass/ass_parse.c @@ -1010,8 +1010,14 @@ void process_karaoke_effects(ASS_Renderer *render_priv) else if (tm_current >= tm_end) x = 100000000; else { - int x_start = start->pos.x; - int x_end = end[-1].pos.x + end[-1].advance.x; + GlyphInfo *first_visible = start, *last_visible = end - 1; + while (first_visible < last_visible && first_visible->skip) + ++first_visible; + while (first_visible < last_visible && last_visible->skip) + --last_visible; + + int x_start = first_visible->pos.x; + int x_end = last_visible->pos.x + last_visible->advance.x; double dt = (double) (tm_current - tm_start) / (tm_end - tm_start); double frz = fmod(start->frz, 360); if (frz > 90 && frz < 270) { |