[Scummvm-cvs-logs] scummvm master -> 0ef807146e5934f206f23650f5a2c51ef143be2e
bluegr
md5 at scummvm.org
Thu May 5 19:16:38 CEST 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:
2af3759a78 SWORD25: Fixed the thumbnail creation code, and removed a hack
0ef807146e SWORD25: Remove thumbnails from the cache when saving a new game
Commit: 2af3759a7810fe96d0b8a0c5124c091b085fa6f0
https://github.com/scummvm/scummvm/commit/2af3759a7810fe96d0b8a0c5124c091b085fa6f0
Author: md5 (md5 at scummvm.org)
Date: 2011-05-05T10:13:06-07:00
Commit Message:
SWORD25: Fixed the thumbnail creation code, and removed a hack
Changed paths:
engines/sword25/gfx/graphicengine.cpp
engines/sword25/gfx/graphicengine.h
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 371df7a..fbaa69d 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -86,7 +86,6 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) :
GraphicEngine::~GraphicEngine() {
unregisterScriptBindings();
_backSurface.free();
- _frameBuffer.free();
delete _thumbnail;
}
@@ -115,7 +114,6 @@ bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCoun
const Graphics::PixelFormat format = g_system->getScreenFormat();
_backSurface.create(width, height, format);
- _frameBuffer.create(width, height, format);
// Standardmäßig ist Vsync an.
setVsync(true);
@@ -151,18 +149,6 @@ bool GraphicEngine::endFrame() {
_renderObjectManagerPtr->render();
- // FIXME: The following hack doesn't really work (all the thumbnails are empty)
-#if 0
- // HACK: The frame buffer surface is only used as the base for creating thumbnails when saving the
- // game, since the _backSurface is blanked. Currently I'm doing a slightly hacky check and only
- // copying the back surface if line 50 (the first line after the interface area) is non-blank
- if (READ_LE_UINT32((byte *)_backSurface.pixels + (_backSurface.pitch * 50)) & 0xffffff) {
- // Make a copy of the current frame into the frame buffer
- Common::copy((byte *)_backSurface.pixels, (byte *)_backSurface.pixels +
- (_backSurface.pitch * _backSurface.h), (byte *)_frameBuffer.pixels);
- }
-#endif
-
g_system->updateScreen();
return true;
@@ -385,7 +371,9 @@ bool GraphicEngine::saveThumbnailScreenshot(const Common::String &filename) {
// Note: In ScumMVM, rather than saivng the thumbnail to a file, we store it in memory
// until needed when creating savegame files
delete _thumbnail;
- _thumbnail = Screenshot::createThumbnail(&_frameBuffer);
+
+ _thumbnail = Screenshot::createThumbnail(&_backSurface);
+
return true;
}
diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h
index ebd8159..8d12168 100644
--- a/engines/sword25/gfx/graphicengine.h
+++ b/engines/sword25/gfx/graphicengine.h
@@ -235,9 +235,6 @@ public:
Graphics::Surface _backSurface;
Graphics::Surface *getSurface() { return &_backSurface; }
- Graphics::Surface _frameBuffer;
- Graphics::Surface *getFrameBuffer() { return &_frameBuffer; }
-
Common::SeekableReadStream *_thumbnail;
Common::SeekableReadStream *getThumbnail() { return _thumbnail; }
Commit: 0ef807146e5934f206f23650f5a2c51ef143be2e
https://github.com/scummvm/scummvm/commit/0ef807146e5934f206f23650f5a2c51ef143be2e
Author: md5 (md5 at scummvm.org)
Date: 2011-05-05T10:14:21-07:00
Commit Message:
SWORD25: Remove thumbnails from the cache when saving a new game
Changed paths:
engines/sword25/kernel/persistenceservice.cpp
engines/sword25/kernel/resmanager.cpp
engines/sword25/kernel/resmanager.h
diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp
index 500703b..6bb2b1b 100644
--- a/engines/sword25/kernel/persistenceservice.cpp
+++ b/engines/sword25/kernel/persistenceservice.cpp
@@ -336,6 +336,9 @@ bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotF
// Savegameinformationen für diesen Slot aktualisieren.
_impl->readSlotSavegameInformation(slotID);
+ // Empty the cache, to remove old thumbnails
+ Kernel::getInstance()->getResourceManager()->emptyThumbnailCache();
+
// Erfolg signalisieren.
return true;
}
diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp
index 8b446e6..b77d79e 100644
--- a/engines/sword25/kernel/resmanager.cpp
+++ b/engines/sword25/kernel/resmanager.cpp
@@ -147,6 +147,21 @@ void ResourceManager::emptyCache() {
}
}
+void ResourceManager::emptyThumbnailCache() {
+ // Scan through the resource list
+ Common::List<Resource *>::iterator iter = _resources.begin();
+ while (iter != _resources.end()) {
+ if ((*iter)->getFileName().hasPrefix("/saves")) {
+ // Unlock the thumbnail
+ while ((*iter)->getLockCount() > 0)
+ (*iter)->release();
+ // Delete the thumbnail
+ iter = deleteResource(*iter);
+ } else
+ ++iter;
+ }
+}
+
/**
* Returns a requested resource. If any error occurs, returns NULL
* @param FileName Filename of resource
diff --git a/engines/sword25/kernel/resmanager.h b/engines/sword25/kernel/resmanager.h
index 5b2bfd3..f8006bd 100644
--- a/engines/sword25/kernel/resmanager.h
+++ b/engines/sword25/kernel/resmanager.h
@@ -82,6 +82,11 @@ public:
void emptyCache();
/**
+ * Removes all the savegame thumbnails from the cache
+ **/
+ void emptyThumbnailCache();
+
+ /**
* Writes the names of all currently locked resources to the log file
*/
void dumpLockedResources();
More information about the Scummvm-git-logs
mailing list