diff options
author | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-01 15:33:06 +0000 |
---|---|---|
committer | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-01 15:33:06 +0000 |
commit | f0ffc341b6236c9463be13e65149ad770632add9 (patch) | |
tree | 7efe7b3c7801e80e6b06c2aebffab2eaa02a981d | |
parent | 6319a4e08fba8cd8e0c2944cd137a5fe365fca21 (diff) |
Move glyph_to_bitmap() call and outline glyph deallocation to
get_bitmap_glyph().
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23195 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libass/ass_render.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c index 41f4ec206d..d877821106 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -387,42 +387,13 @@ static ass_image_t** render_glyph(bitmap_t* bm, int dst_x, int dst_y, uint32_t c static ass_image_t* render_text(text_info_t* text_info, int dst_x, int dst_y) { int pen_x, pen_y; - int i, error; + int i; bitmap_t* bm; - bitmap_hash_val_t hash_val; ass_image_t* head; ass_image_t** tail = &head; for (i = 0; i < text_info->length; ++i) { glyph_info_t* info = text_info->glyphs + i; - if (info->glyph && info->bm == 0) { - if ((info->symbol == '\n') || (info->symbol == 0)) - continue; - error = glyph_to_bitmap(ass_renderer->synth_priv, - info->glyph, info->outline_glyph, - &info->bm, &info->bm_o, - &info->bm_s, info->be); - if (error) - info->symbol = 0; - - // cache - hash_val.bm_o = info->bm_o; - hash_val.bm = info->bm; - hash_val.bm_s = info->bm_s; - cache_add_bitmap(&(info->hash_key), &hash_val); - } - } - - for (i = 0; i < text_info->length; ++i) { - glyph_info_t* info = text_info->glyphs + i; - if (info->glyph) - FT_Done_Glyph(info->glyph); - if (info->outline_glyph) - FT_Done_Glyph(info->outline_glyph); - } - - for (i = 0; i < text_info->length; ++i) { - glyph_info_t* info = text_info->glyphs + i; if ((info->symbol == 0) || (info->symbol == '\n') || !info->bm_s || (info->shadow == 0)) continue; @@ -1302,11 +1273,32 @@ static void get_bitmap_glyph(glyph_info_t* info) info->bm_s = val->bm_s; } else { FT_Vector shift; + bitmap_hash_val_t hash_val; + int error; info->bm = info->bm_o = info->bm_s = 0; + if (info->glyph && info->symbol != '\n' && info->symbol != 0) { // calculating shift vector shift.x = int_to_d6(info->hash_key.shift_x); shift.y = int_to_d6(info->hash_key.shift_y); transform_3d(shift, &info->glyph, &info->outline_glyph, info->frx, info->fry, info->frz); + + error = glyph_to_bitmap(ass_renderer->synth_priv, + info->glyph, info->outline_glyph, + &info->bm, &info->bm_o, + &info->bm_s, info->be); + if (error) + info->symbol = 0; + + // cache + hash_val.bm_o = info->bm_o; + hash_val.bm = info->bm; + hash_val.bm_s = info->bm_s; + cache_add_bitmap(&(info->hash_key), &hash_val); + } + if (info->glyph) + FT_Done_Glyph(info->glyph); + if (info->outline_glyph) + FT_Done_Glyph(info->outline_glyph); } } |