summaryrefslogtreecommitdiffstats
path: root/libvo/sub.c
diff options
context:
space:
mode:
authoratlka <atlka@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-28 12:43:41 +0000
committeratlka <atlka@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-08-28 12:43:41 +0000
commit60737e38456d9a118272c47b517616c001f6b1b8 (patch)
treedd81684ce0ff5e653a9f79360970bc30b9307fff /libvo/sub.c
parent92828938a340c26b4fd5a568439ad700a1f09835 (diff)
downloadmpv-60737e38456d9a118272c47b517616c001f6b1b8.tar.bz2
mpv-60737e38456d9a118272c47b517616c001f6b1b8.tar.xz
corrections to OSD progbar position calculations
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1727 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/sub.c')
-rw-r--r--libvo/sub.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/libvo/sub.c b/libvo/sub.c
index 756072003b..890b9a3820 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -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,
}
}
+