changeset 36900:ecf965eee74d

Remove casts. Make use of implicit arithmetic conversion and increase precision at that.
author ib
date Wed, 12 Mar 2014 12:01:40 +0000
parents a75d1fce0822
children 97a16ac7f8dd
files gui/ui/main.c gui/ui/playbar.c gui/win32/gui.c
diffstat 3 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/main.c	Wed Mar 12 11:24:23 2014 +0000
+++ b/gui/ui/main.c	Wed Mar 12 12:01:40 2014 +0000
@@ -148,12 +148,12 @@
            {
             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 @@
                  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;
--- a/gui/ui/playbar.c	Wed Mar 12 11:24:23 2014 +0000
+++ b/gui/ui/playbar.c	Wed Mar 12 12:01:40 2014 +0000
@@ -177,12 +177,12 @@
 	 {
 	  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 @@
 	       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;
--- a/gui/win32/gui.c	Wed Mar 12 11:24:23 2014 +0000
+++ b/gui/win32/gui.c	Wed Mar 12 12:01:40 2014 +0000
@@ -935,17 +935,17 @@
                         }
                         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))