comparison gui/win32/gui.c @ 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 049db0aeea85
children 40ad45360c8a
comparison
equal deleted inserted replaced
36899:a75d1fce0822 36900:ecf965eee74d
933 item->x = GET_X_LPARAM(lParam); 933 item->x = GET_X_LPARAM(lParam);
934 wd = item->wwidth; 934 wd = item->wwidth;
935 } 935 }
936 else item->x = GET_X_LPARAM(lParam) - gui->mousewx; 936 else item->x = GET_X_LPARAM(lParam) - gui->mousewx;
937 937
938 item->value = ((item->x - item->wx) * 100.0f) / (float) wd; 938 item->value = 100.0 * (item->x - item->wx) / wd;
939 } 939 }
940 if(item->type == tyVpotmeter) 940 if(item->type == tyVpotmeter)
941 { 941 {
942 item->y = GET_Y_LPARAM(lParam) - gui->mousewy; 942 item->y = GET_Y_LPARAM(lParam) - gui->mousewy;
943 item->value = 100.0f - ((item->y - item->wy) * 100.0f) / (float) (item->wheight - item->height); 943 item->value = 100.0 - 100.0 * (item->y - item->wy) / (item->wheight - item->height);
944 } 944 }
945 if(item->type == tyPotmeter) 945 if(item->type == tyPotmeter)
946 { 946 {
947 gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x; 947 gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;
948 item->value = (gui->mousewx * 100.0f) / (float) item->wwidth; 948 item->value = 100.0 * gui->mousewx / item->wwidth;
949 } 949 }
950 950
951 if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter)) 951 if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter))
952 { 952 {
953 /* Bound checks */ 953 /* Bound checks */