# HG changeset patch # User atlka # Date 1003126495 0 # Node ID 28901a4122c80552b79321341d045280fe2da37c # Parent f90b6e259dc8b5879796e9af3c4d17b28fae5b0a optimizations and corrections diff -r f90b6e259dc8 -r 28901a4122c8 libvo/sub.c --- a/libvo/sub.c Mon Oct 15 03:01:08 2001 +0000 +++ b/libvo/sub.c Mon Oct 15 06:14:55 2001 +0000 @@ -94,10 +94,10 @@ s=vo_font->pic_b[font]->bmp+vo_font->start[c]; sa=vo_font->pic_a[font]->bmp+vo_font->start[c]; st=vo_font->pic_a[font]->w; - for (i=mark;i--;){ + if ((i=mark)) do { draw_alpha(x,y,w,h,s,sa,st); x+=charw; - } + } while(--i); } c=OSD_PB_1; @@ -107,10 +107,10 @@ s =vo_font->pic_b[font]->bmp+vo_font->start[c]; sa=vo_font->pic_a[font]->bmp+vo_font->start[c]; 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); x+=charw; - } + } while(--i); } c=OSD_PB_END; @@ -164,7 +164,8 @@ lastStripPosition=-1; l=vo_sub->lines; - while (l--){ + while (l) { + l--; t=vo_sub->text[i++]; len=strlen(t)-1; @@ -183,19 +184,19 @@ c = (c<<8) + t[++j]; } 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==' '){ lastk=k; lastStripPosition=j; 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){ h=vo_font->pic_a[font]->h; } } + utbl[k++]=c; xsize+=vo_font->width[c]+vo_font->charspace; if (dxs0){ @@ -210,13 +211,14 @@ } else if (jmemy){ // out of the screen so end parsing - memy -=lasth - vo_font->height; // correct the y position - l=0; break; + h -=lasth - vo_font->height; // correct the y position + l=0; + break; } utbl[k++]=0; xtbl[lines++]=(dxs-xsize)/2; if (lines==MAX_UCSLINES||k>MAX_UCS){ - l=0; j=len; // end parsing + l=0; len=j; // end parsing } else if(l || jcharspace; @@ -233,9 +235,9 @@ // printf("lines=%d y=%d\n",lines,y); - i=j=0; l=lines; - while (ifont[c])>=0) draw_alpha(x,y, @@ -244,8 +246,10 @@ 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]->w); - x+=vo_font->width[c]+vo_font->charspace; + x+=vo_font->width[c]+vo_font->charspace; } + if (!--l) + return; y+=vo_font->height; } }