aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/bladerunner.cpp
diff options
context:
space:
mode:
authorPeter Kohaut2019-06-24 21:43:43 +0200
committerPeter Kohaut2019-06-24 21:45:56 +0200
commitdd0c0302782246d50290edd8681f03033078254c (patch)
tree038c210b1ba00df56e14afa69216e37025e877b2 /engines/bladerunner/bladerunner.cpp
parent3036f8161ad86c10af14a3e37b8c788bcf17633f (diff)
downloadscummvm-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/bladerunner/bladerunner.cpp')
-rw-r--r--engines/bladerunner/bladerunner.cpp12
1 files changed, 8 insertions, 4 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);
}
}