corrections to OSD progbar position calculations

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1727 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
atlka 2001-08-28 12:43:41 +00:00
parent 92828938a3
commit 60737e3845
2 changed files with 25 additions and 13 deletions

View File

@ -30,12 +30,20 @@ inline static void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,in
}
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 @@ inline static void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x
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 @@ void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h,
}
}

View File

@ -1612,8 +1612,8 @@ if(auto_quality>0){
if(osd_level){
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_VOLUME;
vo_osd_progbar_value=(mixer_l+mixer_r)*255/200;
//printf("volume: %d\n",vo_osd_progbar_value);
vo_osd_progbar_value=((mixer_l+mixer_r)*256.0)/200.0;
// printf("volume: %d\n",vo_osd_progbar_value);
}
#endif
}
@ -1649,7 +1649,7 @@ if(auto_quality>0){
if(osd_level){
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_CONTRAST;
vo_osd_progbar_value=(v_cont)*255/100;
vo_osd_progbar_value=((v_cont)<<8)/100;
}
#endif
}
@ -1668,7 +1668,7 @@ if(auto_quality>0){
if(osd_level){
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_BRIGHTNESS;
vo_osd_progbar_value=(v_bright)*255/100;
vo_osd_progbar_value=((v_bright)<<8)/100;
}
#endif
}
@ -1687,7 +1687,7 @@ if(auto_quality>0){
if(osd_level){
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_HUE;
vo_osd_progbar_value=(v_hue)*255/100;
vo_osd_progbar_value=((v_hue)<<8)/100;
}
#endif
}
@ -1706,7 +1706,7 @@ if(auto_quality>0){
if(osd_level){
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=OSD_SATURATION;
vo_osd_progbar_value=(v_saturation)*255/100;
vo_osd_progbar_value=((v_saturation)<<8)/100;
}
#endif
}
@ -1763,10 +1763,6 @@ if(rel_seek_secs || abs_seek_pos){
osd_visible=sh_video->fps; // 1 sec
vo_osd_progbar_type=0;
vo_osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len;
if (vo_osd_progbar_value<0)
vo_osd_progbar_value=0;
else if (vo_osd_progbar_value>255)
vo_osd_progbar_value=255;
}
}
#endif