[Scummvm-git-logs] scummvm master -> 79052366d049b767d43258f8a8c0926f9f10d7fe
dreammaster
paulfgilbert at gmail.com
Fri Jan 4 03:30:38 CET 2019
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:
c4c14b593b GLK: FROTZ: Fixes for picture decoding
79052366d0 GLK: FROTZ: Support using prior palette when a pic doesn't have one
Commit: c4c14b593ba254d1f3f1159b1b23c166667a7e56
https://github.com/scummvm/scummvm/commit/c4c14b593ba254d1f3f1159b1b23c166667a7e56
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-01-03T18:18:53-08:00
Commit Message:
GLK: FROTZ: Fixes for picture decoding
Changed paths:
engines/glk/frotz/pics.cpp
engines/glk/raw_decoder.cpp
diff --git a/engines/glk/frotz/pics.cpp b/engines/glk/frotz/pics.cpp
index bda24ac..86cd5fe 100644
--- a/engines/glk/frotz/pics.cpp
+++ b/engines/glk/frotz/pics.cpp
@@ -150,6 +150,7 @@ Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::String
palette.resize(f.readByte() * 3);
f.read(&palette[0], palette.size());
+ f.seek(e._dataOffset);
Common::SeekableReadStream *src = f.readStream(e._dataSize);
dest = decoder.decode(*src, e._flags, palette, kMCGA, e._width, e._height);
delete src;
diff --git a/engines/glk/raw_decoder.cpp b/engines/glk/raw_decoder.cpp
index e0899e0..659b333 100644
--- a/engines/glk/raw_decoder.cpp
+++ b/engines/glk/raw_decoder.cpp
@@ -56,7 +56,7 @@ bool RawDecoder::loadStream(Common::SeekableReadStream &stream) {
stream.readByte();
_surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- assert((stream.size() - stream.pos()) == (int)(width * height));
+ assert((stream.size() - stream.pos()) <= (int)(width * height));
byte *pixels = (byte *)_surface.getPixels();
stream.read(pixels, width * height);
Commit: 79052366d049b767d43258f8a8c0926f9f10d7fe
https://github.com/scummvm/scummvm/commit/79052366d049b767d43258f8a8c0926f9f10d7fe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-01-03T18:30:22-08:00
Commit Message:
GLK: FROTZ: Support using prior palette when a pic doesn't have one
Changed paths:
engines/glk/frotz/pics.cpp
engines/glk/frotz/pics.h
diff --git a/engines/glk/frotz/pics.cpp b/engines/glk/frotz/pics.cpp
index 86cd5fe..9dca324 100644
--- a/engines/glk/frotz/pics.cpp
+++ b/engines/glk/frotz/pics.cpp
@@ -41,6 +41,8 @@ Pics::Pics() : Common::Archive(), _filename(getFilename()) {
if (!f.open(_filename))
error("Error reading Pics file");
+ _palette = new Common::Array<byte>();
+
Common::Array<uint> offsets;
byte buffer[16];
f.read(buffer, 16);
@@ -95,6 +97,10 @@ Pics::Pics() : Common::Archive(), _filename(getFilename()) {
f.close();
}
+Pics::~Pics() {
+ delete _palette;
+}
+
Common::String Pics::getFilename() {
Common::String filename = g_vm->getFilename();
while (filename.contains('.'))
@@ -137,22 +143,23 @@ Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::String
for (uint idx = 0; idx < _index.size(); ++idx) {
const Entry &e = _index[idx];
if (e._filename.equalsIgnoreCase(name)) {
- Common::Array<byte> palette;
Common::File f;
Common::SeekableReadStream *dest;
if (!f.open(_filename))
error("Reading failed");
if (e._dataSize) {
- // Read in the image's palette
- assert(e._paletteOffset);
- f.seek(e._paletteOffset);
- palette.resize(f.readByte() * 3);
- f.read(&palette[0], palette.size());
+ if (e._paletteOffset) {
+ // Read in the image's palette
+ assert(e._paletteOffset);
+ f.seek(e._paletteOffset);
+ _palette->resize(f.readByte() * 3);
+ f.read(&(*_palette)[0], _palette->size());
+ }
f.seek(e._dataOffset);
Common::SeekableReadStream *src = f.readStream(e._dataSize);
- dest = decoder.decode(*src, e._flags, palette, kMCGA, e._width, e._height);
+ dest = decoder.decode(*src, e._flags, *_palette, kMCGA, e._width, e._height);
delete src;
} else {
byte *rect = (byte *)malloc(2 * sizeof(uint16));
diff --git a/engines/glk/frotz/pics.h b/engines/glk/frotz/pics.h
index ab2204f..68facf5 100644
--- a/engines/glk/frotz/pics.h
+++ b/engines/glk/frotz/pics.h
@@ -65,6 +65,7 @@ private:
Common::Array<Entry> _index; ///< list of entries
uint _entrySize;
uint _version;
+ Common::Array<byte> *_palette;
private:
/**
* Returns the filename for the pictures archive
@@ -82,6 +83,11 @@ public:
Pics();
/**
+ * Destructor
+ */
+ ~Pics();
+
+ /**
* Return the number of entries in the file
*/
size_t size() const { return _index.size(); }
More information about the Scummvm-git-logs
mailing list