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

peterkohaut peterkohaut at users.noreply.github.com
Mon Jun 24 21:51:06 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:
dd0c030278 BLADERUNNER: Fixed alpha channel issues


Commit: dd0c0302782246d50290edd8681f03033078254c
    https://github.com/scummvm/scummvm/commit/dd0c0302782246d50290edd8681f03033078254c
Author: Peter Kohaut (peter.kohaut at gmail.com)
Date: 2019-06-24T21:45:56+02:00

Commit Message:
BLADERUNNER: Fixed alpha channel issues

Alpha channel is inverted in the game assets and that lead to issues in
OpenGL renderer. E.g. screenshot of savegames were partly black or
showing artifacts

closes #10983

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/font.cpp
    engines/bladerunner/shape.cpp
    engines/bladerunner/vqa_decoder.cpp


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index e3e5429..9621612 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -2163,14 +2163,18 @@ void BladeRunnerEngine::blitToScreen(const Graphics::Surface &src) const {
 
 Graphics::Surface BladeRunnerEngine::generateThumbnail() const {
 	Graphics::Surface thumbnail;
-	thumbnail.create(640 / 8, 480 / 8, _surfaceFront.format);
+	thumbnail.create(640 / 8, 480 / 8, gameDataPixelFormat());
 
 	for (int y = 0; y < thumbnail.h; ++y) {
 		for (int x = 0; x < thumbnail.w; ++x) {
-			uint16       *dstPixel = (uint16 *)thumbnail.getBasePtr(x, y);
-			const uint16 *srcPixel = (const uint16 *)_surfaceFront.getBasePtr(x * 8, y * 8);
+			uint8 r, g, b;
 
-			*dstPixel = *srcPixel;
+			uint16  srcPixel = *(uint16 *)_surfaceFront.getBasePtr(x * 8, y * 8);
+			uint16 *dstPixel = (uint16 *)thumbnail.getBasePtr(x, y);
+
+			// Throw away alpha channel as it is not needed
+			_surfaceFront.format.colorToRGB(srcPixel, r, g, b);
+			*dstPixel = thumbnail.format.RGBToColor(r, g, b);
 		}
 	}
 
diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp
index c10c12d..703495c 100644
--- a/engines/bladerunner/font.cpp
+++ b/engines/bladerunner/font.cpp
@@ -199,6 +199,7 @@ void Font::drawCharacter(const uint8 character, Graphics::Surface &surface, int
 			gameDataPixelFormat().colorToARGB(*srcPtr, a, r, g, b);
 			if (!a) {
 				if (_color == _defaultColor) {
+					// Ignore the alpha in the output as it is inversed in the input
 					*dstPtr = surface.format.RGBToColor(r, g, b);
 				} else {
 					*dstPtr = _color;
diff --git a/engines/bladerunner/shape.cpp b/engines/bladerunner/shape.cpp
index 39a7758..2d01d13 100644
--- a/engines/bladerunner/shape.cpp
+++ b/engines/bladerunner/shape.cpp
@@ -112,7 +112,8 @@ void Shape::draw(Graphics::Surface &surface, int x, int y) const {
 
 			uint8 a, r, g, b;
 			gameDataPixelFormat().colorToARGB(shpColor, a, r, g, b);
-			uint16 outColor = (uint16)surface.format.ARGBToColor(a, r, g, b);
+			// Ignore the alpha in the output as it is inversed in the input
+			uint16 outColor = (uint16)surface.format.RGBToColor(r, g, b);
 
 			if (!a) {
 				*(uint16 *)(surface.getBasePtr(dst_x + xi, dst_y + yi)) = outColor;
diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp
index 3b230ef..6873785 100644
--- a/engines/bladerunner/vqa_decoder.cpp
+++ b/engines/bladerunner/vqa_decoder.cpp
@@ -835,7 +835,8 @@ void VQADecoder::VQAVideoTrack::VPTRWriteBlock(Graphics::Surface *surface, unsig
 
 				uint8 a, r, g, b;
 				gameDataPixelFormat().colorToARGB(vqaColor, a, r, g, b);
-				uint16 outColor = (uint16)surface->format.ARGBToColor(a, r, g, b);
+				// Ignore the alpha in the output as it is inversed in the input
+				uint16 outColor = (uint16)surface->format.RGBToColor(r, g, b);
 
 				if (!(alpha && a)) {
 					*(uint16 *)(surface->getBasePtr(dst_x + x, dst_y + y)) = outColor;





More information about the Scummvm-git-logs mailing list