[Scummvm-cvs-logs] SF.net SVN: scummvm:[34053] scummvm/trunk

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Aug 20 16:03:36 CEST 2008


Revision: 34053
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34053&view=rev
Author:   lordhoto
Date:     2008-08-20 14:03:34 +0000 (Wed, 20 Aug 2008)

Log Message:
-----------
Committed patch #2050337 "KYRA/SCUMM: Thumbnail support/improvement". (Without Max' compressed backward seeking support for now)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/detection.cpp
    scummvm/trunk/engines/kyra/gui.h
    scummvm/trunk/engines/kyra/gui_hof.cpp
    scummvm/trunk/engines/kyra/gui_hof.h
    scummvm/trunk/engines/kyra/gui_lok.cpp
    scummvm/trunk/engines/kyra/gui_lok.h
    scummvm/trunk/engines/kyra/gui_mr.cpp
    scummvm/trunk/engines/kyra/gui_mr.h
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/kyra_hof.cpp
    scummvm/trunk/engines/kyra/kyra_hof.h
    scummvm/trunk/engines/kyra/kyra_lok.cpp
    scummvm/trunk/engines/kyra/kyra_lok.h
    scummvm/trunk/engines/kyra/kyra_mr.cpp
    scummvm/trunk/engines/kyra/kyra_mr.h
    scummvm/trunk/engines/kyra/kyra_v1.h
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/saveload.cpp
    scummvm/trunk/engines/kyra/saveload_hof.cpp
    scummvm/trunk/engines/kyra/saveload_lok.cpp
    scummvm/trunk/engines/kyra/saveload_mr.cpp
    scummvm/trunk/engines/kyra/screen_lok.cpp
    scummvm/trunk/engines/kyra/screen_lok.h
    scummvm/trunk/engines/kyra/script_mr.cpp
    scummvm/trunk/engines/kyra/timer_mr.cpp
    scummvm/trunk/engines/scumm/thumbnail.cpp
    scummvm/trunk/graphics/module.mk
    scummvm/trunk/graphics/scaler/thumbnail.cpp
    scummvm/trunk/graphics/scaler.h

