202
|
1
|
213
|
2 //static int vo_font_loaded=-1;
|
|
3 font_desc_t* vo_font=NULL;
|
202
|
4
|
|
5 int vo_sub_lines=2;
|
213
|
6 unsigned char* vo_sub_text[8];
|
|
7
|
|
8 unsigned char* vo_osd_text="00:00:00";
|
|
9
|
|
10 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)){
|
|
11 int i;
|
|
12 int y;
|
202
|
13
|
213
|
14 if(!vo_font) return; // no font
|
|
15
|
|
16 if(vo_osd_text){
|
|
17 int len=strlen(vo_osd_text);
|
|
18 int j;
|
|
19 int y=10;
|
|
20 int x=20;
|
202
|
21
|
213
|
22 for(j=0;j<len;j++){
|
|
23 int c=vo_osd_text[j];
|
|
24 int font=vo_font->font[c];
|
|
25 if(font>=0)
|
|
26 draw_alpha(x,y,
|
|
27 vo_font->width[c],
|
|
28 vo_font->pic_a[font]->h,
|
|
29 vo_font->pic_b[font]->bmp+vo_font->start[c],
|
|
30 vo_font->pic_a[font]->bmp+vo_font->start[c],
|
|
31 vo_font->pic_a[font]->w);
|
|
32 x+=vo_font->width[c]+vo_font->charspace;
|
|
33 }
|
|
34
|
|
35 }
|
|
36
|
|
37 #if 1
|
202
|
38
|
|
39 if(vo_sub_lines<=0) return; // no text
|
213
|
40 y=dys-(1+vo_sub_lines)*vo_font->height;
|
202
|
41
|
|
42 for(i=0;i<vo_sub_lines;i++){
|
213
|
43 unsigned char* text="Hello World! HÛDEJÓ!"; //vo_sub_text[i];
|
|
44 int len=strlen(text);
|
|
45 int j;
|
|
46 int xsize=-vo_font->charspace;
|
|
47 int x=0;
|
|
48
|
|
49 for(j=0;j<len;j++){
|
|
50 int w=vo_font->width[text[j]];
|
|
51 if(w>100) printf("gazvan: %d (%d=%c)\n",w,text[j],text[j]);
|
|
52 xsize+=w+vo_font->charspace;
|
|
53 }
|
|
54 //printf("text width = %d\n",xsize);
|
|
55
|
|
56 if(xsize>dxs) printf("Warning! SUB too wide!!! (%d>%d)\n",xsize,dxs);
|
|
57
|
|
58 x=dxs/2-xsize/2;
|
|
59
|
|
60 for(j=0;j<len;j++){
|
|
61 int c=text[j];
|
|
62 int font=vo_font->font[c];
|
|
63 if(x>=0 && x+vo_font->width[c]<dxs)
|
|
64 if(font>=0)
|
|
65 draw_alpha(x,y,
|
|
66 vo_font->width[c],
|
|
67 vo_font->pic_a[font]->h,
|
|
68 vo_font->pic_b[font]->bmp+vo_font->start[c],
|
|
69 vo_font->pic_a[font]->bmp+vo_font->start[c],
|
|
70 vo_font->pic_a[font]->w);
|
|
71 x+=vo_font->width[c]+vo_font->charspace;
|
|
72 }
|
|
73
|
|
74 y+=vo_font->height;
|
202
|
75 }
|
|
76
|
213
|
77 #endif
|
|
78
|
202
|
79 }
|
|
80
|
213
|
81
|
|
82
|