Reduce recent performance regression

The change to fix 16-bit integer overflow used two floor operations
when only one is necessary. With floor being rather expensive on x86
without SSE4.1 this caused a performance regression in ARGB32
smooth perspective transforms.

This eliminates one of the floor operations which is unnecessary as the
number is always positive in this case and thus truncation will yield
the same result faster.

Change-Id: Iaae76820d4bc2f368e49ed143130b5075fc760a2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2018-05-28 14:33:58 +02:00
parent d517d5428c
commit ffc377a529

View File

@ -3198,8 +3198,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
int y1 = qFloor(py);
int y2;
distxs[i] = qFloor((px - x1) * (1<<16));
distys[i] = qFloor((py - y1) * (1<<16));
distxs[i] = int((px - x1) * (1<<16));
distys[i] = int((py - y1) * (1<<16));
fetchTransformedBilinear_pixelBounds<blendType>(image.width, image.x1, image.x2 - 1, x1, x2);
fetchTransformedBilinear_pixelBounds<blendType>(image.height, image.y1, image.y2 - 1, y1, y2);