annotate libvo/sub.c @ 947:76fd9463b9d3

FAST_OSD option to disable font outline antialiasing
author arpi_esp
date Sat, 02 Jun 2001 16:02:38 +0000
parents 83919c1b9924
children a013b2124f05
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 len=strlen(vo_osd_text);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
36 int i;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
37 int y=dys/2;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
38 int x;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
39 int c,font;
372
1e57ff895419 progress bar width increased
arpi_esp
parents: 254
diff changeset
40 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
41 int elems=width/vo_font->width[0x11];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
42 int mark=(vo_osd_progbar_value*(elems+1))>>8;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
43 x=(dxs-width)/2;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
44 // printf("osd.progbar width=%d xpos=%d\n",width,x);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
45
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
46 c=vo_osd_progbar_type;font=vo_font->font[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
47 if(vo_osd_progbar_type>0 && font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
48 draw_alpha(x-vo_font->width[c]-vo_font->spacewidth,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
49 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
50 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
51 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
52 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
53 vo_font->pic_a[font]->w);
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
54
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
55 c=OSD_PB_START;font=vo_font->font[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
56 if(font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
57 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
58 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
59 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
60 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
61 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
62 vo_font->pic_a[font]->w);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
63 x+=vo_font->width[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
64
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
65 for(i=0;i<elems;i++){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
66 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
67 if(font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
68 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
69 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
70 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
71 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
72 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
73 vo_font->pic_a[font]->w);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
74 x+=vo_font->width[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
75 }
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
76
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
77 c=OSD_PB_END;font=vo_font->font[c];
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
78 if(font>=0)
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
79 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
80 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
81 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
82 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
83 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
84 vo_font->pic_a[font]->w);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
85 // x+=vo_font->width[c];
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
86
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
87
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
88 // vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
89
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
90 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
91
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
92 subtitle* vo_sub=NULL;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
93
865
83919c1b9924 removed redundant osd.h includes
arpi_esp
parents: 805
diff changeset
94 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
95 int i;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
96 int y;
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
97 y=dys-(1+vo_sub->lines-1)*vo_font->height-10;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
98
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
99 // 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
100 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
101 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
102 int len=strlen(text);
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
103 int j,k;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
104 int xsize=-vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
105 int x=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
106
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
107 int lastStripPosition=-1;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
108 int previousStrip=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
109 int lastxsize=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
110
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
111 for(j=0;j<len;j++){
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
112 int c=text[j];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
113 int w;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
114 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
115 w = vo_font->width[c];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
116 if (text[j]==' ' && dxs>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 lastStripPosition=j;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
119 lastxsize=xsize;
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+=w+vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
122 if (dxs<xsize & lastStripPosition>0)
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
123 {
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
124 xsize=lastxsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
125 j=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
126 y-=vo_font->height;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
127 previousStrip=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
128 xsize=-vo_font->charspace;
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 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
131 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
132
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
133
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
134 for(i=0;i<vo_sub->lines;i++){
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
135 unsigned char* text=vo_sub->text[i];// "Hello World! HÛDEJÓ!";
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
136 int len=strlen(text);
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
137 int j,k;
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
138 int xsize=-vo_font->charspace;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
139 int x=0;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
140
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
141 int lastStripPosition=-1;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
142 int previousStrip=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
143 int lastxsize=xsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
144
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
145 for(j=0;j<len;j++){
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
146 int c=text[j];
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
147 int w;
726
2cbe922e2f3c Deal with unicode subs (-unicode -nounicode).
atmosfear
parents: 706
diff changeset
148 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
149 w = vo_font->width[c];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
150 if (c==' ' && dxs>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 lastStripPosition=j;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
153 lastxsize=xsize;
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 xsize+=w+vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
156 if ((dxs<xsize & lastStripPosition>0)| j==len-1)
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
157 {
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
158 if (j==len-1) lastStripPosition=len;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
159 else xsize=lastxsize;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
160 j=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
161
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
162 x=dxs/2-xsize/2;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
163
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
164 for(k=previousStrip;k<lastStripPosition;k++){
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
165 int c=text[k];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
166 int font;
805
d7ab7dbadb22 j->k for correct unicode...
arpi_esp
parents: 803
diff changeset
167 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
168 font=vo_font->font[c];
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
169 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
170 if(font>=0)
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
171 draw_alpha(x,y,
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
172 vo_font->width[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]->h,
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
174 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
175 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
176 vo_font->pic_a[font]->w);
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
177 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
178 }
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
179 x=0;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
180 y+=vo_font->height;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
181 previousStrip=lastStripPosition;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
182 xsize=lastxsize=-vo_font->charspace;
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
183 }
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
184 }
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
185 }
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
186
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
187 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
188
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
189 static int draw_alpha_init_flag=0;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
190
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
191 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
192
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
193 if(!vo_font) return; // no font
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
194
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
195 if(!draw_alpha_init_flag){
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
196 draw_alpha_init_flag=1;
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
197 vo_draw_alpha_init();
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
198 }
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
199
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
200 if(vo_osd_text){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
201 vo_draw_text_osd(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
202 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
203
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
204 if(vo_sub){
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
205 vo_draw_text_sub(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
206 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
207
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
208 if(vo_osd_progbar_type>=0){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
209 vo_draw_text_progbar(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
210 }
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
211
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
212 }
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
213
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
214