diff options
author | Martin Smith <martin.smith@nokia.com> | 2010-07-22 11:27:57 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2010-07-22 11:27:57 (GMT) |
commit | cf1f76661613313615a77479687fa93a3c97efc9 (patch) | |
tree | 978b8d1117224773952d1d2782d7825920bfc6ed /src/gui/painting/qdrawhelper_sse2.cpp | |
parent | d8908922f339892fee4275a433e2bf6da87ae055 (diff) | |
parent | be227b0a01bb28f3ebebedc1aaa65cd8098edd81 (diff) | |
download | Qt-cf1f76661613313615a77479687fa93a3c97efc9.zip Qt-cf1f76661613313615a77479687fa93a3c97efc9.tar.gz Qt-cf1f76661613313615a77479687fa93a3c97efc9.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/gui/painting/qdrawhelper_sse2.cpp')
-rw-r--r-- | src/gui/painting/qdrawhelper_sse2.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 346e177..279f685 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -110,13 +110,23 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); for (int y = 0; y < h; ++y) { int x = 0; + + // First, align dest to 16 bytes: + const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3; + const int prologLength = qMin(w, offsetToAlignOn16Bytes); + for (; x < prologLength; ++x) { + quint32 s = src[x]; + s = BYTE_MUL(s, const_alpha); + dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha); + } + for (; x < w-3; x += 4) { __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i result; INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half); - _mm_storeu_si128((__m128i *)&dst[x], result); + _mm_store_si128((__m128i *)&dst[x], result); } } for (; x<w; ++x) { |