Added Paths:
-----------
    scummvm/trunk/graphics/thumbnail.cpp
    scummvm/trunk/graphics/thumbnail.h

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/detection.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -1117,7 +1117,7 @@
 		if (slotNum >= 0 && slotNum <= 999) {
 			Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
 			if (in) {
-				if (Kyra::KyraEngine_v1::readSaveHeader(in, header) == Kyra::KyraEngine_v1::kRSHENoError)
+				if (Kyra::KyraEngine_v1::readSaveHeader(in, false, header) == Kyra::KyraEngine_v1::kRSHENoError)
 					saveList.push_back(SaveStateDescriptor(slotNum, header.description, *file));
 				delete in;
 			}

Modified: scummvm/trunk/engines/kyra/gui.h
===================================================================
--- scummvm/trunk/engines/kyra/gui.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -32,6 +32,8 @@
 #include "common/array.h"
 #include "common/func.h"
 
+#include "graphics/surface.h"
+
 namespace Kyra {
 
 #define BUTTON_FUNCTOR(type, x, y) Button::Callback(new Common::Functor1Mem<Button*, int, type>(x, y))
@@ -153,6 +155,8 @@
 
 	void processHighlights(Menu &menu, int mouseX, int mouseY);
 
+	// utilities for thumbnail creation
+	virtual void createScreenThumbnail(Graphics::Surface &dst) = 0;
 protected:
 	KyraEngine_v1 *_vm;
 	Screen *_screen;

Modified: scummvm/trunk/engines/kyra/gui_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_hof.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui_hof.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -33,6 +33,8 @@
 
 #include "common/savefile.h"
 
+#include "graphics/scaler.h"
+
 namespace Kyra {
 
 void KyraEngine_HoF::loadButtonShapes() {
@@ -793,6 +795,10 @@
 
 #pragma mark -
 
+void GUI_HoF::createScreenThumbnail(Graphics::Surface &dst) {
+	::createThumbnail(&dst, _vm->_screenBuffer, Screen::SCREEN_W, Screen::SCREEN_H, _screen->getPalette(1));
+}
+
 void GUI_HoF::setupPalette() {
 	memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
 
@@ -996,7 +1002,7 @@
 
 	if (_vm->_lang != lang) {
 		_reloadTemporarySave = true;
-		_vm->saveGame(_vm->getSavegameFilename(999), "Temporary Kyrandia 2 Savegame");
+		_vm->saveGame(_vm->getSavegameFilename(999), "Temporary Kyrandia 2 Savegame", 0);
 		_vm->loadCCodeBuffer("C_CODE.XXX");
 		if (_vm->_flags.isTalkie)
 			_vm->loadOptionsBuffer("OPTIONS.XXX");

Modified: scummvm/trunk/engines/kyra/gui_hof.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_hof.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui_hof.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -41,6 +41,8 @@
 	void initStaticData();
 
 	int optionsButton(Button *button);
+
+	void createScreenThumbnail(Graphics::Surface &dst);
 private:
 	const char *getMenuTitle(const Menu &menu);
 	const char *getMenuItemTitle(const MenuItem &menuItem);

Modified: scummvm/trunk/engines/kyra/gui_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui_lok.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -37,6 +37,8 @@
 #include "common/events.h"
 #include "common/system.h"
 
+#include "graphics/scaler.h"
+
 namespace Kyra {
 
 void KyraEngine_LoK::initMainButtonList() {
@@ -199,6 +201,15 @@
 	delete[] _menu;
 }
 
+void GUI_LoK::createScreenThumbnail(Graphics::Surface &dst) {
+	uint8 *screen = new uint8[Screen::SCREEN_W*Screen::SCREEN_H];
+	if (screen) {
+		_screen->queryPageFromDisk("SEENPAGE.TMP", 0, screen);
+		::createThumbnail(&dst, screen, Screen::SCREEN_W, Screen::SCREEN_H, _screen->getPalette(2));
+	}
+	delete[] screen;
+}
+
 int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel) {
 	while (list) {
 		if (list->flags & 8) {
@@ -736,8 +747,12 @@
 	} else {
 		if (_savegameOffset == 0 && _vm->_gameToLoad == 0)
 			_vm->_gameToLoad = getNextSavegameSlot();
-		if (_vm->_gameToLoad > 0)
-			_vm->saveGame(_vm->getSavegameFilename(_vm->_gameToLoad), _savegameName);
+		if (_vm->_gameToLoad > 0) {
+			Graphics::Surface thumb;
+			createScreenThumbnail(thumb);
+			_vm->saveGame(_vm->getSavegameFilename(_vm->_gameToLoad), _savegameName, &thumb);
+			thumb.free();
+		}
 	}
 
 	return 0;

Modified: scummvm/trunk/engines/kyra/gui_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui_lok.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -103,6 +103,8 @@
 	int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel);
 
 	int buttonMenuCallback(Button *caller);
+
+	void createScreenThumbnail(Graphics::Surface &dst);
 private:
 	void initStaticResource();
 

Modified: scummvm/trunk/engines/kyra/gui_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_mr.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui_mr.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -33,6 +33,8 @@
 
 #include "common/savefile.h"
 
+#include "graphics/scaler.h"
+
 namespace Kyra {
 
 void KyraEngine_MR::loadButtonShapes() {
@@ -1138,6 +1140,10 @@
 GUI_MR::GUI_MR(KyraEngine_MR *vm) : GUI_v2(vm), _vm(vm), _screen(vm->_screen) {
 }
 
+void GUI_MR::createScreenThumbnail(Graphics::Surface &dst) {
+	::createThumbnail(&dst, _vm->_screenBuffer, Screen::SCREEN_W, Screen::SCREEN_H, _screen->getPalette(0));
+}
+
 void GUI_MR::flagButtonEnable(Button *button) {
 	if (!button)
 		return;
@@ -1450,7 +1456,7 @@
 
 	if (_vm->_lang != lang) {
 		_reloadTemporarySave = true;
-		_vm->saveGame(_vm->getSavegameFilename(999), "Temporary Kyrandia 3 Savegame");
+		_vm->saveGame(_vm->getSavegameFilename(999), "Temporary Kyrandia 3 Savegame", 0);
 		if (!_vm->loadLanguageFile("ITEMS.", _vm->_itemFile))
 			error("Couldn't load ITEMS");
 		if (!_vm->loadLanguageFile("SCORE.", _vm->_scoreFile))

Modified: scummvm/trunk/engines/kyra/gui_mr.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_mr.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui_mr.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -47,6 +47,8 @@
 	int redrawButtonCallback(Button *button);
 
 	int optionsButton(Button *button);
+
+	void createScreenThumbnail(Graphics::Surface &dst);
 private:
 	void getInput();
 

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -618,7 +618,12 @@
 
 	restorePage1(_vm->_screenBuffer);
 	restorePalette();
-	_vm->saveGame(_vm->getSavegameFilename(_saveSlot), _saveDescription);
+
+	Graphics::Surface thumb;
+	createScreenThumbnail(thumb);
+	_vm->saveGame(_vm->getSavegameFilename(_saveSlot), _saveDescription, &thumb);
+	thumb.free();
+
 	_displayMenu = false;
 	_madeSave = true;
 

Modified: scummvm/trunk/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -436,7 +436,7 @@
 	if (_gameToLoad == -1) {
 		snd_playWanderScoreViaMap(52, 1);
 		enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
-		saveGame(getSavegameFilename(0), "New Game");
+		saveGame(getSavegameFilename(0), "New Game", 0);
 	} else {
 		loadGame(getSavegameFilename(_gameToLoad));
 	}

Modified: scummvm/trunk/engines/kyra/kyra_hof.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_hof.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -907,7 +907,7 @@
 	int _dbgPass;
 
 	// save/load specific
-	void saveGame(const char *fileName, const char *saveName);
+	void saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumbnail);
 	void loadGame(const char *fileName);
 };
 

Modified: scummvm/trunk/engines/kyra/kyra_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_lok.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -388,7 +388,7 @@
 			_gui->buttonMenuCallback(0);
 			_menuDirectlyToLoad = false;
 		} else
-			saveGame(getSavegameFilename(0), "New game");
+			saveGame(getSavegameFilename(0), "New game", 0);
 	} else {
 		_screen->setFont(Screen::FID_8_FNT);
 		loadGame(getSavegameFilename(_gameToLoad));
@@ -470,7 +470,7 @@
 					else {
 						char savegameName[14];
 						sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0');
-						saveGame(saveLoadSlot, savegameName);
+						saveGame(saveLoadSlot, savegameName, 0);
 					}
 				} else if (event.kbd.flags == Common::KBD_CTRL) {
 					if (event.kbd.keycode == 'd')

Modified: scummvm/trunk/engines/kyra/kyra_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_lok.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_lok.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -214,7 +214,7 @@
 protected:
 	int32 _speechPlayTime;
 
-	void saveGame(const char *fileName, const char *saveName);
+	void saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumbnail);
 	void loadGame(const char *fileName);
 
 protected:

Modified: scummvm/trunk/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -684,7 +684,7 @@
 	assert(_invWsa);
 	_invWsa->open("MOODOMTR.WSA", 1, 0);
 	_invWsaFrame = 6;
-	saveGame(getSavegameFilename(0), (const char*)getTableEntry(_optionsFile, 33));
+	saveGame(getSavegameFilename(0), (const char*)getTableEntry(_optionsFile, 33), 0);
 	_soundDigital->beginFadeOut(_musicSoundChannel, 60);
 	delayWithTicks(60);
 	if (_gameToLoad == -1)

Modified: scummvm/trunk/engines/kyra/kyra_mr.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_mr.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -583,7 +583,7 @@
 	int albumClose(Button *caller);
 
 	// save/load
-	void saveGame(const char *fileName, const char *saveName);
+	void saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumbnail);
 	void loadGame(const char *fileName);
 
 	// opcodes

Modified: scummvm/trunk/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_v1.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -290,6 +290,8 @@
 
 		bool originalSave;	// savegame from original interpreter
 		bool oldHeader;		// old scummvm save header
+
+		Graphics::Surface *thumbnail;
 	};
 
 	enum kReadSaveHeaderError {
@@ -299,10 +301,10 @@
 		kRSHEIoError = 3
 	};
 
-	static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *file, SaveHeader &header);
+	static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *file, bool loadThumbnail, SaveHeader &header);
 
 	Common::SeekableReadStream *openSaveForReading(const char *filename, SaveHeader &header);
-	Common::WriteStream *openSaveForWriting(const char *filename, const char *saveName) const;
+	Common::WriteStream *openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const;
 };
 
 } // End of namespace Kyra

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -186,7 +186,7 @@
 				} else {
 					char savegameName[14];
 					sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0');
-					saveGame(saveLoadSlot, savegameName);
+					saveGame(saveLoadSlot, savegameName, 0);
 				}
 			} else if (event.kbd.flags == Common::KBD_CTRL) {
 				if (event.kbd.keycode == 'd')

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -419,7 +419,7 @@
 	int o2_getVocHigh(EMCState *script);
 
 	// save/load specific
-	virtual void saveGame(const char *fileName, const char *saveName) = 0;
+	virtual void saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumbnail) = 0;
 	virtual void loadGame(const char *fileName) = 0;
 };
 

