[Mplayer-cvslog] CVS: main/libvo sub.c,1.25,1.26

Adam Tla/lka atlka at mplayer.dev.hu
Tue Aug 28 14:43:44 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv3271/libvo

Modified Files:
	sub.c 
Log Message:

corrections to OSD progbar position calculations


Index: sub.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/sub.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- sub.c	21 Aug 2001 11:28:50 -0000	1.25
+++ sub.c	28 Aug 2001 12:43:41 -0000	1.26
@@ -30,12 +30,20 @@
 }
 
 int vo_osd_progbar_type=-1;
-int vo_osd_progbar_value=100;   // 0..255
+int vo_osd_progbar_value=100;   // 0..256
+
+// if we have n=256 bars then OSD progbar looks like below
+// 
+// 0   1    2    3 ...   256  <= vo_osd_progbar_value
+// |   |    |    |       |
+// [ ===  ===  === ... === ]
+// 
+//  the above schema is rescalled to n=elems bars
 
 inline static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
    	unsigned char *s;
    	unsigned char *sa;
-        int i,w,h,st;
+        int i,w,h,st,mark;
         int y=(dys-vo_font->height)/2;
         int c,font;
         int delimw=vo_font->width[OSD_PB_START]
@@ -45,8 +53,15 @@
    	int charw=vo_font->width[OSD_PB_0]+vo_font->charspace;
         int elems=width/charw;
    	int x=(dxs-elems*charw-delimw)/2;
-        int mark=(vo_osd_progbar_value*(elems+1))>>8;
 
+	if (vo_osd_progbar_value<=0)
+     	   mark=0;
+	else {
+	   int mm=vo_osd_progbar_value*elems;
+	   mark=mm>>8;
+	   if (mm & 0x00FF) mark++;
+	   if (mark>elems) mark=elems;
+	}
 //        printf("osd.progbar  width=%d  xpos=%d\n",width,x);
 
         c=vo_osd_progbar_type;
@@ -254,3 +269,4 @@
     }
 
 }
+         




More information about the MPlayer-cvslog mailing list