mirror of https://github.com/mpv-player/mpv
optimizations and corrections
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2205 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e503beaf7c
commit
bfeb215e95
32
libvo/sub.c
32
libvo/sub.c
|
@ -94,10 +94,10 @@ inline static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x
|
||||||
s=vo_font->pic_b[font]->bmp+vo_font->start[c];
|
s=vo_font->pic_b[font]->bmp+vo_font->start[c];
|
||||||
sa=vo_font->pic_a[font]->bmp+vo_font->start[c];
|
sa=vo_font->pic_a[font]->bmp+vo_font->start[c];
|
||||||
st=vo_font->pic_a[font]->w;
|
st=vo_font->pic_a[font]->w;
|
||||||
for (i=mark;i--;){
|
if ((i=mark)) do {
|
||||||
draw_alpha(x,y,w,h,s,sa,st);
|
draw_alpha(x,y,w,h,s,sa,st);
|
||||||
x+=charw;
|
x+=charw;
|
||||||
}
|
} while(--i);
|
||||||
}
|
}
|
||||||
|
|
||||||
c=OSD_PB_1;
|
c=OSD_PB_1;
|
||||||
|
@ -107,10 +107,10 @@ inline static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x
|
||||||
s =vo_font->pic_b[font]->bmp+vo_font->start[c];
|
s =vo_font->pic_b[font]->bmp+vo_font->start[c];
|
||||||
sa=vo_font->pic_a[font]->bmp+vo_font->start[c];
|
sa=vo_font->pic_a[font]->bmp+vo_font->start[c];
|
||||||
st=vo_font->pic_a[font]->w;
|
st=vo_font->pic_a[font]->w;
|
||||||
for (i=elems-mark;i--;){
|
if ((i=elems-mark)) do {
|
||||||
draw_alpha(x,y,w,h,s,sa,st);
|
draw_alpha(x,y,w,h,s,sa,st);
|
||||||
x+=charw;
|
x+=charw;
|
||||||
}
|
} while(--i);
|
||||||
}
|
}
|
||||||
|
|
||||||
c=OSD_PB_END;
|
c=OSD_PB_END;
|
||||||
|
@ -164,7 +164,8 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
|
||||||
lastStripPosition=-1;
|
lastStripPosition=-1;
|
||||||
l=vo_sub->lines;
|
l=vo_sub->lines;
|
||||||
|
|
||||||
while (l--){
|
while (l) {
|
||||||
|
l--;
|
||||||
t=vo_sub->text[i++];
|
t=vo_sub->text[i++];
|
||||||
len=strlen(t)-1;
|
len=strlen(t)-1;
|
||||||
|
|
||||||
|
@ -183,19 +184,19 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
|
||||||
c = (c<<8) + t[++j];
|
c = (c<<8) + t[++j];
|
||||||
}
|
}
|
||||||
if (k==MAX_UCS){
|
if (k==MAX_UCS){
|
||||||
l=0 ; len=j; // cut here
|
len=j; // end here
|
||||||
}
|
}
|
||||||
utbl[k++]=c;
|
if (!c) c++; // avoid UCS 0
|
||||||
if (c==' '){
|
if (c==' '){
|
||||||
lastk=k;
|
lastk=k;
|
||||||
lastStripPosition=j;
|
lastStripPosition=j;
|
||||||
lastxsize=xsize;
|
lastxsize=xsize;
|
||||||
}
|
} else if ((font=vo_font->font[c])>=0){
|
||||||
else if ((font=vo_font->font[c])>=0){
|
|
||||||
if (vo_font->pic_a[font]->h > h){
|
if (vo_font->pic_a[font]->h > h){
|
||||||
h=vo_font->pic_a[font]->h;
|
h=vo_font->pic_a[font]->h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
utbl[k++]=c;
|
||||||
xsize+=vo_font->width[c]+vo_font->charspace;
|
xsize+=vo_font->width[c]+vo_font->charspace;
|
||||||
if (dxs<xsize){
|
if (dxs<xsize){
|
||||||
if (lastStripPosition>0){
|
if (lastStripPosition>0){
|
||||||
|
@ -210,13 +211,14 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
|
||||||
} else if (j<len)
|
} else if (j<len)
|
||||||
continue;
|
continue;
|
||||||
if (h>memy){ // out of the screen so end parsing
|
if (h>memy){ // out of the screen so end parsing
|
||||||
memy -=lasth - vo_font->height; // correct the y position
|
h -=lasth - vo_font->height; // correct the y position
|
||||||
l=0; break;
|
l=0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
utbl[k++]=0;
|
utbl[k++]=0;
|
||||||
xtbl[lines++]=(dxs-xsize)/2;
|
xtbl[lines++]=(dxs-xsize)/2;
|
||||||
if (lines==MAX_UCSLINES||k>MAX_UCS){
|
if (lines==MAX_UCSLINES||k>MAX_UCS){
|
||||||
l=0; j=len; // end parsing
|
l=0; len=j; // end parsing
|
||||||
} else if(l || j<len){ // not the last line or not the last char
|
} else if(l || j<len){ // not the last line or not the last char
|
||||||
lastStripPosition=-1;
|
lastStripPosition=-1;
|
||||||
xsize=-vo_font->charspace;
|
xsize=-vo_font->charspace;
|
||||||
|
@ -233,8 +235,8 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
|
||||||
|
|
||||||
// printf("lines=%d y=%d\n",lines,y);
|
// printf("lines=%d y=%d\n",lines,y);
|
||||||
|
|
||||||
i=j=0; l=lines;
|
i=j=0;
|
||||||
while (i<lines){
|
if ((l=lines)) for (;;) {
|
||||||
x=xtbl[i++];
|
x=xtbl[i++];
|
||||||
while ((c=utbl[j++])){
|
while ((c=utbl[j++])){
|
||||||
if ((font=vo_font->font[c])>=0)
|
if ((font=vo_font->font[c])>=0)
|
||||||
|
@ -246,6 +248,8 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
|
||||||
vo_font->pic_a[font]->w);
|
vo_font->pic_a[font]->w);
|
||||||
x+=vo_font->width[c]+vo_font->charspace;
|
x+=vo_font->width[c]+vo_font->charspace;
|
||||||
}
|
}
|
||||||
|
if (!--l)
|
||||||
|
return;
|
||||||
y+=vo_font->height;
|
y+=vo_font->height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue