[Scummvm-git-logs] scummvm master -> a3dd9b15fe4153a0c1bb7aceb693e12abd2408da
bluegr
noreply at scummvm.org
Sun Jan 26 00:56:56 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e31df4f730 IMAGE: Fix TGA color map loading
a3dd9b15fe WINTERMUTE: Remove all patches on TGA loading
Commit: e31df4f730ac17b1250732a77ee015c5f5b959d9
https://github.com/scummvm/scummvm/commit/e31df4f730ac17b1250732a77ee015c5f5b959d9
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-01-26T02:56:53+02:00
Commit Message:
IMAGE: Fix TGA color map loading
The color map ordering is now fixed according to the specifications and
the palette is now stored according to our requirements: in interleaved
RGB.
Changed paths:
image/tga.cpp
diff --git a/image/tga.cpp b/image/tga.cpp
index b4faaaa2619..8d2fd7478d6 100644
--- a/image/tga.cpp
+++ b/image/tga.cpp
@@ -186,32 +186,26 @@ bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, b
for (int i = 0; i < _colorMapLength * 3; i += 3) {
byte r, g, b;
if (_colorMapEntryLength == 32) {
- byte a;
- Graphics::PixelFormat format(4, 8, 8, 8, 0, 16, 8, 0, 24);
- uint32 color = tga.readUint32LE();
- format.colorToARGB(color, a, r, g, b);
- } else if (_colorMapEntryLength == 24) {
- r = tga.readByte();
+ b = tga.readByte();
g = tga.readByte();
+ r = tga.readByte();
+ tga.readByte(); // for alpha
+ } else if (_colorMapEntryLength == 24) {
b = tga.readByte();
+ g = tga.readByte();
+ r = tga.readByte();
} else if (_colorMapEntryLength == 16) {
byte a;
- Graphics::PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15);
+ static const Graphics::PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15);
uint16 color = tga.readUint16LE();
format.colorToARGB(color, a, r, g, b);
} else {
warning("Unsupported image type: %d", imageType);
r = g = b = 0;
}
-#ifdef SCUMM_LITTLE_ENDIAN
_colorMap[i] = r;
_colorMap[i + 1] = g;
_colorMap[i + 2] = b;
-#else
- _colorMap[i] = b;
- _colorMap[i + 1] = g;
- _colorMap[i + 2] = r;
-#endif
}
return true;
}
Commit: a3dd9b15fe4153a0c1bb7aceb693e12abd2408da
https://github.com/scummvm/scummvm/commit/a3dd9b15fe4153a0c1bb7aceb693e12abd2408da
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-01-26T02:56:53+02:00
Commit Message:
WINTERMUTE: Remove all patches on TGA loading
This is now useless.
Changed paths:
engines/wintermute/base/gfx/base_image.cpp
engines/wintermute/base/gfx/base_image.h
diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp
index b718ed59a78..2ece650548a 100644
--- a/engines/wintermute/base/gfx/base_image.cpp
+++ b/engines/wintermute/base/gfx/base_image.cpp
@@ -46,7 +46,6 @@ namespace Wintermute {
BaseImage::BaseImage() {
_fileManager = BaseFileManager::getEngineInstance();
_palette = nullptr;
- _paletteTga = nullptr;
_paletteCount = 0;
_surface = nullptr;
_decoder = nullptr;
@@ -61,8 +60,6 @@ BaseImage::~BaseImage() {
_deletableSurface->free();
}
delete _deletableSurface;
- delete _paletteTga;
- _paletteTga = nullptr;
}
bool BaseImage::loadFile(const Common::String &filename) {
@@ -91,20 +88,6 @@ bool BaseImage::loadFile(const Common::String &filename) {
_paletteCount = _decoder->getPaletteColorCount();
_fileManager->closeFile(file);
- //
- // W/A: ScummVM TGA decoder interpreting palette as RGB, but TGA format should be as BGR
- // So, swap R and B color components
- //
- if (_filename.hasSuffix(".tga")) {
- _paletteTga = new byte[_paletteCount * 3];
- for (uint32 i = 0; i < _paletteCount * 3; i += 3) {
- _paletteTga[i + 0] = _palette[i + 2];
- _paletteTga[i + 1] = _palette[i + 1];
- _paletteTga[i + 2] = _palette[i + 0];
- }
- _palette = _paletteTga;
- }
-
return true;
}
diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h
index 354066fc482..8b1ff120bfc 100644
--- a/engines/wintermute/base/gfx/base_image.h
+++ b/engines/wintermute/base/gfx/base_image.h
@@ -70,7 +70,6 @@ private:
const Graphics::Surface *_surface;
Graphics::Surface *_deletableSurface;
const byte *_palette;
- byte *_paletteTga;
uint16 _paletteCount;
BaseFileManager *_fileManager;
};
More information about the Scummvm-git-logs
mailing list