summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-19 09:34:28 +0000
committerulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-19 09:34:28 +0000
commit5fdfc9124db971d71f5e1353af50556915ec68c9 (patch)
tree9f1dd1c203fcb9b1416b4043ca417ce2a45070d7
parentfafef9cb9ddb55df98044dd824baa9207ee8a12e (diff)
downloadmpv-5fdfc9124db971d71f5e1353af50556915ec68c9.tar.bz2
mpv-5fdfc9124db971d71f5e1353af50556915ec68c9.tar.xz
Calculate and draw osd accurately.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25462 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmenu/menu.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libmenu/menu.c b/libmenu/menu.c
index 4082c5c1b2..358202b715 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -628,7 +628,7 @@ void menu_draw_text_full(mp_image_t* mpi,char* txt,
font = vo_font->font[c];
if(font >= 0) {
int cs = (vo_font->pic_a[font]->h - vo_font->height) / 2;
- if ((sx + vo_font->width[c] < xmax) && (sy + vo_font->height < ymax) )
+ if ((sx + vo_font->width[c] <= xmax) && (sy + vo_font->height <= ymax) )
draw_alpha(vo_font->width[c], vo_font->height,
vo_font->pic_b[font]->bmp+vo_font->start[c] +
cs * vo_font->pic_a[font]->w,
@@ -666,13 +666,18 @@ void menu_text_size(char* txt,int max_width, int vspace, int warp, int* _w, int*
while (*txt) {
int c=utf8_get_char((const char**)&txt);
if(c == '\n' || (warp && i + vo_font->width[c] >= max_width)) {
+ i -= vo_font->charspace;
+ if (i > w) w = i;
if(*txt)
l++;
i = 0;
if(c == '\n') continue;
}
i += vo_font->width[c]+vo_font->charspace;
- if(i > w) w = i;
+ }
+ if (i > 0) {
+ i -= vo_font->charspace;
+ if (i > w) w = i;
}
*_w = w;