Modified: scummvm/trunk/engines/kyra/saveload.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/saveload.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -26,10 +26,11 @@
 #include "common/endian.h"
 #include "common/savefile.h"
 #include "common/system.h"
+#include "graphics/thumbnail.h"
 
 #include "kyra/kyra_v1.h"
 
-#define CURRENT_SAVE_VERSION 13
+#define CURRENT_SAVE_VERSION 14
 
 #define GF_FLOPPY  (1 <<  0)
 #define GF_TALKIE  (1 <<  1)
@@ -37,7 +38,7 @@
 
 namespace Kyra {
 
-KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header) {
+KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header) {
 	uint32 type = in->readUint32BE();
 	header.originalSave = false;
 	header.oldHeader = false;
@@ -108,6 +109,16 @@
 	if (header.version >= 2)
 		header.flags = in->readUint32BE();
 
+	if (header.version >= 14) {
+		if (loadThumbnail) {
+			header.thumbnail = new Graphics::Surface();
+			assert(header.thumbnail);
+			Graphics::loadThumbnail(*in, *header.thumbnail);
+		} else {
+			Graphics::skipThumbnailHeader(*in);
+		}
+	}
+
 	return (in->ioFailed() ? kRSHEIoError : kRSHENoError);
 }
 
@@ -118,7 +129,7 @@
 	if (!(in = _saveFileMan->openForLoading(filename)))
 		return 0;
 
