[Scummvm-git-logs] scummvm master -> 42a5aac4078a95b77cf762c746d209c020e8c668
phcoder
noreply at scummvm.org
Fri Jan 20 02:45:41 UTC 2023
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:
42a5aac407 SURFACESDL: Fix overlay background when using hardware palette
Commit: 42a5aac4078a95b77cf762c746d209c020e8c668
https://github.com/scummvm/scummvm/commit/42a5aac4078a95b77cf762c746d209c020e8c668
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-01-20T05:45:37+03:00
Commit Message:
SURFACESDL: Fix overlay background when using hardware palette
Changed paths:
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index e3cb5eab1c9..34d7f0dfe48 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1836,6 +1836,19 @@ void SurfaceSdlGraphicsManager::clearOverlay() {
SDL_LockSurface(_tmpscreen);
SDL_LockSurface(_overlayscreen);
+ // Transpose from game palette to RGB332 (overlay palette)
+ if (_videoMode.isHwPalette) {
+ byte *p = (byte *)(_tmpscreen->pixels) + _maxExtraPixels * _tmpscreen->pitch + _maxExtraPixels * _tmpscreen->format->BytesPerPixel;
+ int pitchSkip = _tmpscreen->pitch - _videoMode.screenWidth;
+ for (int y = 0; y < _videoMode.screenHeight; y++) {
+ for (int x = 0; x < _videoMode.screenWidth; x++, p++) {
+ const SDL_Color &col = _currentPalette[*p];
+ *p = (col.r & 0xe0) | ((col.g >> 3) & 0x1c) | ((col.b >> 6) & 0x03);
+ }
+ p += pitchSkip;
+ }
+ }
+
_scaler->scale((byte *)(_tmpscreen->pixels) + _maxExtraPixels * _tmpscreen->pitch + _maxExtraPixels * _tmpscreen->format->BytesPerPixel, _tmpscreen->pitch,
(byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight, 0, 0);
More information about the Scummvm-git-logs
mailing list