1
mirror of https://github.com/mpv-player/mpv synced 2025-01-24 19:37:30 +01:00

changes according to max of vo_font->pic_a[font]->h for the last line of subs

changes for skiping subtitle lines which y pos is negative


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1574 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
atlka 2001-08-17 11:14:57 +00:00
parent 883fdaf97a
commit 18133a83bb

View File

@ -142,10 +142,10 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
memdxs=dxs; memdxs=dxs;
memdys=dys; memdys=dys;
memy=dys-vo_font->height/2; memy=dys;
// too long lines divide into smaller ones // too long lines divide into smaller ones
i=k=lines=0; l=vo_sub->lines; i=k=lines=y=0; l=vo_sub->lines;
while (l--){ while (l--){
t=vo_sub->text[i++]; t=vo_sub->text[i++];
len=strlen(t)-1; len=strlen(t)-1;
@ -174,11 +174,15 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
lastk=k; lastk=k;
lastStripPosition=j; lastStripPosition=j;
lastxsize=xsize; lastxsize=xsize;
} else if (!l && ((font=vo_font->font[c])>=0)){
if (vo_font->pic_a[font]->h > y)
y=vo_font->pic_a[font]->h;
} }
xsize+=vo_font->width[c]+vo_font->charspace; xsize+=vo_font->width[c]+vo_font->charspace;
if (dxs<xsize && lastStripPosition>0){ if (dxs<xsize && lastStripPosition>0){
j=lastStripPosition; j=lastStripPosition;
k=lastk; k=lastk;
y=vo_font->height;
} else if (j==len){ } else if (j==len){
lastxsize=xsize; lastxsize=xsize;
} else } else
@ -188,11 +192,13 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
if (lines==MAX_UCSLINES||k>MAX_UCS){ if (lines==MAX_UCSLINES||k>MAX_UCS){
l=0; l=0;
break; break;
} } else if(l || j<len){ // not last line or there is no eol
memy-=vo_font->height; y=vo_font->height;
xsize=lastxsize=-vo_font->charspace; xsize=lastxsize=-vo_font->charspace;
} }
} memy-=y; // according to max of vo_font->pic_a[font]->h
} // in last line
}
} }
y = memy; y = memy;
@ -206,8 +212,7 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
if ((font=vo_font->font[c])>=0) if ((font=vo_font->font[c])>=0)
draw_alpha(x,y, draw_alpha(x,y,
vo_font->width[c], vo_font->width[c],
// vo_font->pic_a[font]->h, vo_font->pic_a[font]->h,
(y+vo_font->pic_a[font]->h<=dys)?vo_font->pic_a[font]->h:dys-y,
vo_font->pic_b[font]->bmp+vo_font->start[c], vo_font->pic_b[font]->bmp+vo_font->start[c],
vo_font->pic_a[font]->bmp+vo_font->start[c], vo_font->pic_a[font]->bmp+vo_font->start[c],
vo_font->pic_a[font]->w); vo_font->pic_a[font]->w);
@ -215,7 +220,7 @@ inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,in
} }
} else { } else {
while (utbl[k++]) ; // skip lines with negative y value while (utbl[k++]) ; // skip lines with negative y value
i++; // seldom case but who know ;-) i++; // seldom case but who knows ;-)
} }
y+=vo_font->height; y+=vo_font->height;
} }