diff options
author | lolbot-iichan | 2019-06-15 23:21:48 +0300 |
---|---|---|
committer | Filippos Karapetis | 2019-06-24 11:27:44 +0300 |
commit | c4dc251f2b3e1f8174136e2880561a6e64bf7411 (patch) | |
tree | b1081411c2edff5e0ec87c4c23436e04b89b8303 /graphics | |
parent | 66bd815e044de2d0ca543a225ccc72bfe84021d1 (diff) | |
download | scummvm-rg350-c4dc251f2b3e1f8174136e2880561a6e64bf7411.tar.gz scummvm-rg350-c4dc251f2b3e1f8174136e2880561a6e64bf7411.tar.bz2 scummvm-rg350-c4dc251f2b3e1f8174136e2880561a6e64bf7411.zip |
GRAPHICS: Fix fully transparent pixel blit
In BLEND_NORMAL mode with color != 0xffffffff, blending fully
transparent pixel was resulted in slightly modifying some background
colors, because old value X was a bit different from new value (X*255>>8).
This fixes defect #10686 WME: Sprite background is not fully transparent
if AlphaColor is set
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/transparent_surface.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/graphics/transparent_surface.cpp b/graphics/transparent_surface.cpp index 02611aa60f..b4d73d1078 100644 --- a/graphics/transparent_surface.cpp +++ b/graphics/transparent_surface.cpp @@ -177,14 +177,17 @@ void doBlitAlphaBlend(byte *ino, byte *outo, uint32 width, uint32 height, uint32 for (uint32 j = 0; j < width; j++) { uint32 ina = in[kAIndex] * ca >> 8; - out[kAIndex] = 255; - out[kBIndex] = (out[kBIndex] * (255 - ina) >> 8); - out[kGIndex] = (out[kGIndex] * (255 - ina) >> 8); - out[kRIndex] = (out[kRIndex] * (255 - ina) >> 8); - out[kBIndex] = out[kBIndex] + (in[kBIndex] * ina * cb >> 16); - out[kGIndex] = out[kGIndex] + (in[kGIndex] * ina * cg >> 16); - out[kRIndex] = out[kRIndex] + (in[kRIndex] * ina * cr >> 16); + if (ina != 0) { + out[kAIndex] = 255; + out[kBIndex] = (out[kBIndex] * (255 - ina) >> 8); + out[kGIndex] = (out[kGIndex] * (255 - ina) >> 8); + out[kRIndex] = (out[kRIndex] * (255 - ina) >> 8); + + out[kBIndex] = out[kBIndex] + (in[kBIndex] * ina * cb >> 16); + out[kGIndex] = out[kGIndex] + (in[kGIndex] * ina * cg >> 16); + out[kRIndex] = out[kRIndex] + (in[kRIndex] * ina * cr >> 16); + } in += inStep; out += 4; |