[Scummvm-cvs-logs] scummvm master -> dc3facfc62ac794510d4c9c752deddd52cd70a8e

clone2727 clone2727 at gmail.com
Wed Oct 17 04:20:02 CEST 2012


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:
c645f7dc93 GRAPHICS: Make failing to find the PICT header return false from loadStream
dc3facfc62 PEGASUS: Improve error messages when failing to load PICT images


Commit: c645f7dc9334a34c4b48684297ceb17e3595b827
    https://github.com/scummvm/scummvm/commit/c645f7dc9334a34c4b48684297ceb17e3595b827
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-10-16T19:15:09-07:00

Commit Message:
GRAPHICS: Make failing to find the PICT header return false from loadStream

Changed paths:
    graphics/decoders/pict.cpp



diff --git a/graphics/decoders/pict.cpp b/graphics/decoders/pict.cpp
index d35e5c3..b1d408e 100644
--- a/graphics/decoders/pict.cpp
+++ b/graphics/decoders/pict.cpp
@@ -235,10 +235,13 @@ bool PICTDecoder::loadStream(Common::SeekableReadStream &stream) {
 		// PICT v2 opcodes are two bytes
 		uint16 opcode = stream.readUint16BE();
 
-		if (opNum == 0 && opcode != 0x0011)
-			error("Cannot find PICT version opcode");
-		else if (opNum == 1 && opcode != 0x0C00)
-			error("Cannot find PICT header opcode");
+		if (opNum == 0 && opcode != 0x0011) {
+			warning("Cannot find PICT version opcode");
+			return false;
+		} else if (opNum == 1 && opcode != 0x0C00) {
+			warning("Cannot find PICT header opcode");
+			return false;
+		}
 
 		// Since opcodes are word-aligned, we need to mark our starting
 		// position here.


Commit: dc3facfc62ac794510d4c9c752deddd52cd70a8e
    https://github.com/scummvm/scummvm/commit/dc3facfc62ac794510d4c9c752deddd52cd70a8e
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2012-10-16T19:16:32-07:00

Commit Message:
PEGASUS: Improve error messages when failing to load PICT images

Changed paths:
    engines/pegasus/surface.cpp
    engines/pegasus/surface.h



diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp
index e9e0958..cdcb3c6 100644
--- a/engines/pegasus/surface.cpp
+++ b/engines/pegasus/surface.cpp
@@ -85,7 +85,8 @@ void Surface::getImageFromPICTFile(const Common::String &fileName) {
 	if (!pict.open(fileName))
 		error("Could not open picture '%s'", fileName.c_str());
 
-	getImageFromPICTStream(&pict);
+	if (!getImageFromPICTStream(&pict))
+		error("Failed to load PICT '%s'", fileName.c_str());
 }
 
 void Surface::getImageFromPICTResource(Common::MacResManager *resFork, uint16 id) {
@@ -93,19 +94,22 @@ void Surface::getImageFromPICTResource(Common::MacResManager *resFork, uint16 id
 	if (!res)
 		error("Could not open PICT resource %d from '%s'", id, resFork->getBaseFileName().c_str());
 
-	getImageFromPICTStream(res);
+	if (!getImageFromPICTStream(res))
+		error("Failed to load PICT resource %d from '%s'", id, resFork->getBaseFileName().c_str());
+
 	delete res;
 }
 
-void Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) {
+bool Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) {
 	Graphics::PICTDecoder pict;
 
 	if (!pict.loadStream(*stream))
-		error("Failed to load PICT image");
+		return false;
 
 	_surface = pict.getSurface()->convertTo(g_system->getScreenFormat(), pict.getPalette());
 	_ownsSurface = true;
 	_bounds = Common::Rect(0, 0, _surface->w, _surface->h);
+	return true;
 }
 
 void Surface::getImageFromMovieFrame(Video::VideoDecoder *video, TimeValue time) {
diff --git a/engines/pegasus/surface.h b/engines/pegasus/surface.h
index 4588146..47e3ef5 100644
--- a/engines/pegasus/surface.h
+++ b/engines/pegasus/surface.h
@@ -84,7 +84,7 @@ protected:
 	Common::Rect _bounds;
 
 private:
-	void getImageFromPICTStream(Common::SeekableReadStream *stream);
+	bool getImageFromPICTStream(Common::SeekableReadStream *stream);
 
 	uint32 getGlowColor(uint32 color) const;
 	bool isTransparent(uint32 color) const;






More information about the Scummvm-git-logs mailing list