[Scummvm-git-logs] scummvm master -> bbfb0f2f8ba875a0c9e3f3c35c071b6e158f3118

aquadran aquadran at gmail.com
Sat Feb 13 19:47:04 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:
bbfb0f2f8b ICB: Implement writing to BMP


Commit: bbfb0f2f8ba875a0c9e3f3c35c071b6e158f3118
    https://github.com/scummvm/scummvm/commit/bbfb0f2f8ba875a0c9e3f3c35c071b6e158f3118
Author: Paweł Kołodziejski (aquadran at users.sourceforge.net)
Date: 2021-02-13T20:46:59+01:00

Commit Message:
ICB: Implement writing to BMP

Changed paths:
    engines/icb/p4.cpp
    engines/icb/surface_manager.cpp


diff --git a/engines/icb/p4.cpp b/engines/icb/p4.cpp
index 8a87efcad6..0d9b977bd9 100644
--- a/engines/icb/p4.cpp
+++ b/engines/icb/p4.cpp
@@ -227,16 +227,7 @@ void _stub::Update_screen() {
 	if (Read_DI_keys(Common::KEYCODE_LCTRL) || Read_DI_keys(Common::KEYCODE_RCTRL)) {
 		if (Read_DI_keys(Common::KEYCODE_s)) {
 			// Take a screen grab
-			if (!checkFileExists(pxVString("ScreenShots"))) // TODO: Had amode = 0
-				error("ICB wants to create folder ScreenShots");
-			/*
-#ifdef _WIN32
-				mkdir(pxVString("ScreenShots"));
-#else
-				mkdir(pxVString("ScreenShots"), 0755);
-#endif
-			*/
-			surface_manager->RecordFrame(pxVString("ScreenShots\\%08d.bmp", g_system->getMillis()));
+			surface_manager->RecordFrame(pxVString("ScreenShot_%08d.bmp", g_system->getMillis()));
 		}
 	}
 
diff --git a/engines/icb/surface_manager.cpp b/engines/icb/surface_manager.cpp
index 008154ca8d..3d3713712a 100644
--- a/engines/icb/surface_manager.cpp
+++ b/engines/icb/surface_manager.cpp
@@ -35,6 +35,9 @@
 #include "common/textconsole.h"
 #include "common/system.h"
 #include "common/util.h"
+#include "common/file.h"
+
+#include "image/bmp.h"
 
 #include "engines/util.h"
 
@@ -824,11 +827,14 @@ void _surface_manager::DrawEffects(uint32 surface_id) {
 }
 
 void _surface_manager::RecordFrame(const char *path) {
-	warning("TODO: Implement RecordFrame");
-#if 0
-	if (SDL_SaveBMP(sdl_screen, path) < 0)
+	Common::DumpFile dumpFile;
+	bool result = dumpFile.open(path);
+	if (result) {
+		result = Image::writeBMP(dumpFile, *screenSurface);
+	}
+	if (!result) {
 		Fatal_error("_surface_manager::RecordSurface( \"%s\" ) - Failed to create the output file", path);
-#endif
+	}
 }
 
 } // End of namespace ICB




More information about the Scummvm-git-logs mailing list