mirror of https://github.com/mpv-player/mpv
simple, smooth, ram-saving dynamic potmeter, which feature is required by the tvisor skin, patch by Andre Kuhne
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12694 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
51a160c40a
commit
d92f988596
|
@ -214,6 +214,30 @@ void PutImage( txSample * bf,int x,int y,int max,int ofs )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SimplePotmeterPutImage( txSample * bf,int x,int y,float frac )
|
||||||
|
{
|
||||||
|
int i=0,w,r,ix,iy;
|
||||||
|
uint32_t * buf = NULL;
|
||||||
|
uint32_t * drw = NULL;
|
||||||
|
register uint32_t tmp;
|
||||||
|
|
||||||
|
if ( ( !bf )||( bf->Image == NULL ) ) return;
|
||||||
|
|
||||||
|
buf=(uint32_t *)image_buffer;
|
||||||
|
drw=(uint32_t *)bf->Image;
|
||||||
|
w=bf->Width*frac;
|
||||||
|
r=bf->Width-w;
|
||||||
|
for ( iy=y;iy < (int)(y+bf->Height);iy++ )
|
||||||
|
{
|
||||||
|
for ( ix=x;ix < (int)(x+w);ix++ )
|
||||||
|
{
|
||||||
|
tmp=drw[i++];
|
||||||
|
if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
|
||||||
|
}
|
||||||
|
i+=r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size )
|
void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size )
|
||||||
{
|
{
|
||||||
wItem * item;
|
wItem * item;
|
||||||
|
@ -232,10 +256,12 @@ void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size )
|
||||||
PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
|
PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
|
||||||
break;
|
break;
|
||||||
case itPotmeter:
|
case itPotmeter:
|
||||||
PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
|
if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
|
||||||
|
else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
|
||||||
break;
|
break;
|
||||||
case itHPotmeter:
|
case itHPotmeter:
|
||||||
PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) );
|
if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
|
||||||
|
else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
|
||||||
PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed );
|
PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed );
|
||||||
break;
|
break;
|
||||||
case itVPotmeter:
|
case itVPotmeter:
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
extern inline void TranslateFilename( int c,char * tmp );
|
extern inline void TranslateFilename( int c,char * tmp );
|
||||||
extern char * Translate( char * str );
|
extern char * Translate( char * str );
|
||||||
extern void PutImage( txSample * bf,int x,int y,int max,int ofs );
|
extern void PutImage( txSample * bf,int x,int y,int max,int ofs );
|
||||||
|
extern void SimplePotmeterPutImage( txSample * bf,int x,int y,float frac );
|
||||||
extern void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size );
|
extern void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue