Dan Kegel : winex11: wintab.c: use atan2 instead of atan.
Alexandre Julliard
julliard at winehq.org
Fri Mar 7 05:30:09 CST 2008
Module: wine
Branch: master
Commit: 1eba6c7644f801f82c66b109f39d754f0c4e05f2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1eba6c7644f801f82c66b109f39d754f0c4e05f2
Author: Dan Kegel <dank at kegel.com>
Date: Thu Mar 6 12:33:09 2008 -0800
winex11: wintab.c: use atan2 instead of atan.
---
dlls/winex11.drv/wintab.c | 33 ++++++---------------------------
1 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index da18ce0..e5d7071 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -742,35 +742,14 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
static int figure_deg(int x, int y)
{
- int rc;
+ float angle;
- if (y != 0)
- {
- rc = (int) 10 * (atan( (FLOAT)abs(y) / (FLOAT)abs(x)) / (3.1415 / 180));
- if (y>0)
- {
- if (x>0)
- rc += 900;
- else
- rc = 2700 - rc;
- }
- else
- {
- if (x>0)
- rc = 900 - rc;
- else
- rc += 2700;
- }
- }
- else
- {
- if (x >= 0)
- rc = 900;
- else
- rc = 2700;
- }
+ angle = atan2((float)y, (float)x);
+ angle += M_PI_2;
+ if (angle <= 0)
+ angle += 2 * M_PI;
- return rc;
+ return (0.5 + (angle * 1800.0 / M_PI));
}
static int get_button_state(int curnum)
More information about the wine-cvs
mailing list