Make sure we reach the full range for alpha blending.

255*255*257>>16 == 254 while we want 255.

BUG=webp:360

Change-Id: I2b9ac18f8802145f5a3d500c149ad9eceacbd75b
This commit is contained in:
Vincent Rabaud 2017-10-05 16:37:02 +02:00
parent 7038ca8d52
commit e14ad93c0a

View File

@ -191,9 +191,9 @@ void WebPCleanupTransparentAreaLossless(WebPPicture* const pic) {
// Blend color and remove transparency info
#define BLEND(V0, V1, ALPHA) \
((((V0) * (255 - (ALPHA)) + (V1) * (ALPHA)) * 0x101) >> 16)
((((V0) * (255 - (ALPHA)) + (V1) * (ALPHA)) * 0x101 + 256) >> 16)
#define BLEND_10BIT(V0, V1, ALPHA) \
((((V0) * (1020 - (ALPHA)) + (V1) * (ALPHA)) * 0x101) >> 18)
((((V0) * (1020 - (ALPHA)) + (V1) * (ALPHA)) * 0x101 + 1024) >> 18)
void WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb) {
const int red = (background_rgb >> 16) & 0xff;