Mercurial > mplayer.hg
comparison libass/ass_render.c @ 19370:cd9ece839751
Fix compilation with gcc 2.95.
Patch by Jason Tackaberry, tack at urandom dot ca.
author | eugeni |
---|---|
date | Sat, 12 Aug 2006 18:33:19 +0000 |
parents | 2ec2301183cd |
children | d9d58ba1b833 |
comparison
equal
deleted
inserted
replaced
19369:c97b028f0e6b | 19370:cd9ece839751 |
---|---|
1168 last_space = -1; | 1168 last_space = -1; |
1169 text_info.n_lines = 1; | 1169 text_info.n_lines = 1; |
1170 break_type = 0; | 1170 break_type = 0; |
1171 s1 = text_info.glyphs; // current line start | 1171 s1 = text_info.glyphs; // current line start |
1172 for (i = 0; i < text_info.length; ++i) { | 1172 for (i = 0; i < text_info.length; ++i) { |
1173 int break_at, s_offset, len; | |
1173 cur = text_info.glyphs + i; | 1174 cur = text_info.glyphs + i; |
1174 int break_at = -1; | 1175 break_at = -1; |
1175 int s_offset = s1->bbox.xMin + s1->pos.x; | 1176 s_offset = s1->bbox.xMin + s1->pos.x; |
1176 int len = (cur->bbox.xMax + cur->pos.x) - s_offset; | 1177 len = (cur->bbox.xMax + cur->pos.x) - s_offset; |
1177 | 1178 |
1178 if (cur->symbol == '\n') { | 1179 if (cur->symbol == '\n') { |
1179 break_type = 2; | 1180 break_type = 2; |
1180 break_at = i; | 1181 break_at = i; |
1181 mp_msg(MSGT_GLOBAL, MSGL_DBG2, "forced line break at %d\n", break_at); | 1182 mp_msg(MSGT_GLOBAL, MSGL_DBG2, "forced line break at %d\n", break_at); |
1531 | 1532 |
1532 // align text | 1533 // align text |
1533 last_break = -1; | 1534 last_break = -1; |
1534 for (i = 1; i < text_info.length + 1; ++i) { // (text_info.length + 1) is the end of the last line | 1535 for (i = 1; i < text_info.length + 1; ++i) { // (text_info.length + 1) is the end of the last line |
1535 if ((i == text_info.length) || text_info.glyphs[i].linebreak) { | 1536 if ((i == text_info.length) || text_info.glyphs[i].linebreak) { |
1536 | 1537 int width, shift; |
1537 glyph_info_t* first_glyph = text_info.glyphs + last_break + 1; | 1538 glyph_info_t* first_glyph = text_info.glyphs + last_break + 1; |
1538 glyph_info_t* last_glyph = text_info.glyphs + i - 1; | 1539 glyph_info_t* last_glyph = text_info.glyphs + i - 1; |
1539 | 1540 |
1540 while ((last_glyph >= first_glyph) && ((last_glyph->symbol == '\n') || (last_glyph->symbol == 0))) | 1541 while ((last_glyph >= first_glyph) && ((last_glyph->symbol == '\n') || (last_glyph->symbol == 0))) |
1541 last_glyph --; | 1542 last_glyph --; |
1542 | 1543 |
1543 int width = last_glyph->pos.x + last_glyph->bbox.xMax - first_glyph->pos.x - first_glyph->bbox.xMin; | 1544 width = last_glyph->pos.x + last_glyph->bbox.xMax - first_glyph->pos.x - first_glyph->bbox.xMin; |
1544 int shift = - first_glyph->bbox.xMin; // now text line starts exactly at 0 (left margin) | 1545 shift = - first_glyph->bbox.xMin; // now text line starts exactly at 0 (left margin) |
1545 if (halign == HALIGN_LEFT) { // left aligned, no action | 1546 if (halign == HALIGN_LEFT) { // left aligned, no action |
1546 } else if (halign == HALIGN_RIGHT) { // right aligned | 1547 } else if (halign == HALIGN_RIGHT) { // right aligned |
1547 shift = max_text_width - width; | 1548 shift = max_text_width - width; |
1548 } else if (halign == HALIGN_CENTER) { // centered | 1549 } else if (halign == HALIGN_CENTER) { // centered |
1549 shift = (max_text_width - width) / 2; | 1550 shift = (max_text_width - width) / 2; |