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>
bb10
Allan Sandfeld Jensen 2015-06-30 11:22:32 +02:00 committed by Liang Qi
parent 52e7aba6bf
commit 49049d9047
1 changed files with 2 additions and 2 deletions

View File

@ -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);