From: Terje Gundersen Date: Tue, 24 Dec 2013 09:51:57 +0000 (+0100) Subject: graphics: splash - correct rounding in alpha blending X-Git-Tag: 43~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1e9c555235d0acf1d2efd6c1abe39b09856639f;p=platform%2Fupstream%2Fgummiboot.git graphics: splash - correct rounding in alpha blending "(X >> 8)" always rounds down, but "(X + 0x80) >> 8)" rounds to the nearest integer. --- diff --git a/src/efi/graphics.c b/src/efi/graphics.c index d3f674b..062ce27 100644 --- a/src/efi/graphics.c +++ b/src/efi/graphics.c @@ -222,8 +222,8 @@ static void pixel_blend(UINT32 *dst, const UINT32 source) { dst_g = (*dst & 0x00ff00); /* blend */ - rb = ((((src_rb - dst_rb) * alpha) >> 8) + dst_rb) & 0xff00ff; - g = ((((src_g - dst_g) * alpha) >> 8) + dst_g) & 0x00ff00; + rb = ((((src_rb - dst_rb) * alpha + 0x800080) >> 8) + dst_rb) & 0xff00ff; + g = ((((src_g - dst_g) * alpha + 0x008000) >> 8) + dst_g) & 0x00ff00; *dst = (rb | g); }