# HG changeset patch # User atlka # Date 1002893047 0 # Node ID 1ae16a34f0550eeadbd95fc93d28c9c2b8e9f02d # Parent 1deee7703f33450d294f2abc4a465c247f02516a speed improvements diff -r 1deee7703f33 -r 1ae16a34f055 libvo/sub.c --- a/libvo/sub.c Fri Oct 12 11:56:02 2001 +0000 +++ b/libvo/sub.c Fri Oct 12 13:24:07 2001 +0000 @@ -173,19 +173,17 @@ // else for (j=0;j<=len;j++){ if ((c=t[j])>=0x80){ - if (sub_unicode) - c = (c<<8) + t[++j]; - else - if (sub_utf8){ - if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/ - c = (c & 0x1f)<<6 | (t[++j] & 0x3f); - else if((c & 0xf0) == 0xe0)/* 3 bytes U+00800..U+00FFFF*/ - c = ((c & 0x0f)<<6 | - (t[++j] & 0x3f))<<6 | (t[++j] & 0x3f); - } + if (sub_utf8){ + if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/ + c = (c & 0x1f)<<6 | (t[++j] & 0x3f); + else if((c & 0xf0) == 0xe0)/* 3 bytes U+00800..U+00FFFF*/ + c = ((c & 0x0f)<<6 | + (t[++j] & 0x3f))<<6 | (t[++j] & 0x3f); + } else if (sub_unicode) + c = (c<<8) + t[++j]; } if (k==MAX_UCS){ - utbl[k]=l=0; break; + l=0 ; len=j; // cut here } utbl[k++]=c; if (c==' '){ @@ -193,20 +191,11 @@ lastStripPosition=j; lastxsize=xsize; } -#if 1 else if ((font=vo_font->font[c])>=0){ if (vo_font->pic_a[font]->h > h){ h=vo_font->pic_a[font]->h; } } -#endif -#if 0 - else if ((font=vo_font->font[c])>=0){ - if ((memy-h)+vo_font->pic_a[font]->h > dys){ - h=vo_font->pic_a[font]->h; - } - } -#endif xsize+=vo_font->width[c]+vo_font->charspace; if (dxs0){ @@ -221,20 +210,20 @@ } else if (jmemy){ // out of the screen so end parsing - memy +=vo_font->height-lasth; // correct the y position + memy -=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; break; + l=0; j=len; // end parsing } else if(l || jcharspace; lasth=h; h=vo_font->height; } - printf("h: %d -> %d \n",vo_font->height,h); +// printf("h: %d -> %d \n",vo_font->height,h); memy -=h; // according to max of vo_font->pic_a[font]->h } } @@ -248,7 +237,7 @@ while (ifont[c])>=0 && yfont[c])>=0) draw_alpha(x,y, vo_font->width[c], vo_font->pic_a[font]->h+ypic_a[font]->h : dys-y,