]> granicus.if.org Git - libass/commitdiff
Remove shift vector in ass_render_event
authorGrigori Goronzy <greg@blackbox>
Sat, 25 Jul 2009 01:59:58 +0000 (03:59 +0200)
committerGrigori Goronzy <greg@blackbox>
Sat, 25 Jul 2009 12:56:16 +0000 (14:56 +0200)
The shift is not calculated when fetching a glyph anymore.  Instead,
it is calculated right before rasterizing a glyph.  Remove the
shift vector and make get_outline_glyph, the glyph cache and
ass_font_set_transform work without supplying a shift vector.

libass/ass_cache_template.h
libass/ass_font.c
libass/ass_font.h
libass/ass_render.c

index eae980747bbfdc6abcb9fb7aa4b0d4991f9e50a8..d7eedafc32b58b49483e480e0f98cce57eb5bc54 100644 (file)
@@ -90,7 +90,6 @@ START(glyph, glyph_hash_key_s)
     GENERIC(int, italic)
     GENERIC(unsigned, scale_x) // 16.16
     GENERIC(unsigned, scale_y) // 16.16
-    FTVECTOR(advance) // subpixel shift vector
     FTVECTOR(outline) // border width, 16.16
     GENERIC(unsigned, drawing_hash) // hashcode of a drawing
     GENERIC(unsigned, flags)    // glyph decoration flags
index 9518b705eed3e9e1e69bd53af15fa59e1ff1c3fc..3502ef75a39cff31b2aba01a3867e3188b260bd8 100644 (file)
@@ -208,8 +208,10 @@ void ass_font_set_transform(ass_font_t *font, double scale_x,
 {
     font->scale_x = scale_x;
     font->scale_y = scale_y;
-    font->v.x = v->x;
-    font->v.y = v->y;
+    if (v) {
+        font->v.x = v->x;
+        font->v.y = v->y;
+    }
     update_transform(font);
 }
 
index 8fe4c1e650bd6b18bffa4880653b6a4f41b5a5d3..ecba15301412e79f60933d1c05147956f1dee9f1 100644 (file)
@@ -54,7 +54,7 @@ ass_font_t *ass_font_new(void *font_cache, ass_library_t *library,
                          FT_Library ftlibrary, void *fc_priv,
                          ass_font_desc_t *desc);
 void ass_font_set_transform(ass_font_t *font, double scale_x,
-                            double scale_y, FT_Vector * v);
+                            double scale_y, FT_Vector *v);
 void ass_font_set_size(ass_font_t *font, double size);
 void ass_font_get_asc_desc(ass_font_t *font, uint32_t ch, int *asc,
                            int *desc);
index 94556f973a8224a6f75904aee8fc572fd2c4992a..212a1581128219d375a6f6400973f4dbdd7edcfc 100644 (file)
@@ -2131,7 +2131,6 @@ static void stroke_outline_glyph(ass_renderer_t *render_priv,
  * \brief Get normal and outline (border) glyphs
  * \param symbol ucs4 char
  * \param info out: struct filled with extracted data
- * \param advance subpixel shift vector used for cache lookup
  * Tries to get both glyphs from cache.
  * If they can't be found, gets a glyph from font face, generates outline with FT_Stroker,
  * and add them to cache.
@@ -2139,8 +2138,7 @@ static void stroke_outline_glyph(ass_renderer_t *render_priv,
  */
 static void
 get_outline_glyph(ass_renderer_t *render_priv, int symbol,
-                  glyph_info_t *info, FT_Vector *advance,
-                  ass_drawing_t *drawing)
+                  glyph_info_t *info, ass_drawing_t *drawing)
 {
     glyph_hash_val_t *val;
     glyph_hash_key_t key;
@@ -2149,7 +2147,6 @@ get_outline_glyph(ass_renderer_t *render_priv, int symbol,
     if (drawing->hash) {
         key.scale_x = double_to_d16(render_priv->state.scale_x);
         key.scale_y = double_to_d16(render_priv->state.scale_y);
-        key.advance = *advance;
         key.outline.x = render_priv->state.border_x * 0xFFFF;
         key.outline.y = render_priv->state.border_y * 0xFFFF;
         key.drawing_hash = drawing->hash;
@@ -2161,7 +2158,6 @@ get_outline_glyph(ass_renderer_t *render_priv, int symbol,
         key.italic = render_priv->state.italic;
         key.scale_x = double_to_d16(render_priv->state.scale_x);
         key.scale_y = double_to_d16(render_priv->state.scale_y);
-        key.advance = *advance;
         key.outline.x = render_priv->state.border_x * 0xFFFF;
         key.outline.y = render_priv->state.border_y * 0xFFFF;
         key.flags = render_priv->state.flags;
@@ -2705,7 +2701,6 @@ ass_render_event(ass_renderer_t *render_priv, ass_event_t *event,
     unsigned code;
     double_bbox_t bbox;
     int i, j;
-    FT_Vector shift = { .x = 0, .y = 0};
     int MarginL, MarginR, MarginV;
     int last_break;
     int alignment, halign, valign;
@@ -2784,11 +2779,10 @@ ass_render_event(ass_renderer_t *render_priv, ass_event_t *event,
         ass_font_set_transform(render_priv->state.font,
                                render_priv->state.scale_x *
                                render_priv->font_scale_x,
-                               render_priv->state.scale_y, &shift);
+                               render_priv->state.scale_y, NULL);
 
         get_outline_glyph(render_priv, code,
-                          text_info->glyphs + text_info->length, &shift,
-                          drawing);
+                          text_info->glyphs + text_info->length, drawing);
 
         text_info->glyphs[text_info->length].pos.x = pen.x;
         text_info->glyphs[text_info->length].pos.y = pen.y;