From 7d3f353a5bd573dc0e72f7f55c70212a6b3837fa Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 14 May 2015 12:49:31 +0300 Subject: 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 --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3