From e3b6f6d16577c74433de1ca9e15402cdf285abca Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 18 Nov 2016 16:33:12 +0100 Subject: [PATCH] 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 --- src/gui/painting/qblendfunctions.cpp | 30 +++++++++++-------- src/gui/painting/qdrawhelper_avx2.cpp | 8 ++--- src/gui/painting/qdrawhelper_neon.cpp | 2 -- src/gui/painting/qdrawhelper_sse2.cpp | 11 +++---- .../gui/painting/qpainter/tst_qpainter.cpp | 20 +++++++++++++ 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 0a5d458532d..a4a091a29f9 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -385,19 +385,25 @@ void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl, destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); fflush(stdout); #endif - - if (const_alpha != 256) { - qt_blend_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); - return; - } - const uint *src = (const uint *) srcPixels; uint *dst = (uint *) destPixels; - int len = w * 4; - for (int y=0; y> 8; + int ialpha = 255 - const_alpha; + for (int y=0; y