diff options
author | Peter Kohaut | 2019-06-24 21:43:43 +0200 |
---|---|---|
committer | Peter Kohaut | 2019-06-24 21:45:56 +0200 |
commit | dd0c0302782246d50290edd8681f03033078254c (patch) | |
tree | 038c210b1ba00df56e14afa69216e37025e877b2 /engines | |
parent | 3036f8161ad86c10af14a3e37b8c788bcf17633f (diff) | |
download | scummvm-rg350-dd0c0302782246d50290edd8681f03033078254c.tar.gz scummvm-rg350-dd0c0302782246d50290edd8681f03033078254c.tar.bz2 scummvm-rg350-dd0c0302782246d50290edd8681f03033078254c.zip |
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
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 12 | ||||
-rw-r--r-- | engines/bladerunner/font.cpp | 1 | ||||
-rw-r--r-- | engines/bladerunner/shape.cpp | 3 | ||||
-rw-r--r-- | engines/bladerunner/vqa_decoder.cpp | 3 |
4 files changed, 13 insertions, 6 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index e3e54299fb..9621612ac6 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 c10c12db81..703495cd79 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 39a7758a0f..2d01d1336a 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 3b230ef6c6..68737858ca 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; |