Mercurial > mplayer.hg
comparison libass/ass_render.c @ 23027:b4db05aea29e
Fill bitmap_hash_key during parsing stage, call get_bitmap_glyph() much later.
author | eugeni |
---|---|
date | Fri, 20 Apr 2007 23:16:29 +0000 |
parents | 91076557ab81 |
children | 57f56d8e182e |
comparison
equal
deleted
inserted
replaced
23026:91076557ab81 | 23027:b4db05aea29e |
---|---|
1275 * \param symbol ucs4 char | 1275 * \param symbol ucs4 char |
1276 * \param info out: struct filled with extracted data | 1276 * \param info out: struct filled with extracted data |
1277 * \param advance advance vector of the extracted glyph | 1277 * \param advance advance vector of the extracted glyph |
1278 * \return 0 on success | 1278 * \return 0 on success |
1279 */ | 1279 */ |
1280 static void get_bitmap_glyph(int symbol, glyph_info_t* info, FT_Vector* advance) | 1280 static void get_bitmap_glyph(glyph_info_t* info) |
1281 { | 1281 { |
1282 bitmap_hash_val_t* val; | 1282 bitmap_hash_val_t* val; |
1283 bitmap_hash_key_t* key = &(info->hash_key); | 1283 bitmap_hash_key_t* key = &(info->hash_key); |
1284 | 1284 |
1285 key->font = render_context.font; | |
1286 key->size = render_context.font_size; | |
1287 key->ch = symbol; | |
1288 key->outline = (render_context.border * 0xFFFF); // convert to 16.16 | |
1289 key->scale_x = (render_context.scale_x * 0xFFFF); | |
1290 key->scale_y = (render_context.scale_y * 0xFFFF); | |
1291 key->frx = (render_context.frx * 0xFFFF); | |
1292 key->fry = (render_context.fry * 0xFFFF); | |
1293 key->frz = (render_context.frz * 0xFFFF); | |
1294 key->advance = *advance; | |
1295 key->bold = render_context.bold; | |
1296 key->italic = render_context.italic; | |
1297 key->be = render_context.be; | |
1298 | |
1299 val = cache_find_bitmap(key); | 1285 val = cache_find_bitmap(key); |
1300 /* val = 0; */ | 1286 /* val = 0; */ |
1301 | 1287 |
1302 if (val) { | 1288 if (val) { |
1303 info->bm = val->bm; | 1289 info->bm = val->bm; |
1758 | 1744 |
1759 ass_font_set_transform(render_context.font, &matrix, &shift ); | 1745 ass_font_set_transform(render_context.font, &matrix, &shift ); |
1760 } | 1746 } |
1761 | 1747 |
1762 get_outline_glyph(code, text_info.glyphs + text_info.length, &shift); | 1748 get_outline_glyph(code, text_info.glyphs + text_info.length, &shift); |
1763 get_bitmap_glyph(code, text_info.glyphs + text_info.length, &shift); | |
1764 | 1749 |
1765 text_info.glyphs[text_info.length].pos.x = pen.x >> 6; | 1750 text_info.glyphs[text_info.length].pos.x = pen.x >> 6; |
1766 text_info.glyphs[text_info.length].pos.y = pen.y >> 6; | 1751 text_info.glyphs[text_info.length].pos.y = pen.y >> 6; |
1767 | 1752 |
1768 pen.x += text_info.glyphs[text_info.length].advance.x; | 1753 pen.x += text_info.glyphs[text_info.length].advance.x; |
1789 ass_font_get_asc_desc(render_context.font, code, | 1774 ass_font_get_asc_desc(render_context.font, code, |
1790 &text_info.glyphs[text_info.length].asc, | 1775 &text_info.glyphs[text_info.length].asc, |
1791 &text_info.glyphs[text_info.length].desc); | 1776 &text_info.glyphs[text_info.length].desc); |
1792 text_info.glyphs[text_info.length].asc *= render_context.scale_y; | 1777 text_info.glyphs[text_info.length].asc *= render_context.scale_y; |
1793 text_info.glyphs[text_info.length].desc *= render_context.scale_y; | 1778 text_info.glyphs[text_info.length].desc *= render_context.scale_y; |
1779 | |
1780 // fill bitmap_hash_key | |
1781 text_info.glyphs[text_info.length].hash_key.font = render_context.font; | |
1782 text_info.glyphs[text_info.length].hash_key.size = render_context.font_size; | |
1783 text_info.glyphs[text_info.length].hash_key.outline = render_context.border * 0xFFFF; | |
1784 text_info.glyphs[text_info.length].hash_key.scale_x = render_context.scale_x * 0xFFFF; | |
1785 text_info.glyphs[text_info.length].hash_key.scale_y = render_context.scale_y * 0xFFFF; | |
1786 text_info.glyphs[text_info.length].hash_key.frx = render_context.frx * 0xFFFF; | |
1787 text_info.glyphs[text_info.length].hash_key.fry = render_context.fry * 0xFFFF; | |
1788 text_info.glyphs[text_info.length].hash_key.frz = render_context.frz * 0xFFFF; | |
1789 text_info.glyphs[text_info.length].hash_key.bold = render_context.bold; | |
1790 text_info.glyphs[text_info.length].hash_key.italic = render_context.italic; | |
1791 text_info.glyphs[text_info.length].hash_key.ch = code; | |
1792 text_info.glyphs[text_info.length].hash_key.advance = shift; | |
1793 text_info.glyphs[text_info.length].hash_key.be = render_context.be; | |
1794 | 1794 |
1795 text_info.length++; | 1795 text_info.length++; |
1796 | 1796 |
1797 render_context.effect_type = EF_NONE; | 1797 render_context.effect_type = EF_NONE; |
1798 render_context.effect_timing = 0; | 1798 render_context.effect_timing = 0; |
1923 } | 1923 } |
1924 } else if (render_context.evt_type == EVENT_POSITIONED) { | 1924 } else if (render_context.evt_type == EVENT_POSITIONED) { |
1925 render_context.clip_y0 = y2scr(render_context.clip_y0); | 1925 render_context.clip_y0 = y2scr(render_context.clip_y0); |
1926 render_context.clip_y1 = y2scr(render_context.clip_y1); | 1926 render_context.clip_y1 = y2scr(render_context.clip_y1); |
1927 } | 1927 } |
1928 | |
1929 for (i = 0; i < text_info.length; ++i) | |
1930 get_bitmap_glyph(text_info.glyphs + i); | |
1928 | 1931 |
1929 // rotate glyphs if needed | 1932 // rotate glyphs if needed |
1930 { | 1933 { |
1931 FT_Vector center; | 1934 FT_Vector center; |
1932 | 1935 |