1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-08 02:22:47 +00:00

Fix menu background drawing.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18194 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2006-04-22 16:22:33 +00:00
parent 168e6e1daf
commit ced4a23f8d
3 changed files with 12 additions and 8 deletions

View File

@ -563,11 +563,12 @@ char* menu_text_get_next_line(char* txt, int max_width) {
} }
void menu_draw_box(mp_image_t* mpi, char grey, char alpha, int x, int y, int w, int h) { void menu_draw_box(mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x, int y, int w, int h) {
draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt);
int g;
if(!draw_alpha) { if(!draw_alpha) {
printf("Unsupported outformat !!!!\n"); mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
return; return;
} }
@ -578,10 +579,13 @@ void menu_draw_box(mp_image_t* mpi, char grey, char alpha, int x, int y, int w,
if(y < 0) h += y, y = 0; if(y < 0) h += y, y = 0;
if(y+h > mpi->h) h = mpi->h-y; if(y+h > mpi->h) h = mpi->h-y;
g = ((256-alpha)*grey)>>8;
if(g < 1) g = 1;
{ {
int stride = (w+7)&(~7); // round to 8 int stride = (w+7)&(~7); // round to 8
char pic[stride*h],pic_alpha[stride*h]; char pic[stride*h],pic_alpha[stride*h];
memset(pic,grey,stride*h); memset(pic,g,stride*h);
memset(pic_alpha,alpha,stride*h); memset(pic_alpha,alpha,stride*h);
draw_alpha(w,h,pic,pic_alpha,stride, draw_alpha(w,h,pic,pic_alpha,stride,
mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3), mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3),

View File

@ -73,4 +73,4 @@ void menu_draw_text_full(mp_image_t* mpi,char* txt,
int x, int y,int w, int h, int x, int y,int w, int h,
int vspace, int warp, int align, int anchor); int vspace, int warp, int align, int anchor);
void menu_draw_box(mp_image_t* mpi, char grey, char alpha, int x, int y, int w, int h); void menu_draw_box(mp_image_t* mpi, unsigned char grey, unsigned char alpha, int x, int y, int w, int h);

View File

@ -56,9 +56,9 @@ extern const menu_list_priv_t menu_list_priv_dflt;
0,0, \ 0,0, \
5, 3, \ 5, 3, \
NULL, \ NULL, \
0x80, 0x80, \ 0xE0, 0x20, \
0x40, 0x80, \ 0x80, 0x50, \
0x70, 0x80 \ 0xC0, 0x50 \
} }