]> granicus.if.org Git - libass/commitdiff
Fix karaoke (\kf) timing
authorGrigori Goronzy <greg@blackbox>
Tue, 30 Jun 2009 11:10:03 +0000 (13:10 +0200)
committerGrigori Goronzy <greg@blackbox>
Tue, 30 Jun 2009 11:10:03 +0000 (13:10 +0200)
The timing for the \kf karaoke which gradually fills the character from
left to right, uses clipping and isn't aware of subpixel accuracy.  This
is simply fixed by casting these value to int.

libass/ass_render.c

index df695ead391742901ba22930fcf937bcdfe5879c..fd790f7cc8e6872747e85efc1e435f9d5fa7d1b0 100644 (file)
@@ -2142,8 +2142,8 @@ static void process_karaoke_effects(ass_renderer_t *render_priv)
                 x_start = 1000000;
                 x_end = -1000000;
                 for (cur2 = s1; cur2 <= e1; ++cur2) {
-                    x_start = FFMIN(x_start, cur2->bbox.xMin + cur2->pos.x);
-                    x_end = FFMAX(x_end, cur2->bbox.xMax + cur2->pos.x);
+                    x_start = FFMIN(x_start, d6_to_int(cur2->bbox.xMin + cur2->pos.x));
+                    x_end = FFMAX(x_end, d6_to_int(cur2->bbox.xMax + cur2->pos.x));
                 }
 
                 dt = (tm_current - tm_start);
@@ -2164,7 +2164,7 @@ static void process_karaoke_effects(ass_renderer_t *render_priv)
 
                 for (cur2 = s1; cur2 <= e1; ++cur2) {
                     cur2->effect_type = s1->effect_type;
-                    cur2->effect_timing = x - cur2->pos.x;
+                    cur2->effect_timing = x - d6_to_int(cur2->pos.x);
                 }
             }
         }