[Scummvm-cvs-logs] scummvm master -> 5091f846a78c82d619b41530ff670de04bc05387

clone2727 clone2727 at gmail.com
Sun Feb 20 06:49:40 CET 2011


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:
098581b3b5 GRAPHICS: Use the DirectBits size instead of the overall PICT dimensions
5091f846a7 GRAPHICS: Switch PICT's palette from RGBA to RGB


Commit: 098581b3b5ec22f2e50075414f74f378ad24c2ae
    https://github.com/scummvm/scummvm/commit/098581b3b5ec22f2e50075414f74f378ad24c2ae
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-19T21:43:18-08:00

Commit Message:
GRAPHICS: Use the DirectBits size instead of the overall PICT dimensions

Fixes some Myst ME images

Changed paths:
    graphics/pict.cpp
    graphics/pict.h



diff --git a/graphics/pict.cpp b/graphics/pict.cpp
index 95f659c..9079223 100644
--- a/graphics/pict.cpp
+++ b/graphics/pict.cpp
@@ -95,10 +95,10 @@ Surface *PictDecoder::decodeImage(Common::SeekableReadStream *stream, byte *pale
 		} else if (opcode == 0x001E) { // DefHilite
 			// Ignore, Contains no Data
 		} else if (opcode == 0x0098) { // PackBitsRect
-			decodeDirectBitsRect(stream, _imageRect.width(), _imageRect.height(), true);
+			decodeDirectBitsRect(stream, true);
 			_isPaletted = true;
 		} else if (opcode == 0x009A) { // DirectBitsRect
-			decodeDirectBitsRect(stream, _imageRect.width(), _imageRect.height(), false);
+			decodeDirectBitsRect(stream, false);
 		} else if (opcode == 0x00A1) { // LongComment
 			stream->readUint16BE();
 			uint16 dataSize = stream->readUint16BE();
@@ -162,7 +162,7 @@ struct DirectBitsRectData {
 	uint16 mode;
 };
 
-void PictDecoder::decodeDirectBitsRect(Common::SeekableReadStream *stream, uint16 width, uint16 height, bool hasPalette) {
+void PictDecoder::decodeDirectBitsRect(Common::SeekableReadStream *stream, bool hasPalette) {
 	static const PixelFormat directBitsFormat16 = PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
 
 	// Clear the palette
@@ -196,6 +196,9 @@ void PictDecoder::decodeDirectBitsRect(Common::SeekableReadStream *stream, uint1
 	directBitsData.dstRect.right = stream->readUint16BE();
 	directBitsData.mode = stream->readUint16BE();
 
+	uint16 width = directBitsData.srcRect.width();
+	uint16 height = directBitsData.srcRect.height();
+
 	byte bytesPerPixel = 0;
 
 	if (directBitsData.pixMap.pixelSize <= 8)
diff --git a/graphics/pict.h b/graphics/pict.h
index a9ea170..e4bde8a 100644
--- a/graphics/pict.h
+++ b/graphics/pict.h
@@ -74,7 +74,7 @@ private:
 	bool _isPaletted;
 	Graphics::Surface *_outputSurface;
 
-	void decodeDirectBitsRect(Common::SeekableReadStream *stream, uint16 width, uint16 height, bool hasPalette);
+	void decodeDirectBitsRect(Common::SeekableReadStream *stream, bool hasPalette);
 	void decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel);
 	void decodeCompressedQuickTime(Common::SeekableReadStream *stream);
 	void outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel);


Commit: 5091f846a78c82d619b41530ff670de04bc05387
    https://github.com/scummvm/scummvm/commit/5091f846a78c82d619b41530ff670de04bc05387
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-19T21:45:59-08:00

Commit Message:
GRAPHICS: Switch PICT's palette from RGBA to RGB

Changed paths:
    engines/sci/graphics/maciconbar.cpp
    graphics/pict.cpp
    graphics/pict.h



diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp
index 77491aa..d625164 100644
--- a/engines/sci/graphics/maciconbar.cpp
+++ b/engines/sci/graphics/maciconbar.cpp
@@ -45,7 +45,7 @@ void GfxMacIconBar::addIcon(reg_t obj) {
 void GfxMacIconBar::drawIcons() {
 	// Draw the icons to the bottom of the screen
 
-	byte *pal = new byte[256 * 4];
+	byte *pal = new byte[256 * 3];
 	Graphics::PictDecoder *pict = new Graphics::PictDecoder(Graphics::PixelFormat::createFormatCLUT8());
 	uint32 lastX = 0;
 
@@ -79,9 +79,9 @@ void GfxMacIconBar::remapColors(Graphics::Surface *surf, byte *palette) {
 	for (uint16 i = 0; i < surf->w * surf->h; i++) {
 		byte color = *pixels;
 
-		byte r = palette[color * 4];
-		byte g = palette[color * 4 + 1];
-		byte b = palette[color * 4 + 2];
+		byte r = palette[color * 3];
+		byte g = palette[color * 3 + 1];
+		byte b = palette[color * 3 + 2];
 
 		*pixels++ = g_sci->_gfxPalette->findMacIconBarColor(r, g, b);
 	}
diff --git a/graphics/pict.cpp b/graphics/pict.cpp
index 9079223..ca4aac7 100644
--- a/graphics/pict.cpp
+++ b/graphics/pict.cpp
@@ -127,7 +127,7 @@ Surface *PictDecoder::decodeImage(Common::SeekableReadStream *stream, byte *pale
 
 	// If we got a palette throughout this nonsense, go and grab it
 	if (palette && _isPaletted)
-		memcpy(palette, _palette, 256 * 4);
+		memcpy(palette, _palette, 256 * 3);
 
 	return _outputSurface;
 }
@@ -180,9 +180,9 @@ void PictDecoder::decodeDirectBitsRect(Common::SeekableReadStream *stream, bool
 
 		for (uint32 i = 0; i < colorCount; i++) {
 			stream->readUint16BE();
-			_palette[i * 4] = stream->readUint16BE() >> 8;
-			_palette[i * 4 + 1] = stream->readUint16BE() >> 8;
-			_palette[i * 4 + 2] = stream->readUint16BE() >> 8;
+			_palette[i * 3] = stream->readUint16BE() >> 8;
+			_palette[i * 3 + 1] = stream->readUint16BE() >> 8;
+			_palette[i * 3 + 2] = stream->readUint16BE() >> 8;
 		}
 	}
 
diff --git a/graphics/pict.h b/graphics/pict.h
index e4bde8a..a683a23 100644
--- a/graphics/pict.h
+++ b/graphics/pict.h
@@ -70,7 +70,7 @@ private:
 	Common::Rect _imageRect;
 	PixelFormat _pixelFormat;
 	JPEG *_jpeg;
-	byte _palette[256 * 4];
+	byte _palette[256 * 3];
 	bool _isPaletted;
 	Graphics::Surface *_outputSurface;
 






More information about the Scummvm-git-logs mailing list