diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-06-30 11:22:32 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-07-01 04:28:31 +0000 |
commit | 49049d90470eb3e94bda77d19ab7f7c57a0bd57f (patch) | |
tree | cca119c91214ba749eb55ac2e775660b3af1ade1 /src/gui/painting/qblendfunctions.cpp | |
parent | 52e7aba6bf717c673151c9267040c7a90dbea039 (diff) |
Fix simple semi-transparent blending of RGB32 on RGB30
We can not rely on the alpha being preserved as part of the source when
the source is converted to a2rgb30 which has much less alpha accuracy
instead we need to apply the alpha on the result.
Change-Id: Iac3104666980825e44ed3490370cdbe21dc68008
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/painting/qblendfunctions.cpp')
-rw-r--r-- | src/gui/painting/qblendfunctions.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index b3710411c9..dbdd82e432 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -422,8 +422,8 @@ static void qt_blend_argb32pm_on_a2rgb30pm(uchar *destPixels, int dbpl, const_alpha = (const_alpha * 255) >> 8; for (int y=0; y<h; ++y) { for (int x=0; x<w; ++x) { - uint s = BYTE_MUL(src[x], const_alpha); - dst[x] = qConvertArgb32ToA2rgb30<PixelOrder>(s) + BYTE_MUL_RGB30(dst[x], 255 - qAlpha(s)); + uint s = src[x]; + dst[x] = BYTE_MUL_RGB30(qConvertArgb32ToA2rgb30<PixelOrder>(s), const_alpha) + BYTE_MUL_RGB30(dst[x], 255 - qt_div_255(qAlpha(s) * const_alpha)); } dst = (quint32 *)(((uchar *) dst) + dbpl); src = (const quint32 *)(((const uchar *) src) + sbpl); |