[MPlayer-cvslog] r36996 - in trunk/gui: ui/main.c ui/playbar.c win32/gui.c
ib
subversion at mplayerhq.hu
Wed Mar 12 13:01:40 CET 2014
Author: ib
Date: Wed Mar 12 13:01:40 2014
New Revision: 36996
Log:
Remove casts.
Make use of implicit arithmetic conversion
and increase precision at that.
Modified:
trunk/gui/ui/main.c
trunk/gui/ui/playbar.c
trunk/gui/win32/gui.c
Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c Wed Mar 12 12:24:23 2014 (r36995)
+++ trunk/gui/ui/main.c Wed Mar 12 13:01:40 2014 (r36996)
@@ -148,12 +148,12 @@ static void uiMainMouse( int Button,int
{
case itPotmeter:
case itHPotmeter:
- btnModify( item->message,(float)( X - item->x ) / item->width * 100.0 );
+ btnModify( item->message,100.0 * ( X - item->x ) / item->width );
uiEvent( item->message,item->value );
value=item->value;
break;
case itVPotmeter:
- btnModify( item->message, ( 1.0 - (float)( Y - item->y ) / item->height) * 100.0 );
+ btnModify( item->message,100.0 - 100.0 * ( Y - item->y ) / item->height );
uiEvent( item->message,item->value );
value=item->value;
break;
@@ -194,13 +194,13 @@ rollerhandled:
if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
break;
case itPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0;
+ item->value=100.0 * ( X - item->x ) / item->width;
goto potihandled;
case itVPotmeter:
- item->value=(1.0 - (float)( Y - item->y ) / item->height) * 100.0;
+ item->value=100.0 - 100.0 * ( Y - item->y ) / item->height;
goto potihandled;
case itHPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0;
+ item->value=100.0 * ( X - item->x ) / item->width;
potihandled:
if ( item->value > 100.0f ) item->value=100.0f;
if ( item->value < 0.0f ) item->value=0.0f;
Modified: trunk/gui/ui/playbar.c
==============================================================================
--- trunk/gui/ui/playbar.c Wed Mar 12 12:24:23 2014 (r36995)
+++ trunk/gui/ui/playbar.c Wed Mar 12 13:01:40 2014 (r36996)
@@ -177,12 +177,12 @@ static void uiPlaybarMouse( int Button,
{
case itPotmeter:
case itHPotmeter:
- btnModify( item->message,(float)( X - item->x ) / item->width * 100.0 );
+ btnModify( item->message,100.0 * ( X - item->x ) / item->width);
uiEvent( item->message,item->value );
value=item->value;
break;
case itVPotmeter:
- btnModify( item->message, ( 1.0 - (float)( Y - item->y ) / item->height) * 100.0 );
+ btnModify( item->message,100.0 - 100.0 * ( Y - item->y ) / item->height );
uiEvent( item->message,item->value );
value=item->value;
break;
@@ -215,13 +215,13 @@ rollerhandled:
if (guiApp.menuIsPresent) guiApp.menuWindow.MouseHandler( 0,RX,RY,0,0 );
break;
case itPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0;
+ item->value=100.0 * ( X - item->x ) / item->width;
goto potihandled;
case itVPotmeter:
- item->value=(1.0 - (float)( Y - item->y ) / item->height) * 100.0;
+ item->value=100.0 - 100.0 * ( Y - item->y ) / item->height;
goto potihandled;
case itHPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0;
+ item->value=100.0 * ( X - item->x ) / item->width;
potihandled:
if ( item->value > 100.0f ) item->value=100.0f;
if ( item->value < 0.0f ) item->value=0.0f;
Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c Wed Mar 12 12:24:23 2014 (r36995)
+++ trunk/gui/win32/gui.c Wed Mar 12 13:01:40 2014 (r36996)
@@ -935,17 +935,17 @@ static LRESULT CALLBACK EventProc(HWND h
}
else item->x = GET_X_LPARAM(lParam) - gui->mousewx;
- item->value = ((item->x - item->wx) * 100.0f) / (float) wd;
+ item->value = 100.0 * (item->x - item->wx) / wd;
}
if(item->type == tyVpotmeter)
{
item->y = GET_Y_LPARAM(lParam) - gui->mousewy;
- item->value = 100.0f - ((item->y - item->wy) * 100.0f) / (float) (item->wheight - item->height);
+ item->value = 100.0 - 100.0 * (item->y - item->wy) / (item->wheight - item->height);
}
if(item->type == tyPotmeter)
{
gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;
- item->value = (gui->mousewx * 100.0f) / (float) item->wwidth;
+ item->value = 100.0 * gui->mousewx / item->wwidth;
}
if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter))
More information about the MPlayer-cvslog
mailing list