summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-08-03 14:20:54 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:01:04 +0000
commitb643d6f347a72ebe97f63dce1d63414d8ced6405 (patch)
treeb84482995e36343d0b7b97fdc09c6cf822c3065d /src
parentbc4ce55fff78610c15d6c8a0cb97526889cb5de3 (diff)
Fix 64-bit bilinear scaled image sampling
A constraint ensuring we do not sample beyond the current scan-line was missing in the SSE2 optimized sampling. Discovered with lancelot. Change-Id: Ib0ece8f8bfaa034733873dc5b8baaaad5d4c0380 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qdrawhelper.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index f0e5810b54..a0f7155c67 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2815,10 +2815,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
sbuf2[i * 2 + 1] = ((const uint*)s2)[x2];
fx += fdx;
}
+ int fastLen;
+ if (fdx > 0)
+ fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11));
+ else
+ fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11));
+ fastLen -= 3;
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
- for (; i < len-3; i+=4) {
+ for (; i < fastLen; i += 4) {
int offset = _mm_extract_epi16(v_fx, 1);
sbuf1[i * 2 + 0] = ((const uint*)s1)[offset];
sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1];