]> granicus.if.org Git - libass/commitdiff
Do not round karaoke timing coordinates
authorGrigori Goronzy <greg@blackbox>
Wed, 29 Jul 2009 19:33:29 +0000 (21:33 +0200)
committerGrigori Goronzy <greg@blackbox>
Wed, 29 Jul 2009 19:33:29 +0000 (21:33 +0200)
Do not round the coordinates of the glyph bbox (when converting 26.6
fixed-point to integer); they are used for timing karaoke.  Doing so
can sometimes make \k and \ko karaoke not apply correctly.

libass/ass_render.c

index 8c2a40815ed8f945f0bfb1db5d16a00ebafd9cb1..440099f4c56e684d96bce7a961290866223d1731 100644 (file)
@@ -891,7 +891,7 @@ static ass_image_t *render_text(ass_renderer_t *render_priv, int dst_x,
         bm = info->bm_o;
 
         if ((info->effect_type == EF_KARAOKE_KO)
-            && (info->effect_timing <= d6_to_int(info->bbox.xMax))) {
+            && (info->effect_timing <= (info->bbox.xMax >> 6))) {
             // do nothing
         } else {
             here_tail = tail;
@@ -916,7 +916,7 @@ static ass_image_t *render_text(ass_renderer_t *render_priv, int dst_x,
 
         if ((info->effect_type == EF_KARAOKE)
             || (info->effect_type == EF_KARAOKE_KO)) {
-            if (info->effect_timing > d6_to_int(info->bbox.xMax))
+            if (info->effect_timing > (info->bbox.xMax >> 6))
                 tail =
                     render_glyph(render_priv, bm, pen_x, pen_y,
                                  info->c[0], 0, 1000000, tail);