From 9bc616948f28b9d90dc0cd0230d416317eeab8f0 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 26 Apr 2018 14:24:10 +0200 Subject: Optimize direct argb32 blend functions They were slower than the long path version due to working too hard. This also unduplicates code by using the blend_pixel function. Change-Id: Ibf84b8f749cf40d4c852b459dc76860afd850d32 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qblendfunctions.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index a4a091a29f..2dd5144e40 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -430,28 +430,28 @@ struct Blend_RGB32_on_RGB32_ConstAlpha { }; struct Blend_ARGB32_on_ARGB32_SourceAlpha { - inline void write(quint32 *dst, quint32 src) { - *dst = src + BYTE_MUL(*dst, qAlpha(~src)); + inline void write(quint32 *dst, quint32 src) + { + blend_pixel(*dst, src); } inline void flush(void *) {} }; struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha { - inline Blend_ARGB32_on_ARGB32_SourceAndConstAlpha(quint32 alpha) { + inline Blend_ARGB32_on_ARGB32_SourceAndConstAlpha(quint32 alpha) + { m_alpha = (alpha * 255) >> 8; - m_ialpha = 255 - m_alpha; } - inline void write(quint32 *dst, quint32 src) { - src = BYTE_MUL(src, m_alpha); - *dst = src + BYTE_MUL(*dst, qAlpha(~src)); + inline void write(quint32 *dst, quint32 src) + { + blend_pixel(*dst, src, m_alpha); } inline void flush(void *) {} quint32 m_alpha; - quint32 m_ialpha; }; void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl, -- cgit v1.2.3