Mercurial > mplayer.hg
changeset 20295:49865cf70233
Support separate rotation angle for each glyph.
author | eugeni |
---|---|
date | Wed, 18 Oct 2006 21:11:29 +0000 |
parents | 4d7c8478e523 |
children | 041a388f2182 |
files | libass/ass_render.c |
diffstat | 1 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libass/ass_render.c Wed Oct 18 18:33:19 2006 +0000 +++ b/libass/ass_render.c Wed Oct 18 21:11:29 2006 +0000 @@ -90,6 +90,7 @@ // int height; int be; // blur edges int shadow; + double frz; // z-axis rotation glyph_hash_key_t hash_key; } glyph_info_t; @@ -1714,6 +1715,7 @@ text_info.glyphs[text_info.length].desc = get_face_descender(render_context.face); text_info.glyphs[text_info.length].be = render_context.be; text_info.glyphs[text_info.length].shadow = render_context.shadow; + text_info.glyphs[text_info.length].frz = render_context.rotation; text_info.length++; @@ -1854,16 +1856,11 @@ } // rotate glyphs if needed - if (render_context.rotation != 0.) { - double angle = render_context.rotation; + { + double angle = 0.; FT_Vector center; FT_Matrix matrix_rotate; - matrix_rotate.xx = (FT_Fixed)( cos( angle ) * 0x10000L ); - matrix_rotate.xy = (FT_Fixed)( -sin( angle ) * 0x10000L ); - matrix_rotate.yx = (FT_Fixed)( sin( angle ) * 0x10000L ); - matrix_rotate.yy = (FT_Fixed)( cos( angle ) * 0x10000L ); - if (((render_context.org_x != 0) || (render_context.org_y != 0)) && (render_context.evt_type == EVENT_POSITIONED)) { center.x = render_context.org_x; center.y = render_context.org_y; @@ -1879,13 +1876,23 @@ } for (i = 0; i < text_info.length; ++i) { + FT_Vector start; + FT_Vector start_old; glyph_info_t* info = text_info.glyphs + i; + if (info->frz < 0.00001 && info->frz > -0.00001) + continue; + + if (info->frz != angle) { + angle = info->frz; + matrix_rotate.xx = (FT_Fixed)( cos( angle ) * 0x10000L ); + matrix_rotate.xy = (FT_Fixed)( -sin( angle ) * 0x10000L ); + matrix_rotate.yx = (FT_Fixed)( sin( angle ) * 0x10000L ); + matrix_rotate.yy = (FT_Fixed)( cos( angle ) * 0x10000L ); + } + // calculating shift vector // shift = (position - center)*M - (position - center) - FT_Vector start; - FT_Vector start_old; - start.x = (info->pos.x + device_x - center.x) << 6; start.y = - (info->pos.y + device_y - center.y) << 6; start_old.x = start.x;