mirror of https://github.com/mpv-player/mpv
Add variable bx, dx to simplify code of function menu_draw_list.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25466 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
bfe3186801
commit
787801f7a5
|
@ -27,7 +27,7 @@ void menu_list_draw(menu_t* menu,mp_image_t* mpi) {
|
||||||
int h = mpriv->h;
|
int h = mpriv->h;
|
||||||
int w = mpriv->w;
|
int w = mpriv->w;
|
||||||
int dh = 0,dw = 0;
|
int dh = 0,dw = 0;
|
||||||
int dy = 0;
|
int bx, dx, dy = 0;
|
||||||
int need_h = 0,need_w = 0,ptr_l,sidx = 0;
|
int need_h = 0,need_w = 0,ptr_l,sidx = 0;
|
||||||
int th,count = 0;
|
int th,count = 0;
|
||||||
int bg_w;
|
int bg_w;
|
||||||
|
@ -125,26 +125,28 @@ void menu_list_draw(menu_t* menu,mp_image_t* mpi) {
|
||||||
dy += th;
|
dy += th;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dx = x < 0 ? (mpi->w - need_w) / 2 : x;
|
||||||
|
bx = x < 0 ? (mpi->w - bg_w) / 2 : x - mpriv->minb;
|
||||||
for( ; m != NULL && dy + vo_font->height < dh ; m = m->next ) {
|
for( ; m != NULL && dy + vo_font->height < dh ; m = m->next ) {
|
||||||
if(m->hide) continue;
|
if(m->hide) continue;
|
||||||
if(m == mpriv->current) {
|
if(m == mpriv->current) {
|
||||||
if(mpriv->ptr_bg >= 0)
|
if(mpriv->ptr_bg >= 0)
|
||||||
menu_draw_box(mpi,mpriv->ptr_bg,mpriv->ptr_bg_alpha,
|
menu_draw_box(mpi,mpriv->ptr_bg,mpriv->ptr_bg_alpha,
|
||||||
x < 0 ? (mpi->w-bg_w)/2 : x-mpriv->minb,dy+y-mpriv->vspace/2,
|
bx, dy + y - mpriv->vspace / 2,
|
||||||
bg_w, line_h);
|
bg_w, line_h);
|
||||||
if(ptr_l > 0)
|
if(ptr_l > 0)
|
||||||
menu_draw_text_full(mpi,mpriv->ptr,
|
menu_draw_text_full(mpi,mpriv->ptr,
|
||||||
x < 0 ? (mpi->w - need_w) / 2 + ptr_l : x,
|
dx,
|
||||||
dy+y,dw,dh - dy,
|
dy+y,dw,dh - dy,
|
||||||
mpriv->vspace,0,
|
mpriv->vspace,0,
|
||||||
MENU_TEXT_TOP|(x < 0 ? MENU_TEXT_RIGHT :MENU_TEXT_LEFT) ,
|
MENU_TEXT_TOP|MENU_TEXT_LEFT,
|
||||||
MENU_TEXT_TOP|(x < 0 ? MENU_TEXT_RIGHT :MENU_TEXT_LEFT));
|
MENU_TEXT_TOP|MENU_TEXT_LEFT);
|
||||||
} else if(mpriv->item_bg >= 0)
|
} else if(mpriv->item_bg >= 0)
|
||||||
menu_draw_box(mpi,mpriv->item_bg,mpriv->item_bg_alpha,
|
menu_draw_box(mpi,mpriv->item_bg,mpriv->item_bg_alpha,
|
||||||
x < 0 ? (mpi->w-bg_w)/2 : x-mpriv->minb,dy+y-mpriv->vspace/2,
|
bx, dy + y - mpriv->vspace / 2,
|
||||||
bg_w, line_h);
|
bg_w, line_h);
|
||||||
menu_draw_text_full(mpi,m->txt,
|
menu_draw_text_full(mpi,m->txt,
|
||||||
x < 0 ? (mpi->w - need_w) / 2 + ptr_l : x + ptr_l,
|
dx + ptr_l,
|
||||||
dy+y,dw-ptr_l,dh - dy,
|
dy+y,dw-ptr_l,dh - dy,
|
||||||
mpriv->vspace,0,
|
mpriv->vspace,0,
|
||||||
MENU_TEXT_TOP|MENU_TEXT_LEFT,
|
MENU_TEXT_TOP|MENU_TEXT_LEFT,
|
||||||
|
|
Loading…
Reference in New Issue