diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-11-18 16:33:12 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-12-03 13:24:36 +0000 |
commit | e3b6f6d16577c74433de1ca9e15402cdf285abca (patch) | |
tree | ff6a3f155111c51502bf38b0881452afe6cc61fd /src/gui/painting/qdrawhelper_sse2.cpp | |
parent | 5cc1265c340656b02f3bd2fccbadd29a21aa8704 (diff) |
Fix blending of RGB32 on RGB32 with partial opacity
The alpha channel of an RGB32 image was not properly ignored when doing
blending with partial opacity.
Now the alpha value is properly ignored, which is both more correct
and faster. This also makes SSE2 and AVX2 implementations match NEON
which was already doing the right thing (though had dead code for
doing it wrong).
Change-Id: I4613b8d70ed8c2e36ced10baaa7a4a55bd36a940
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/painting/qdrawhelper_sse2.cpp')
-rw-r--r-- | src/gui/painting/qdrawhelper_sse2.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 5ff08e8153..edce70d2d0 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -101,7 +101,6 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, quint32 *dst = (quint32 *) destPixels; if (const_alpha != 256) { if (const_alpha != 0) { - const __m128i nullVector = _mm_set1_epi32(0); const __m128i half = _mm_set1_epi16(0x80); const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); @@ -119,12 +118,10 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, for (; x < w-3; x += 4) { __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); - if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { - const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); - __m128i result; - INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half); - _mm_store_si128((__m128i *)&dst[x], result); - } + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); + __m128i result; + INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half); + _mm_store_si128((__m128i *)&dst[x], result); } SIMD_EPILOGUE(x, w, 3) dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha); |