diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-08-17 17:05:35 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-08-17 17:21:17 (GMT) |
commit | 837b6bba916c39665884e4967d70808f863c4487 (patch) | |
tree | 7740e6329c5929dcfc93d7a3febc3ecd9225e9a6 | |
parent | b2056bcd48aa2288f1879de4d0f53cff443e4b16 (diff) | |
download | Qt-837b6bba916c39665884e4967d70808f863c4487.zip Qt-837b6bba916c39665884e4967d70808f863c4487.tar.gz Qt-837b6bba916c39665884e4967d70808f863c4487.tar.bz2 |
Fix the blending of ARGB_PM image when using palignr to load the data
The data loaded for the first were incorrect because the offset was
incorrect. The correct offset should be up to the alignment point.
Instead of trying to load a temporary array, we just move one vector
further since we know reading there is always safe.
Reviewed-by: Andreas Kling
-rw-r--r-- | src/gui/painting/qdrawhelper_ssse3.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index bc4a7eb8..9c02009 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -118,22 +118,12 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) \ /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\ __m128i srcVectorPrevLoaded;\ - if (minusOffsetToAlignSrcOn16Bytes <= prologLength) {\ - srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ - } else {\ - quint32 temp[4] Q_DECL_ALIGN(16);\ - switch (prologLength) {\ - case 3:\ - temp[1] = src[x - 3];\ - case 2:\ - temp[2] = src[x - 2];\ - case 1:\ - temp[3] = src[x - 1];\ - default:\ - break;\ - }\ - srcVectorPrevLoaded = _mm_load_si128((__m128i *)temp);\ + if (minusOffsetToAlignSrcOn16Bytes > prologLength) {\ + /* We go forward 4 pixels to avoid reading before src. */\ + for (; x < prologLength + 4; ++x)\ + blend_pixel(dst[x], src[x]); \ }\ + srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\ \ const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ |