# HG changeset patch # User ib # Date 1296742759 0 # Node ID 63844ef43932a22e2c3d525d9432d6b40f2693a9 # Parent ee56fbdc58ab7f9538a2d5950985254d152d2756 Remove useless format argument. Because scrolling of dynamic labels depends on the length of the label text, any other format than %s to render would be pointless. diff -r ee56fbdc58ab -r 63844ef43932 gui/mplayer/gui_common.c --- a/gui/mplayer/gui_common.c Thu Feb 03 14:04:43 2011 +0000 +++ b/gui/mplayer/gui_common.c Thu Feb 03 14:19:19 2011 +0000 @@ -294,14 +294,14 @@ 3,item->pressed ); break; case itSLabel: - image=fntRender( item,0,"%s",item->label ); + image=fntRender( item,0,item->label ); if ( image ) PutImage( image,item->x,item->y,1,0 ); case itDLabel: { char * t = Translate( item->label ); int l = fntTextWidth( item->fontid,t ); l=(l?l:item->width); - image=fntRender( item,l-(GetTimerMS() / 20)%l,"%s",t ); + image=fntRender( item,l-(GetTimerMS() / 20)%l,t ); } if ( image ) PutImage( image,item->x,item->y,1,0 ); break; diff -r ee56fbdc58ab -r 63844ef43932 gui/skin/font.c --- a/gui/skin/font.c Thu Feb 03 14:04:43 2011 +0000 +++ b/gui/skin/font.c Thu Feb 03 14:19:19 2011 +0000 @@ -232,34 +232,29 @@ return max; } -txSample * fntRender( wItem * item,int px,const char * fmt,... ) +txSample * fntRender( wItem * item,int px,char * txt ) { - va_list ap; - unsigned char * u, p[512]; + unsigned char * u; int c, i, dx = 0, tw, fbw, iw, id, ofs; int x,y,fh,fw,fyc,yc; uint32_t * ibuf; uint32_t * obuf; gboolean utf8; - va_start( ap,fmt ); - vsnprintf( p,512,fmt,ap ); - va_end( ap ); - iw=item->width; id=item->fontid; if ( ( !item )|| ( !Fonts[id] )|| - ( !p[0] )|| - ( !fntTextWidth( id,p ) ) ) return NULL; + ( !txt[0] )|| + ( !fntTextWidth( id,txt ) ) ) return NULL; - tw=fntTextWidth( id,p ); + tw=fntTextWidth( id,txt ); fbw=Fonts[id]->Bitmap.Width; if ( item->Bitmap.Image == NULL ) { - item->Bitmap.Height=item->height=fntTextHeight( id,p ); + item->Bitmap.Height=item->height=fntTextHeight( id,txt ); item->Bitmap.Width=item->width=iw; item->Bitmap.ImageSize=item->height * iw * 4; if ( !item->Bitmap.ImageSize ) return NULL; @@ -278,16 +273,16 @@ { default: case fntAlignLeft: dx=0; break; - case fntAlignCenter: dx=( iw - fntTextWidth( id,p ) ) / 2; break; - case fntAlignRight: dx=iw - fntTextWidth( id,p ); break; + case fntAlignCenter: dx=( iw - fntTextWidth( id,txt ) ) / 2; break; + case fntAlignRight: dx=iw - fntTextWidth( id,txt ); break; } } else dx+=px; ofs=dx; - utf8 = g_utf8_validate( p, -1, NULL); - u = p; + utf8 = g_utf8_validate( txt, -1, NULL); + u = txt; while ( *u ) { @@ -315,9 +310,9 @@ if ( ofs > 0 && tw > item->width ) { dx=ofs; - u = p + strlen( p ); + u = txt + strlen( txt ); - while ( u > p ) + while ( u > (unsigned char *) txt ) { c = fntGetCharIndex( id, &u, utf8, -1 ); diff -r ee56fbdc58ab -r 63844ef43932 gui/skin/font.h --- a/gui/skin/font.h Thu Feb 03 14:04:43 2011 +0000 +++ b/gui/skin/font.h Thu Feb 03 14:19:19 2011 +0000 @@ -55,6 +55,6 @@ int fntTextWidth( int id, char * str ); int fntRead( char * path, char * fname ); -txSample * fntRender( wItem * item, int px, const char * fmt, ... ); +txSample * fntRender( wItem * item, int px, char * txt ); #endif /* MPLAYER_GUI_FONT_H */