[Scummvm-git-logs] scummvm master -> 39782a2f37d673f5b1e765fd50af405637cf67b1
neuromancer
neuromancer at users.noreply.github.com
Sat Sep 11 11:41:35 UTC 2021
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:
39782a2f37 PRIVATE: improved color handling in PS3 code
Commit: 39782a2f37d673f5b1e765fd50af405637cf67b1
https://github.com/scummvm/scummvm/commit/39782a2f37d673f5b1e765fd50af405637cf67b1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-09-11T13:40:22+02:00
Commit Message:
PRIVATE: improved color handling in PS3 code
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index d46d89cee6..4d3d2d339c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -205,17 +205,16 @@ Common::Error PrivateEngine::run() {
_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
initGraphics(_screenW, _screenH, &_pixelFormat);
-
+ _transparentColor = 250;
#else
initGraphics(_screenW, _screenH, nullptr);
_pixelFormat = g_system->getScreenFormat();
if (_pixelFormat == Graphics::PixelFormat::createFormatCLUT8())
return Common::kUnsupportedColorMode;
-
+ _transparentColor = _pixelFormat.RGBToColor(0, 255, 0);
#endif
- _transparentColor = _pixelFormat.RGBToColor(0, 255, 0);
_safeColor = _pixelFormat.RGBToColor(65, 65, 65);
screenRect = Common::Rect(0, 0, _screenW, _screenH);
changeCursor("default");
@@ -1226,9 +1225,24 @@ Graphics::Surface *PrivateEngine::decodeImage(const Common::String &name) {
return _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
}
+const byte *PrivateEngine::decodePalette(const Common::String &name) {
+ debugC(1, kPrivateDebugFunction, "%s(%s)", __FUNCTION__, name.c_str());
+ Common::File file;
+ Common::String path = convertPath(name);
+ if (!file.open(path))
+ error("unable to load image %s", path.c_str());
+
+ _image->loadStream(file);
+ return _image->getPalette();
+}
+
void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d)", __FUNCTION__, name.c_str(), x, y);
Graphics::Surface *surf = decodeImage(name);
+#ifdef PLAYSTATION3
+ const byte *palette = decodePalette(name);
+ g_system->getPaletteManager()->setPalette(palette, 0, 256);
+#endif
_compositeSurface->transBlitFrom(*surf, _origin + Common::Point(x, y), _transparentColor);
surf->free();
delete surf;
diff --git a/engines/private/private.h b/engines/private/private.h
index ccf42c6981..f6ffd3f3cd 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -200,6 +200,7 @@ public:
void skipVideo();
Graphics::Surface *decodeImage(const Common::String &file);
+ const byte *decodePalette(const Common::String &name);
void loadImage(const Common::String &file, int x, int y);
void drawScreenFrame();
More information about the Scummvm-git-logs
mailing list