Mercurial > mplayer.hg
annotate libvo/sub.c @ 1569:fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
author | atlka |
---|---|
date | Fri, 17 Aug 2001 08:47:58 +0000 |
parents | 787c053b314c |
children | c394d04d6b30 |
rev | line source |
---|---|
218 | 1 |
2 #include "sub.h" | |
202 | 3 |
213 | 4 //static int vo_font_loaded=-1; |
5 font_desc_t* vo_font=NULL; | |
202 | 6 |
213 | 7 unsigned char* vo_osd_text="00:00:00"; |
803
b25a887b6054
sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents:
726
diff
changeset
|
8 int sub_unicode=0; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
9 int sub_utf8=0; |
213 | 10 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
11 inline static void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
12 unsigned char *cp=vo_osd_text; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
13 int c; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
14 int font; |
213 | 15 int y=10; |
16 int x=20; | |
202 | 17 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
18 while (*cp){ |
1549 | 19 c=*cp++; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
20 if ((font=vo_font->font[c])>=0) |
213 | 21 draw_alpha(x,y, |
22 vo_font->width[c], | |
23 vo_font->pic_a[font]->h, | |
24 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
25 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
26 vo_font->pic_a[font]->w); | |
27 x+=vo_font->width[c]+vo_font->charspace; | |
28 } | |
218 | 29 |
30 } | |
31 | |
32 int vo_osd_progbar_type=-1; | |
33 int vo_osd_progbar_value=100; // 0..255 | |
34 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
35 inline static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ |
218 | 36 int i; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
37 int y=(dys-vo_font->height)/2; |
218 | 38 int c,font; |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
39 int delimw=vo_font->width[OSD_PB_START] |
1549 | 40 +vo_font->width[OSD_PB_END] |
41 +vo_font->charspace; | |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
42 int width=(2*dxs-3*delimw)/3; |
1549 | 43 int charw=vo_font->width[OSD_PB_0]+vo_font->charspace; |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
44 int elems=width/charw; |
1549 | 45 int x=(dxs-elems*charw-delimw)/2; |
218 | 46 int mark=(vo_osd_progbar_value*(elems+1))>>8; |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
47 |
218 | 48 // printf("osd.progbar width=%d xpos=%d\n",width,x); |
49 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
50 c=vo_osd_progbar_type; |
1569
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
51 if(vo_osd_progbar_type>0 && (font=vo_font->font[c])>=0) { |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
52 int xp=x-vo_font->width[c]-vo_font->spacewidth; |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
53 draw_alpha((xp<0?0:xp),y, |
218 | 54 vo_font->width[c], |
55 vo_font->pic_a[font]->h, | |
56 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
57 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
58 vo_font->pic_a[font]->w); | |
1569
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
59 } |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
60 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
61 c=OSD_PB_START; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
62 if ((font=vo_font->font[c])>=0) |
218 | 63 draw_alpha(x,y, |
64 vo_font->width[c], | |
65 vo_font->pic_a[font]->h, | |
66 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
67 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
68 vo_font->pic_a[font]->w); | |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
69 x+=vo_font->width[c]+vo_font->charspace; |
218 | 70 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
71 c=OSD_PB_0; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
72 if ((font=vo_font->font[c])>=0) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
73 for (i=mark;i--;){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
74 draw_alpha(x,y, |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
75 vo_font->width[c], |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
76 vo_font->pic_a[font]->h, |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
77 vo_font->pic_b[font]->bmp+vo_font->start[c], |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
78 vo_font->pic_a[font]->bmp+vo_font->start[c], |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
79 vo_font->pic_a[font]->w); |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
80 x+=charw; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
81 } |
202 | 82 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
83 c=OSD_PB_1; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
84 if ((font=vo_font->font[c])>=0) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
85 for (i=elems-mark;i--;){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
86 draw_alpha(x,y, |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
87 vo_font->width[c], |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
88 vo_font->pic_a[font]->h, |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
89 vo_font->pic_b[font]->bmp+vo_font->start[c], |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
90 vo_font->pic_a[font]->bmp+vo_font->start[c], |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
91 vo_font->pic_a[font]->w); |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
92 x+=charw; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
93 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
94 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
95 c=OSD_PB_END; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
96 if ((font=vo_font->font[c])>=0) |
218 | 97 draw_alpha(x,y, |
98 vo_font->width[c], | |
99 vo_font->pic_a[font]->h, | |
100 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
101 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
102 vo_font->pic_a[font]->w); | |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
103 // x+=vo_font->width[c]+vo_font->charspace; |
803
b25a887b6054
sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents:
726
diff
changeset
|
104 |
218 | 105 |
106 // vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF; | |
107 | |
108 } | |
109 | |
254 | 110 subtitle* vo_sub=NULL; |
218 | 111 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
112 #define MAX_UCS 1600 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
113 #define MAX_UCSLINES 16 |
218 | 114 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
115 inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
116 static int utbl[MAX_UCS+1]; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
117 static int xtbl[MAX_UCSLINES]; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
118 static int lines; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
119 static subtitle *memsub=NULL; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
120 static int memy; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
121 static int memdxs; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
122 static int memdys; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
123 unsigned char *t; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
124 int i; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
125 int j; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
126 int k; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
127 int l; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
128 int x; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
129 int y; |
803
b25a887b6054
sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents:
726
diff
changeset
|
130 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
131 int c; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
132 int len; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
133 int line; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
134 int font; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
135 int lastStripPosition; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
136 int xsize; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
137 int lastxsize; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
138 int lastk; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
139 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
140 if ((memsub!=vo_sub)||(memdxs!=dxs)||(memdys!=dys)){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
141 memsub=vo_sub; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
142 memdxs=dxs; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
143 memdys=dys; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
144 |
1524 | 145 memy=dys-vo_font->height/2; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
146 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
147 // too long lines divide into smaller ones |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
148 i=k=lines=0; l=vo_sub->lines; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
149 while (l--){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
150 t=vo_sub->text[i++]; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
151 len=strlen(t)-1; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
152 xsize=lastxsize=-vo_font->charspace; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
153 lastStripPosition=-1; |
803
b25a887b6054
sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents:
726
diff
changeset
|
154 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
155 for (j=0;j<=len;j++){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
156 if ((c=t[j])>=0x80){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
157 if (sub_unicode) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
158 c = (c<<8) + t[++j]; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
159 else |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
160 if (sub_utf8){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
161 if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
162 c = (c & 0x1f)<<6 | (t[++j] & 0x3f); |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
163 else if((c & 0xf0) == 0xe0)/* 3 bytes U+00800..U+00FFFF*/ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
164 c = ((c & 0x0f)<<6 | |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
165 (t[++j] & 0x3f))<<6 | (t[++j] & 0x3f); |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
166 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
167 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
168 if (k==MAX_UCS){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
169 utbl[k]=l=0; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
170 break; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
171 } else |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
172 utbl[k++]=c; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
173 if (c==' '){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
174 lastk=k; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
175 lastStripPosition=j; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
176 lastxsize=xsize; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
177 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
178 xsize+=vo_font->width[c]+vo_font->charspace; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
179 if (dxs<xsize && lastStripPosition>0){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
180 j=lastStripPosition; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
181 k=lastk; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
182 } else if (j==len){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
183 lastxsize=xsize; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
184 } else |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
185 continue; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
186 utbl[k++]=0; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
187 xtbl[lines++]=(dxs-lastxsize)/2; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
188 if (lines==MAX_UCSLINES||k>MAX_UCS){ |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
189 l=0; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
190 break; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
191 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
192 memy-=vo_font->height; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
193 xsize=lastxsize=-vo_font->charspace; |
803
b25a887b6054
sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents:
726
diff
changeset
|
194 } |
213 | 195 } |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
196 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
197 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
198 y = memy; |
202 | 199 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
200 k=i=0; l=lines; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
201 while (l--){ |
1569
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
202 if (y>=0){ |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
203 x= xtbl[i++]; |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
204 while ((c=utbl[k++])){ |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
205 if (x>=0 && x+vo_font->width[c]<=dxs) |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
206 if ((font=vo_font->font[c])>=0) |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
207 draw_alpha(x,y, |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
208 vo_font->width[c], |
1524 | 209 // vo_font->pic_a[font]->h, |
1569
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
210 (y+vo_font->pic_a[font]->h<=dys)?vo_font->pic_a[font]->h:dys-y, |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
211 vo_font->pic_b[font]->bmp+vo_font->start[c], |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
212 vo_font->pic_a[font]->bmp+vo_font->start[c], |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
213 vo_font->pic_a[font]->w); |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
214 x+=vo_font->width[c]+vo_font->charspace; |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
215 } |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
216 } else { |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
217 while (utbl[k++]) ; // skip lines with negative y value |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
218 i++; // seldom case but who know ;-) |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
219 } |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
220 y+=vo_font->height; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
221 } |
218 | 222 } |
223 | |
1569
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
224 |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
225 |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
226 static int draw_alpha_init_flag=0; |
218 | 227 |
1109 | 228 extern void vo_draw_alpha_init(); |
229 | |
218 | 230 void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ |
231 | |
232 if(!vo_font) return; // no font | |
233 | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
234 if(!draw_alpha_init_flag){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
235 draw_alpha_init_flag=1; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
236 vo_draw_alpha_init(); |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
237 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
238 |
218 | 239 if(vo_osd_text){ |
240 vo_draw_text_osd(dxs,dys,draw_alpha); | |
241 } | |
242 | |
254 | 243 if(vo_sub){ |
218 | 244 vo_draw_text_sub(dxs,dys,draw_alpha); |
245 } | |
246 | |
247 if(vo_osd_progbar_type>=0){ | |
248 vo_draw_text_progbar(dxs,dys,draw_alpha); | |
249 } | |
213 | 250 |
202 | 251 } |