mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
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:
parent
7038ca8d52
commit
e14ad93c0a
@ -191,9 +191,9 @@ void WebPCleanupTransparentAreaLossless(WebPPicture* const pic) {
|
|||||||
// Blend color and remove transparency info
|
// Blend color and remove transparency info
|
||||||
|
|
||||||
#define BLEND(V0, V1, ALPHA) \
|
#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) \
|
#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) {
|
void WebPBlendAlpha(WebPPicture* pic, uint32_t background_rgb) {
|
||||||
const int red = (background_rgb >> 16) & 0xff;
|
const int red = (background_rgb >> 16) & 0xff;
|
||||||
|
Loading…
Reference in New Issue
Block a user