[Mplayer-cvslog] CVS: main/libvo sub.c,1.8,1.9

GEREOFFY arpi_esp at users.sourceforge.net
Tue May 15 00:08:15 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv14102

Modified Files:
	sub.c 
Log Message:
sub splitting patch applied by Vlada  V.Dubsky at sh.cvut.cz

Index: sub.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/sub.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** sub.c	2001/05/08 19:40:10	1.8
--- sub.c	2001/05/14 22:08:12	1.9
***************
*** 6,9 ****
--- 6,10 ----
  
  unsigned char* vo_osd_text="00:00:00";
+ int sub_unicode=0;
  
  void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
***************
*** 83,87 ****
                vo_font->pic_a[font]->w);
  //        x+=vo_font->width[c];
!         
  
  //        vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF;
--- 84,88 ----
                vo_font->pic_a[font]->w);
  //        x+=vo_font->width[c];
! 
  
  //        vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF;
***************
*** 90,137 ****
  
  subtitle* vo_sub=NULL;
- int sub_unicode=0;
  
  void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
      int i;
      int y;
  
!     y=dys-(1+vo_sub->lines)*vo_font->height;
!     
      for(i=0;i<vo_sub->lines;i++){
!         unsigned char* text=vo_sub->text[i];//  "Hello World! HÛDEJÓ!";
          int len=strlen(text);
!         int j;
          int xsize=-vo_font->charspace;
          int x=0;
  
!         for(j=0;j<len;j++){
            int c=text[j];
!           int w = vo_font->width[sub_unicode?((c<0x80)?c:(c<<8)+text[++j]):c];
!           if(w>100) printf("gazvan: %d (%d=%c)\n",w,c,c);
            xsize+=w+vo_font->charspace;
          }
!         //printf("text width = %d\n",xsize);
!         
!         //if(xsize>dxs) printf("Warning! SUB too wide!!! (%d>%d)\n",xsize,dxs);
!         
!         x=dxs/2-xsize/2;
!         
!         for(j=0;j<len;j++){
            int c=text[j];
!           int font;
            if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
!           font = vo_font->font[c];
!           if(x>=0 && x+vo_font->width[c]<dxs)
!           if(font>=0)
!             draw_alpha(x,y,
!               vo_font->width[c],
!               vo_font->pic_a[font]->h,
!               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;
          }
- 
-         y+=vo_font->height;
      }
  
--- 91,186 ----
  
  subtitle* vo_sub=NULL;
  
  void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
      int i;
      int y;
+     y=dys-(1+vo_sub->lines-1)*vo_font->height-10;
  
!     // too long lines divide into smaller ones
      for(i=0;i<vo_sub->lines;i++){
!         unsigned char* text=vo_sub->text[i];
          int len=strlen(text);
!         int j,k;
          int xsize=-vo_font->charspace;
          int x=0;
  
! 	int lastStripPosition=-1;
! 	int previousStrip=0;
! 	int lastxsize=0;
! 
! 	for(j=0;j<len;j++){
            int c=text[j];
!           int w;
!           if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
!           w = vo_font->width[c];
! 	  if (text[j]==' ' && dxs>xsize)
! 	  {
! 	    lastStripPosition=j;
! 	    lastxsize=xsize;
! 	  }
            xsize+=w+vo_font->charspace;
+ 	  if (dxs<xsize & lastStripPosition>0)
+ 	  {
+ 	    xsize=lastxsize;
+ 	    j=lastStripPosition;
+             y-=vo_font->height;
+ 	    previousStrip=lastStripPosition;
+             xsize=-vo_font->charspace;
+ 	  }
          }
!     }
! 
! 
!     for(i=0;i<vo_sub->lines;i++){
!         unsigned char* text=vo_sub->text[i];//  "Hello World! HÛDEJÓ!";
!         int len=strlen(text);
!         int j,k;
!         int xsize=-vo_font->charspace;
!         int x=0;
! 
! 	int lastStripPosition=-1;
! 	int previousStrip=0;
! 	int lastxsize=xsize;
! 
! 	for(j=0;j<len;j++){
            int c=text[j];
!           int w;
            if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
!           w = vo_font->width[c];
!           if (c==' ' && dxs>xsize)
! 	  {
! 	    lastStripPosition=j;
! 	    lastxsize=xsize;
! 	  }
!           xsize+=w+vo_font->charspace;
! 	  if ((dxs<xsize & lastStripPosition>0)| j==len-1)
! 	  {
! 	    if (j==len-1) lastStripPosition=len;
! 	      else xsize=lastxsize;
! 	    j=lastStripPosition;
! 
!             x=dxs/2-xsize/2;
! 
!             for(k=previousStrip;k<lastStripPosition;k++){
!               int c=text[k];
! 	      int font;
!               if (sub_unicode && (c>=0x80)) c=(c<<8)+text[++j];
!               font=vo_font->font[c];
!               if(x>=0 && x+vo_font->width[c]<dxs)
!                 if(font>=0)
!                   draw_alpha(x,y,
!                     vo_font->width[c],
!                     vo_font->pic_a[font]->h,
!                     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=0;
!             y+=vo_font->height;
! 	    previousStrip=lastStripPosition;
!             xsize=lastxsize=-vo_font->charspace;
! 	  }
          }
      }
  
***************
*** 156,158 ****
--- 205,208 ----
  
  }
+ 
  


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list