[Scummvm-git-logs] scummvm master -> c4dc251f2b3e1f8174136e2880561a6e64bf7411

bluegr bluegr at gmail.com
Mon Jun 24 10:27:48 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c4dc251f2b GRAPHICS: Fix fully transparent pixel blit


Commit: c4dc251f2b3e1f8174136e2880561a6e64bf7411
    https://github.com/scummvm/scummvm/commit/c4dc251f2b3e1f8174136e2880561a6e64bf7411
Author: lolbot-iichan (lolbot_iichan at mail.ru)
Date: 2019-06-24T11:27:44+03:00

Commit Message:
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

Changed paths:
    graphics/transparent_surface.cpp


diff --git a/graphics/transparent_surface.cpp b/graphics/transparent_surface.cpp
index 02611aa..b4d73d1 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;





More information about the Scummvm-git-logs mailing list