-	kReadSaveHeaderError errorCode = KyraEngine_v1::readSaveHeader(in, header);
+	kReadSaveHeaderError errorCode = KyraEngine_v1::readSaveHeader(in, false, header);
 	if (errorCode != kRSHENoError) {
 		if (errorCode == kRSHEInvalidType)
 			warning("No ScummVM Kyra engine savefile header.");
@@ -162,8 +173,8 @@
 	return in;
 }
 
-Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName) const {
-	debugC(9, kDebugLevelMain, "KyraEngine_v1::openSaveForWriting('%s', '%s')", filename, saveName);
+Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const {
+	debugC(9, kDebugLevelMain, "KyraEngine_v1::openSaveForWriting('%s', '%s', %p)", filename, saveName, (const void *)thumbnail);
 	if (_quitFlag)
 		return 0;
 
@@ -191,6 +202,11 @@
 		return 0;
 	}
 
+	if (thumbnail)
+		Graphics::saveThumbnail(*out, *thumbnail);
+	else
+		Graphics::saveThumbnail(*out);
+
 	return out;
 }
 

Modified: scummvm/trunk/engines/kyra/saveload_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_hof.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/saveload_hof.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -35,10 +35,10 @@
 
 namespace Kyra {
 
-void KyraEngine_HoF::saveGame(const char *fileName, const char *saveName) {
-	debugC(9, kDebugLevelMain, "KyraEngine_HoF::saveGame('%s', '%s')", fileName, saveName);
+void KyraEngine_HoF::saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumb) {
+	debugC(9, kDebugLevelMain, "KyraEngine_LoK::saveGame('%s', '%s', %p)", fileName, saveName, (const void *)thumb);
 
-	Common::OutSaveFile *out = openSaveForWriting(fileName, saveName);
+	Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb);
 	if (!out) {
 		warning("Can't open file '%s', game not loadable", fileName);
 		return;

Modified: scummvm/trunk/engines/kyra/saveload_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_lok.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/saveload_lok.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -218,13 +218,13 @@
 	delete in;
 }
 
-void KyraEngine_LoK::saveGame(const char *fileName, const char *saveName) {
-	debugC(9, kDebugLevelMain, "KyraEngine_LoK::saveGame('%s', '%s')", fileName, saveName);
+void KyraEngine_LoK::saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumb) {
+	debugC(9, kDebugLevelMain, "KyraEngine_LoK::saveGame('%s', '%s', %p)", fileName, saveName, (const void *)thumb);
 	
 	if (_quitFlag)
 		return;
 
-	Common::OutSaveFile *out = openSaveForWriting(fileName, saveName);
+	Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb);
 	if (!out)
 		return;
 	

Modified: scummvm/trunk/engines/kyra/saveload_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_mr.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/saveload_mr.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -32,10 +32,10 @@
 
 namespace Kyra {
 
-void KyraEngine_MR::saveGame(const char *fileName, const char *saveName) {
-	debugC(9, kDebugLevelMain, "KyraEngine_MR::saveGame('%s', '%s')", fileName, saveName);
+void KyraEngine_MR::saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumb) {
+	debugC(9, kDebugLevelMain, "KyraEngine_LoK::saveGame('%s', '%s', %p)", fileName, saveName, (const void *)thumb);
 
-	Common::OutSaveFile *out = openSaveForWriting(fileName, saveName);
+	Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb);
 	if (!out) {
 		warning("Can't open file '%s', game not loadable", fileName);
 		return;

Modified: scummvm/trunk/engines/kyra/screen_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lok.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/screen_lok.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -147,8 +147,14 @@
 
 void Screen_LoK::loadPageFromDisk(const char *file, int page) {
 	debugC(9, kDebugLevelScreen, "Screen_LoK::loadPageFromDisk('%s', %d)", file, page);
+	if (!_saveLoadPage[page/2]) {
+		warning("trying to restore page %d, but no backup found", page);
+		return;
+	}
+
 	copyBlockToPage(page, 0, 0, SCREEN_W, SCREEN_H, _saveLoadPage[page/2]);
 	delete[] _saveLoadPage[page/2];
+	_saveLoadPage[page/2] = 0;
 
 	if (_saveLoadPageOvl[page/2]) {
 		uint8 *dstPage = getOverlayPtr(page);
@@ -160,9 +166,19 @@
 		memcpy(dstPage, _saveLoadPageOvl[page/2], SCREEN_OVL_SJIS_SIZE);
 		delete[] _saveLoadPageOvl[page/2];
 		_saveLoadPageOvl[page/2] = 0;
-	}	_saveLoadPage[page/2] = 0;
+	}
 }
 
+void Screen_LoK::queryPageFromDisk(const char *file, int page, uint8 *buffer) {
+	debugC(9, kDebugLevelScreen, "Screen_LoK::queryPageFromDisk('%s', %d, %p)", file, page, (const void *)buffer);
+	if (!_saveLoadPage[page/2]) {
+		warning("trying to query page %d, but no backup found", page);
+		return;
+	}
+
+	memcpy(buffer, _saveLoadPage[page/2], SCREEN_W*SCREEN_H);
+}
+
 void Screen_LoK::deletePageFromDisk(int page) {
 	debugC(9, kDebugLevelScreen, "Screen_LoK::deletePageFromDisk(%d)", page);
 	delete[] _saveLoadPage[page/2];

Modified: scummvm/trunk/engines/kyra/screen_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lok.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/screen_lok.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -50,6 +50,7 @@
 
 	void savePageToDisk(const char *file, int page);
 	void loadPageFromDisk(const char *file, int page);
+	void queryPageFromDisk(const char *file, int page, uint8 *buffer);
 	void deletePageFromDisk(int page);
 
 	void copyBackgroundBlock(int x, int page, int flag);

Modified: scummvm/trunk/engines/kyra/script_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_mr.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/script_mr.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -293,7 +293,7 @@
 
 int KyraEngine_MR::o3_makeSecondChanceSave(EMCState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_makeSecondChanceSave(%p) ()", (const void *)script);
-	saveGame(getSavegameFilename(999), "SECOND CHANCE SAVE GAME");
+	saveGame(getSavegameFilename(999), "SECOND CHANCE SAVE GAME", 0);
 	return 0;
 }
 

Modified: scummvm/trunk/engines/kyra/timer_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer_mr.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/kyra/timer_mr.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -65,7 +65,7 @@
 void KyraEngine_MR::timerFleaDeath(int arg) {
 	debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_MR::timerFleaDeath(%d)", arg);
 	_timer->setCountdown(4, 5400);
-	saveGame(getSavegameFilename(999), "SECOND CHANCE SAVE GAME");
+	saveGame(getSavegameFilename(999), "SECOND CHANCE SAVE GAME", 0);
 	_screen->hideMouse();
 	_timer->disable(4);
 	runAnimationScript("FLEADTH1.EMC", 0, 0, 1, 1);

Modified: scummvm/trunk/engines/scumm/thumbnail.cpp
===================================================================
--- scummvm/trunk/engines/scumm/thumbnail.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/engines/scumm/thumbnail.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -27,76 +27,39 @@
 #include "common/system.h"
 #include "common/savefile.h"
 #include "graphics/scaler.h"
+#include "graphics/thumbnail.h"
 #include "scumm/scumm.h"
 
 namespace Scumm {
 
-#define THMB_VERSION 1
-
-struct ThumbnailHeader {
-	uint32 type;
-	uint32 size;
-	byte version;
-	uint16 width, height;
-	byte bpp;
-};
-
-#define ThumbnailHeaderSize (4+4+1+2+2+1)
-
-inline void colorToRGB(uint16 color, uint8 &r, uint8 &g, uint8 &b) {
-	r = (((color >> 11) & 0x1F) << 3);
-	g = (((color >> 5) & 0x3F) << 2);
-	b = ((color&0x1F) << 3);
-}
-
 Graphics::Surface *ScummEngine::loadThumbnail(Common::SeekableReadStream *file) {
-	ThumbnailHeader header;
+	// TODO: Until backwards seeking in compressed save files is not supported
+	// We can not use this.
 
-	header.type = file->readUint32BE();
-	// We also accept the bad 'BMHT' header here, for the sake of compatibility
-	// with some older savegames which were written incorrectly due to a bug in
-	// ScummVM which wrote the thumb header type incorrectly on LE systems.
-	if (header.type != MKID_BE('THMB') && header.type != MKID_BE('BMHT'))
-		return 0;
+	//if (!Graphics::checkThumbnailHeader(*file))
+	//	return 0;
 
-	header.size = file->readUint32BE();
-	header.version = file->readByte();
-
-	if (header.version > THMB_VERSION) {
-		file->skip(header.size - 9);
-		warning("Loading a newer thumbnail version");
+	Graphics::Surface *thumb = new Graphics::Surface();
+	assert(thumb);
+	if (!Graphics::loadThumbnail(*file, *thumb)) {
+		delete thumb;
 		return 0;
 	}
 
-	header.width = file->readUint16BE();
-	header.height = file->readUint16BE();
-	header.bpp = file->readByte();
-
-	// TODO: support other bpp values than 2
-	if (header.bpp != 2) {
-		file->skip(header.size - 14);
-		return 0;
-	}
-
-	Graphics::Surface *thumb = new Graphics::Surface();
-	thumb->create(header.width, header.height, sizeof(OverlayColor));
-
-	OverlayColor* pixels = (OverlayColor *)thumb->pixels;
-
-	for (int y = 0; y < thumb->h; ++y) {
-		for (int x = 0; x < thumb->w; ++x) {
-			uint8 r, g, b;
-			colorToRGB(file->readUint16BE(), r, g, b);
-
-			// converting to current OSystem Color
-			*pixels++ = _system->RGBToColor(r, g, b);
-		}
-	}
-
 	return thumb;
 }
 
 void ScummEngine::saveThumbnail(Common::OutSaveFile *file) {
+	// Until we support no thumbnails in the SCUMM save formats for NDS
+	// we save a dummy thumbnail.
+	//
+	// TODO: Actually all what has to be done about it, is to update
+	// the code in engines/scumm/saveload.o which skips the saveheader.
+	// Currently impossible because of lacking backward seek support for
+	// compressed save files.
+	// When we change that code to use the new API from graphics/thumbnail.h
+	// it should be all fine to save no header at all for NDS.
+
 	Graphics::Surface thumb;
 
 #if !defined(__DS__)
@@ -104,26 +67,7 @@
 #endif
 		thumb.create(kThumbnailWidth, kThumbnailHeight2, sizeof(uint16));
 
-	ThumbnailHeader header;
-	header.type = MKID_BE('THMB');
-	header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.bytesPerPixel;
-	header.version = THMB_VERSION;
-	header.width = thumb.w;
-	header.height = thumb.h;
-	header.bpp = thumb.bytesPerPixel;
-
-	file->writeUint32BE(header.type);
-	file->writeUint32BE(header.size);
-	file->writeByte(header.version);
-	file->writeUint16BE(header.width);
-	file->writeUint16BE(header.height);
-	file->writeByte(header.bpp);
-
-	// TODO: for later this shouldn't be casted to uint16...
-	uint16* pixels = (uint16 *)thumb.pixels;
-	for (uint16 p = 0; p < thumb.w*thumb.h; ++p, ++pixels)
-		file->writeUint16BE(*pixels);
-
+	Graphics::saveThumbnail(*file, thumb);
 	thumb.free();
 }
 

Modified: scummvm/trunk/graphics/module.mk
===================================================================
--- scummvm/trunk/graphics/module.mk	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/graphics/module.mk	2008-08-20 14:03:34 UTC (rev 34053)
@@ -16,7 +16,8 @@
 	primitives.o \
 	scaler.o \
 	scaler/thumbnail.o \
-	surface.o
+	surface.o \
+	thumbnail.o
 
 ifndef DISABLE_SCALERS
 MODULE_OBJS += \

Modified: scummvm/trunk/graphics/scaler/thumbnail.cpp
===================================================================
--- scummvm/trunk/graphics/scaler/thumbnail.cpp	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/graphics/scaler/thumbnail.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -126,70 +126,93 @@
 	return true;
 }
 
-bool createThumbnailFromScreen(Graphics::Surface* surf) {
-	assert(surf);
+static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in) {
+	uint16 width = in.w;
+	uint16 inHeight = in.h;
 
-	int screenWidth = g_system->getWidth();
-	int screenHeight = g_system->getHeight();
-
-	Graphics::Surface screen;
-
-	if (!grabScreen565(&screen))
-		return false;
-
-	uint16 width = screenWidth;
-
-	if (screenWidth < 320) {
+	if (width < 320) {
 		// Special case to handle MM NES (uses a screen width of 256)
 		width = 320;
 
 		// center MM NES screen
 		Graphics::Surface newscreen;
-		newscreen.create(width, screen.h, screen.bytesPerPixel);
+		newscreen.create(width, in.h, in.bytesPerPixel);
 
-		uint8 *dst = (uint8*)newscreen.getBasePtr((320 - screenWidth) / 2, 0);
-		uint8 *src = (uint8*)screen.getBasePtr(0, 0);
-		uint16 height = screen.h;
+		uint8 *dst = (uint8*)newscreen.getBasePtr((320 - in.w) / 2, 0);
+		const uint8 *src = (uint8*)in.getBasePtr(0, 0);
+		uint16 height = in.h;
 
 		while (height--) {
-			memcpy(dst, src, screen.pitch);
+			memcpy(dst, src, in.pitch);
 			dst += newscreen.pitch;
-			src += screen.pitch;
+			src += in.pitch;
 		}
 
-		screen.free();
-		screen = newscreen;
-	} else if (screenWidth == 720) {
+		in.free();
+		in = newscreen;
+	} else if (width == 720) {
 		// Special case to handle Hercules mode
 		width = 640;
-		screenHeight = 400;
+		inHeight = 400;
 
 		// cut off menu and so on..
 		Graphics::Surface newscreen;
-		newscreen.create(width, 400, screen.bytesPerPixel);
+		newscreen.create(width, 400, in.bytesPerPixel);
 
-		uint8 *dst = (uint8*)newscreen.getBasePtr(0, (400 - 240) / 2);
-		uint8 *src = (uint8*)screen.getBasePtr(41, 28);
+		uint8 *dst = (uint8*)in.getBasePtr(0, (400 - 240) / 2);
+		const uint8 *src = (uint8*)in.getBasePtr(41, 28);
 
 		for (int y = 0; y < 240; ++y) {
-			memcpy(dst, src, 640 * screen.bytesPerPixel);
+			memcpy(dst, src, 640 * in.bytesPerPixel);
 			dst += newscreen.pitch;
-			src += screen.pitch;
+			src += in.pitch;
 		}
 
-		screen.free();
-		screen = newscreen;
+		in.free();
+		in = newscreen;
 	}
 
-	uint16 newHeight = !(screenHeight % 240) ? kThumbnailHeight2 : kThumbnailHeight1;
+	uint16 newHeight = !(inHeight % 240) ? kThumbnailHeight2 : kThumbnailHeight1;
 
 	int gBitFormatBackUp = gBitFormat;
 	gBitFormat = 565;
-	surf->create(kThumbnailWidth, newHeight, sizeof(uint16));
-	createThumbnail((const uint8*)screen.pixels, width * sizeof(uint16), (uint8*)surf->pixels, surf->pitch, width, screenHeight);
+	out.create(kThumbnailWidth, newHeight, sizeof(uint16));
+	createThumbnail((const uint8 *)in.pixels, width * sizeof(uint16), (uint8 *)out.pixels, out.pitch, width, inHeight);
 	gBitFormat = gBitFormatBackUp;
 
-	screen.free();
+	in.free();
 
 	return true;
 }
+
+bool createThumbnailFromScreen(Graphics::Surface* surf) {
+	assert(surf);
+
+	Graphics::Surface screen;
+
+	if (!grabScreen565(&screen))
+		return false;
+
+	return createThumbnail(*surf, screen);
+}
+
+bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, const uint8 *palette) {
+	assert(surf);
+
+	Graphics::Surface screen;
+	screen.create(w, h, 2);
+
+	for (uint y = 0; y < screen.h; ++y) {
+		for (uint x = 0; x < screen.w; ++x) {
+			byte r, g, b;
+			r = palette[pixels[y * w + x] * 3];
+			g = palette[pixels[y * w + x] * 3 + 1];
+			b = palette[pixels[y * w + x] * 3 + 2];
+
+			((uint16 *)screen.pixels)[y * screen.w + x] = RGBToColor<ColorMasks<565> >(r, g, b);
+		}
+	}
+
+	return createThumbnail(*surf, screen);
+}
+

Modified: scummvm/trunk/graphics/scaler.h
===================================================================
--- scummvm/trunk/graphics/scaler.h	2008-08-20 11:07:16 UTC (rev 34052)
+++ scummvm/trunk/graphics/scaler.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -78,10 +78,22 @@
 extern void createThumbnail(const uint8* src, uint32 srcPitch, uint8* dstPtr, uint32 dstPitch, int width, int height);
 
 /**
- * creates a thumbnail from the current screen (without overlay)
+ * Creates a thumbnail from the current screen (without overlay).
+ *
  * @param surf	a surface (will always have 16 bpp after this for now)
  * @return		false if a error occured
  */
-extern bool createThumbnailFromScreen(Graphics::Surface* surf);
+extern bool createThumbnailFromScreen(Graphics::Surface *surf);
 
+/**
+ * Creates a thumbnail from a buffer.
+ *
+ * @param surf      destination surface (will always have 16 bpp after this for now)
+ * @param pixels    raw pixel data
+ * @param w         width
+ * @param h         height
+ * @param palette   palette in RGB format
+ */
+extern bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h, const uint8 *palette);
+
 #endif

Added: scummvm/trunk/graphics/thumbnail.cpp
===================================================================
--- scummvm/trunk/graphics/thumbnail.cpp	                        (rev 0)
+++ scummvm/trunk/graphics/thumbnail.cpp	2008-08-20 14:03:34 UTC (rev 34053)
@@ -0,0 +1,174 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "graphics/thumbnail.h"
+#include "graphics/scaler.h"
+#include "common/endian.h"
+#include "common/system.h"
+
+namespace Graphics {
+
+namespace {
+#define THMB_VERSION 1
+
+struct ThumbnailHeader {
+	uint32 type;
+	uint32 size;
+	byte version;
+	uint16 width, height;
+	byte bpp;
+};
+
+#define ThumbnailHeaderSize (4+4+1+2+2+1)
+
+inline void colorToRGB(uint16 color, uint8 &r, uint8 &g, uint8 &b) {
+	r = (((color >> 11) & 0x1F) << 3);
+	g = (((color >> 5) & 0x3F) << 2);
+	b = ((color&0x1F) << 3);
+}
+
+bool loadHeader(Common::SeekableReadStream &in, ThumbnailHeader &header, bool outputWarnings) {
+	header.type = in.readUint32BE();
+	// We also accept the bad 'BMHT' header here, for the sake of compatibility
+	// with some older savegames which were written incorrectly due to a bug in
+	// ScummVM which wrote the thumb header type incorrectly on LE systems.
+	if (header.type != MKID_BE('THMB') && header.type != MKID_BE('BMHT')) {
+		if (outputWarnings)
+			warning("couldn't find thumbnail header type");
+		return false;
+	}
+
+	header.size = in.readUint32BE();
+	header.version = in.readByte();
+
+	if (header.version > THMB_VERSION) {
+		if (outputWarnings)
+			warning("trying to load a newer thumbnail version: %d instead of %d", header.version, THMB_VERSION);
+		return false;
+	}
+
+	header.width = in.readUint16BE();
+	header.height = in.readUint16BE();
+	header.bpp = in.readByte();
+
+	return true;
+}
+} // end of anonymous namespace
+
+bool checkThumbnailHeader(Common::SeekableReadStream &in) {
+	uint32 position = in.pos();
+	ThumbnailHeader header;
+
+	bool hasHeader = loadHeader(in, header, false);
+	
+	in.seek(position, SEEK_SET);
+
+	return hasHeader;
+}
+
+bool skipThumbnailHeader(Common::SeekableReadStream &in) {
+	uint32 position = in.pos();
+	ThumbnailHeader header;
+
+	if (!loadHeader(in, header, true)) {
+		in.seek(position, SEEK_SET);
+		return false;
+	}
+
+	in.seek(header.size - (in.pos() - position), SEEK_CUR);
+	return true;
+}
+
+bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to) {
+	ThumbnailHeader header;
+
+	if (!loadHeader(in, header, true))
+		return false;
+
+	if (header.bpp != 2) {
+		warning("trying to load thumbnail with unsupported bit depth %d", header.bpp);
+		return false;
+	}
+
+	to.create(header.width, header.height, sizeof(OverlayColor));
+
+	OverlayColor *pixels = (OverlayColor *)to.pixels;
+	for (int y = 0; y < to.h; ++y) {
+		for (int x = 0; x < to.w; ++x) {
+			uint8 r, g, b;
+			colorToRGB(in.readUint16BE(), r, g, b);
+
+			// converting to current OSystem Color
+			*pixels++ = g_system->RGBToColor(r, g, b);
+		}
+	}
+
+	return true;
+}
+
+bool saveThumbnail(Common::WriteStream &out) {
+	Graphics::Surface thumb;
+
+	if (!createThumbnailFromScreen(&thumb)) {
+		warning("Couldn't create thumbnail from screen, aborting thumbnail save");
+		return false;
+	}
+
+	bool success = saveThumbnail(out, thumb);
+	thumb.free();
+
+	return success;
+}
+
+bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb) {
+	if (thumb.bytesPerPixel != 2) {
+		warning("trying to save thumbnail with bpp different than 2");
+		return false;
+	}
+
+	ThumbnailHeader header;
+	header.type = MKID_BE('THMB');
+	header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.bytesPerPixel;
+	header.version = THMB_VERSION;
+	header.width = thumb.w;
+	header.height = thumb.h;
+	header.bpp = thumb.bytesPerPixel;
+
+	out.writeUint32BE(header.type);
+	out.writeUint32BE(header.size);
+	out.writeByte(header.version);
+	out.writeUint16BE(header.width);
+	out.writeUint16BE(header.height);
+	out.writeByte(header.bpp);
+
+	// TODO: for later this shouldn't be casted to uint16...
+	uint16 *pixels = (uint16 *)thumb.pixels;
+	for (uint16 p = 0; p < thumb.w*thumb.h; ++p, ++pixels)
+		out.writeUint16BE(*pixels);
+
+	return true;
+}
+
+} // end of namespace Graphics
+


Property changes on: scummvm/trunk/graphics/thumbnail.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/trunk/graphics/thumbnail.h
===================================================================
--- scummvm/trunk/graphics/thumbnail.h	                        (rev 0)
+++ scummvm/trunk/graphics/thumbnail.h	2008-08-20 14:03:34 UTC (rev 34053)
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef GRAPHICS_THUMBNAIL_H
+#define GRAPHICS_THUMBNAIL_H
+
+#include "common/stream.h"
+#include "graphics/surface.h"
+
+namespace Graphics {
+
+/**
+ * Checks for presence of the thumbnail save header.
+ * Seeks automatically back to start position after check.
+ *
+ * @param in	stream to check for header
+ */
+bool checkThumbnailHeader(Common::SeekableReadStream &in);
+
+/**
+ * Skips a thumbnail header, if present.
+ *
+ * @param in	stream to process
+ */
+bool skipThumbnailHeader(Common::SeekableReadStream &in);
+
+/**
+ * Lodas a thumbnail from the given input stream.
+ * The loaded thumbnail will be automatically converted to the
+ * current overlay pixelformat.
+ */
+bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to);
+
+/**
+ * Saves a thumbnail to the given write stream.
+ * Automatically creates a thumbnail from screen contents.
+ */
+bool saveThumbnail(Common::WriteStream &out);
+
+/**
+ * Saves a (given) thumbnail to the given write stream.
+ */
+bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb);
+
+} // end of namespace Graphics
+
+#endif
+


Property changes on: scummvm/trunk/graphics/thumbnail.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list