summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper_p.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-09-06 11:03:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-09-09 14:31:24 +0000
commit806b45e7c76f6825e32fde10824beb62eecc40ab (patch)
tree8013541d154202783de4e8fd9fa9620bd9945460 /src/gui/painting/qdrawhelper_p.h
parentfe82f50a65ecafee9ea7d0e48cf3bb2106414001 (diff)
Make blendPixel function general
Moves the blendPixel function from the SSSE3 file and use it more generally, also adds a const_alpha version. Change-Id: Ia29d1ab3879a845d5b65e0610b7836507e33c7ed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/painting/qdrawhelper_p.h')
-rw-r--r--src/gui/painting/qdrawhelper_p.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 664117a730..45a3174734 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -636,6 +636,22 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
}
#endif
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src)
+{
+ if (src >= 0xff000000)
+ dst = src;
+ else if (src != 0)
+ dst = src + BYTE_MUL(dst, qAlpha(~src));
+}
+
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
+{
+ if (src != 0) {
+ const quint32 s = BYTE_MUL(src, const_alpha);
+ dst = s + BYTE_MUL(dst, qAlpha(~s));
+ }
+}
+
#if defined(__SSE2__)
static Q_ALWAYS_INLINE uint interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty)
{