annotate libvo/sub.c @ 1346:d6e6132bff35

AUDIO_ENCODING_LINEAR8 format is not available on sunos 5.5. Format is unsupported in mplayer for now, to get the code compiled on that old version of the OS.
author jkeil
date Thu, 19 Jul 2001 20:04:54 +0000
parents a013b2124f05
children d40f2b686846
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
1
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
2 #include "sub.h"
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
3
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
4 //static int vo_font_loaded=-1;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
5 font_desc_t* vo_font=NULL;
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
6
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
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;
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
9
865
83919c1b9924 removed redundant osd.h includes
arpi_esp
parents: 805
diff changeset
10 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)){
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
11 int len=strlen(vo_osd_text);
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
12 int j;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
13 int y=10;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
14 int x=20;
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
15
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
16 for(j=0;j<len;j++){
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
17 int c=vo_osd_text[j];
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
18 int font=vo_font->font[c];
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
19 if(font>=0)
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
20 draw_alpha(x,y,
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
21 vo_font->width[c],
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
22 vo_font->pic_a[font]->h,
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
23 vo_font->pic_b[font]->bmp+vo_font->start[c],
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
24 vo_font->pic_a[font]->bmp+vo_font->start[c],
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
25 vo_font->pic_a[font]->w);
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
26 x+=vo_font->width[c]+vo_font->charspace;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
27 }
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
28
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
29 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
30
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
31 int vo_osd_progbar_type=-1;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
32 int vo_osd_progbar_value=100; // 0..255
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
33
865
83919c1b9924 removed redundant osd.h includes
arpi_esp
parents: 805
diff changeset
34 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
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
35 int i;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
36 int y=dys/2;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
37 int x;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
38 int c,font;
372
1e57ff895419 progress bar width increased
arpi_esp
parents: 254
diff changeset
39 int width=(dxs*2/3-vo_font->width[0x10]-vo_font->width[0x12]);
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
40 int elems=width/vo_font->width[0x11];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
41 int mark=(vo_osd_progbar_value*(elems+1))>>8;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
42 x=(dxs-width)/2;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
43 // printf("osd.progbar width=%d xpos=%d\n",width,x);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
44
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
45 c=vo_osd_progbar_type;font=vo_font->font[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
46 if(vo_osd_progbar_type>0 && font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
47 draw_alpha(x-vo_font->width[c]-vo_font->spacewidth,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
48 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
49 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
50 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
51 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
52 vo_font->pic_a[font]->w);
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
53
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
54 c=OSD_PB_START;font=vo_font->font[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
55 if(font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
56 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
57 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
58 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
59 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
60 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
61 vo_font->pic_a[font]->w);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
62 x+=vo_font->width[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
63
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
64 for(i=0;i<elems;i++){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
65 c=(i<mark)?OSD_PB_0:OSD_PB_1;font=vo_font->font[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
66 if(font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
67 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
68 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
69 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
70 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
71 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
72 vo_font->pic_a[font]->w);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
73 x+=vo_font->width[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
74 }
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
75
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
76 c=OSD_PB_END;font=vo_font->font[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
77 if(font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
78 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
79 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
80 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
81 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
82 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
83 vo_font->pic_a[font]->w);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
84 // x+=vo_font->width[c];
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
85
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
86
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
87 // vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
88
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
89 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
90
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
91 subtitle* vo_sub=NULL;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
92
865
83919c1b9924 removed redundant osd.h includes
arpi_esp
parents: 805
diff changeset
93 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)){
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
94 int i;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
95 int y;
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
96 y=dys-(1+vo_sub->lines-1)*vo_font->height-10;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
97
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
98 // too long lines divide into smaller ones
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
99 for(i=0;i<vo_sub->lines;i++){
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
100 unsigned char* text=vo_sub->text[i];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
101 int len=strlen(text);
1109
a013b2124f05 -Wall like fixes
al3x
parents: 947
diff changeset
102 int j;
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
103 int xsize=-vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
104 int lastStripPosition=-1;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
105 int previousStrip=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
106 int lastxsize=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
107
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
108 for(j=0;j<len;j++){
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
109 int c=text[j];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
110 int w;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
111 if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
112 w = vo_font->width[c];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
113 if (text[j]==' ' && dxs>xsize)
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
114 {
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
115 lastStripPosition=j;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
116 lastxsize=xsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
117 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
118 xsize+=w+vo_font->charspace;
1109
a013b2124f05 -Wall like fixes
al3x
parents: 947
diff changeset
119 if (dxs<xsize && lastStripPosition>0)
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
120 {
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
121 xsize=lastxsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
122 j=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
123 y-=vo_font->height;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
124 previousStrip=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
125 xsize=-vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
126 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
127 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
128 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
129
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
130
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
131 for(i=0;i<vo_sub->lines;i++){
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
132 unsigned char* text=vo_sub->text[i];// "Hello World! HÛDEJÓ!";
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
133 int len=strlen(text);
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
134 int j,k;
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
135 int xsize=-vo_font->charspace;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
136 int x=0;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
137
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
138 int lastStripPosition=-1;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
139 int previousStrip=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
140 int lastxsize=xsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
141
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
142 for(j=0;j<len;j++){
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
143 int c=text[j];
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
144 int w;
726
2cbe922e2f3c Deal with unicode subs (-unicode -nounicode).
atmosfear
parents: 706
diff changeset
145 if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
146 w = vo_font->width[c];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
147 if (c==' ' && dxs>xsize)
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
148 {
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
149 lastStripPosition=j;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
150 lastxsize=xsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
151 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
152 xsize+=w+vo_font->charspace;
1109
a013b2124f05 -Wall like fixes
al3x
parents: 947
diff changeset
153 if ((dxs<xsize && lastStripPosition>0) || j==len-1)
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
154 {
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
155 if (j==len-1) lastStripPosition=len;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
156 else xsize=lastxsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
157 j=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
158
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
159 x=dxs/2-xsize/2;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
160
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
161 for(k=previousStrip;k<lastStripPosition;k++){
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
162 int c=text[k];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
163 int font;
805
d7ab7dbadb22 j->k for correct unicode...
arpi_esp
parents: 803
diff changeset
164 if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++k];
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
165 font=vo_font->font[c];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
166 if(x>=0 && x+vo_font->width[c]<dxs)
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
167 if(font>=0)
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
168 draw_alpha(x,y,
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
169 vo_font->width[c],
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
170 vo_font->pic_a[font]->h,
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
171 vo_font->pic_b[font]->bmp+vo_font->start[c],
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
172 vo_font->pic_a[font]->bmp+vo_font->start[c],
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
173 vo_font->pic_a[font]->w);
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
174 x+=vo_font->width[c]+vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
175 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
176 x=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
177 y+=vo_font->height;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
178 previousStrip=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
179 xsize=lastxsize=-vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
180 }
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
181 }
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
182 }
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
183
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
184 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
185
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
186 static int draw_alpha_init_flag=0;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
187
1109
a013b2124f05 -Wall like fixes
al3x
parents: 947
diff changeset
188 extern void vo_draw_alpha_init();
a013b2124f05 -Wall like fixes
al3x
parents: 947
diff changeset
189
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
190 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)){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
191
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
192 if(!vo_font) return; // no font
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
193
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
194 if(!draw_alpha_init_flag){
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
195 draw_alpha_init_flag=1;
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
196 vo_draw_alpha_init();
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
197 }
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
198
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
199 if(vo_osd_text){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
200 vo_draw_text_osd(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
201 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
202
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
203 if(vo_sub){
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
204 vo_draw_text_sub(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
205 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
206
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
207 if(vo_osd_progbar_type>=0){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
208 vo_draw_text_progbar(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
209 }
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
210
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
211 }