]> granicus.if.org Git - libass/commitdiff
Fix subpixel shift calculation for negative coordinates
authorGrigori Goronzy <greg@blackbox>
Sun, 28 Jun 2009 00:36:31 +0000 (02:36 +0200)
committerGrigori Goronzy <greg@blackbox>
Sun, 28 Jun 2009 00:36:31 +0000 (02:36 +0200)
The subpixel shift calculation was off in case the device coordinates
were negative.  This has been corrected and the calculation been
simplified.

libass/ass_render.c

index a9de0af5445ac6c61fe02fc31c64017525fca65f..2abb9d7fccc1b64a86be8da868050aa58c88401e 100644 (file)
@@ -2654,11 +2654,11 @@ ass_render_event(ass_renderer_t *render_priv, ass_event_t *event,
     for (i = 0; i < text_info->length; ++i) {
         glyph_info_t *g = text_info->glyphs + i;
         g->hash_key.advance.x =
-            (double_to_d6(device_x) & SUBPIXEL_MASK) + 
-            (g->pos.x & SUBPIXEL_MASK);
+            double_to_d6(device_x - (int) device_x +
+            d6_to_double(g->pos.x & SUBPIXEL_MASK));
         g->hash_key.advance.y = 
-            (double_to_d6(device_y) & SUBPIXEL_MASK) +
-            (g->pos.y & SUBPIXEL_MASK);
+            double_to_d6(device_y - (int) device_y +
+            d6_to_double(g->pos.y & SUBPIXEL_MASK));
         get_bitmap_glyph(render_priv, text_info->glyphs + i);
     }