diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-05-14 12:49:31 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-05-14 16:33:48 +0000 |
commit | 7d3f353a5bd573dc0e72f7f55c70212a6b3837fa (patch) | |
tree | a7af6c7322a346f049f731cfb50ebd3908c0ce5f /src/plugins/platforms | |
parent | 7d1ec1ae9e263df1a655e13f8feea7b5a5c7d9ed (diff) |
xcb: Fix FP1616 to double conversion
We should divide the fractional part of the FP1616 value by 0x10000
instead of 0xFFFF, otherwise 1.FFFF will be converted to 2.0.
And right-shifting the integer part by 16 is equal to dividing it
by 0x10000. So just divide the whole FP1616 value by 0x10000.
Change-Id: Ia89a274b81be9cf502e1f311f696a610a7f37d7f
Task-number: QTBUG-45378
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 2895a2762a..c43816fa05 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -450,7 +450,7 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id) #if defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) static qreal fixed1616ToReal(FP1616 val) { - return (qreal(val >> 16)) + (val & 0xFFFF) / (qreal)0xFFFF; + return qreal(val) / 0x10000; } #endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) |