[MPlayer-cvslog] r25466 - trunk/libmenu/menu_list.c

ulion subversion at mplayerhq.hu
Thu Dec 20 08:11:48 CET 2007


Author: ulion
Date: Thu Dec 20 08:11:48 2007
New Revision: 25466

Log:
Add variable bx, dx to simplify code of function menu_draw_list.


Modified:
   trunk/libmenu/menu_list.c

Modified: trunk/libmenu/menu_list.c
==============================================================================
--- trunk/libmenu/menu_list.c	(original)
+++ trunk/libmenu/menu_list.c	Thu Dec 20 08:11:48 2007
@@ -27,7 +27,7 @@ void menu_list_draw(menu_t* menu,mp_imag
   int h = mpriv->h;
   int w = mpriv->w;
   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 th,count = 0;
   int bg_w;
@@ -125,26 +125,28 @@ void menu_list_draw(menu_t* menu,mp_imag
     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 ) {
     if(m->hide) continue;
     if(m == mpriv->current) {
       if(mpriv->ptr_bg >= 0)
         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);
       if(ptr_l > 0)
         menu_draw_text_full(mpi,mpriv->ptr,
-                            x < 0 ? (mpi->w - need_w) / 2 + ptr_l : x,
+                            dx,
                             dy+y,dw,dh - dy,
                             mpriv->vspace,0,
-                            MENU_TEXT_TOP|(x < 0 ? MENU_TEXT_RIGHT :MENU_TEXT_LEFT) ,
-                            MENU_TEXT_TOP|(x < 0 ? MENU_TEXT_RIGHT :MENU_TEXT_LEFT));
+                            MENU_TEXT_TOP|MENU_TEXT_LEFT,
+                            MENU_TEXT_TOP|MENU_TEXT_LEFT);
     } else if(mpriv->item_bg >= 0)
       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);
     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,
 			mpriv->vspace,0,
 			MENU_TEXT_TOP|MENU_TEXT_LEFT,



More information about the MPlayer-cvslog mailing list