[Scummvm-git-logs] scummvm master -> 6d4b001b2b42768ffd04397d6d5170b2a2431923
neuromancer
neuromancer at users.noreply.github.com
Sun Mar 7 21:47:18 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6d4b001b2b PRIVATE: saving now uses VSPictures instead of screenshots
Commit: 6d4b001b2b42768ffd04397d6d5170b2a2431923
https://github.com/scummvm/scummvm/commit/6d4b001b2b42768ffd04397d6d5170b2a2431923
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-03-07T18:47:00-03:00
Commit Message:
PRIVATE: saving now uses VSPictures instead of screenshots
Changed paths:
engines/private/metaengine.cpp
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index ec89cf23ba..1337b6e95a 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -21,6 +21,7 @@
*/
#include "engines/advancedDetector.h"
+#include "graphics/scaler.h"
#include "private/private.h"
@@ -31,6 +32,7 @@ public:
}
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+ void getSavegameThumbnail(Graphics::Surface &thumb) override;
};
Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
@@ -38,6 +40,14 @@ Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine,
return Common::kNoError;
}
+void PrivateMetaEngine::getSavegameThumbnail(Graphics::Surface &thumb) {
+ Graphics::Surface *vs = Private::g_private->decodeImage(Private::g_private->_nextVS);
+ thumb = *vs->scale(kThumbnailWidth, kThumbnailHeight2);
+
+ vs->free();
+ delete vs;
+}
+
namespace Private {
bool PrivateEngine::isDemo() const {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5a2447fdce..0e12c41631 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -179,13 +179,7 @@ Common::Error PrivateEngine::run() {
_compositeSurface->setTransparentColor(_transparentColor);
// Load the game frame once
- Common::File frameFile;
- const Common::String &frameFilePathname = convertPath(_framePath);
- if (!frameFile.open(frameFilePathname)) {
- error("Failed to read %s", frameFilePathname.c_str());
- }
- _image->loadStream(frameFile);
- _frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+ _frame = decodeImage(_framePath);
// Main event loop
Common::Event event;
@@ -916,15 +910,20 @@ void PrivateEngine::stopSound(bool all) {
}
}
-void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
- debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d)", __FUNCTION__, name.c_str(), x, y);
+Graphics::Surface *PrivateEngine::decodeImage(const Common::String &name) {
+ debugC(1, kPrivateDebugFunction, "%s(%s)", __FUNCTION__, name.c_str());
Common::File file;
Common::String path = convertPath(name);
if (!file.open(path))
error("unable to load image %s", path.c_str());
_image->loadStream(file);
- Graphics::Surface *surf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+ return _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+}
+
+void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
+ debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d)", __FUNCTION__, name.c_str(), x, y);
+ Graphics::Surface *surf = decodeImage(name);
_compositeSurface->transBlitFrom(*surf, _origin + Common::Point(x,y), _transparentColor);
surf->free();
delete surf;
diff --git a/engines/private/private.h b/engines/private/private.h
index b7a4c0fe22..3c49843cd7 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -196,6 +196,7 @@ public:
void playVideo(const Common::String &);
void skipVideo();
+ Graphics::Surface *decodeImage(const Common::String &file);
void loadImage(const Common::String &file, int x, int y);
void drawScreenFrame();
More information about the Scummvm-git-logs
mailing list