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

sev- noreply at scummvm.org
Mon Jan 22 23:05:36 UTC 2024


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:
ced5e6b1f8 DIRECTOR: Dump bitmap as PNGs when --dump-scripts is invoked.


Commit: ced5e6b1f8833e7ed480b15ace0a4e9cf8f2f720
    https://github.com/scummvm/scummvm/commit/ced5e6b1f8833e7ed480b15ace0a4e9cf8f2f720
Author: kartiksharmakk (77577353+kartiksharmakk at users.noreply.github.com)
Date: 2024-01-23T00:05:33+01:00

Commit Message:
DIRECTOR: Dump bitmap as PNGs when --dump-scripts is invoked.

This dump all Bitmap cast members into PNGs when --dump-scripts is invoked.

Changed paths:
    engines/director/castmember/bitmap.cpp


diff --git a/engines/director/castmember/bitmap.cpp b/engines/director/castmember/bitmap.cpp
index 866e36683d8..f7803311d0f 100644
--- a/engines/director/castmember/bitmap.cpp
+++ b/engines/director/castmember/bitmap.cpp
@@ -19,12 +19,14 @@
  *
  */
 
+#include "common/config-manager.h"
 #include "common/macresman.h"
 #include "graphics/surface.h"
 #include "graphics/macgui/macwidget.h"
 #include "image/bmp.h"
 #include "image/jpeg.h"
 #include "image/pict.h"
+#include "image/png.h"
 
 #include "director/director.h"
 #include "director/cast.h"
@@ -547,6 +549,19 @@ void BitmapCastMember::load() {
 					}
 
 					debugC(5, kDebugImages, "BitmapCastMember::load(): Bitmap: id: %d, w: %d, h: %d, flags1: %x, flags2: %x bytes: %x, bpp: %d clut: %s", imgId, surf->w, surf->h, _flags1, _flags2, _bytes, _bitsPerPixel, _clut.asString().c_str());
+
+					if (ConfMan.getBool("dump_scripts")) {
+
+						Common::String prepend = "stream";
+						Common::String filename = Common::String::format("./dumps/%s-%s-%d.png", encodePathForDump(prepend).c_str(), tag2str(tag), imgId);
+						Common::DumpFile bitmapFile;
+
+						bitmapFile.open(Common::Path(filename), true);
+						Image::writePNG(bitmapFile, *decoder->getSurface(), decoder->getPalette());
+
+						bitmapFile.close();
+					}
+
 					delete pic;
 					delete decoder;
 					_loaded = true;
@@ -607,6 +622,18 @@ void BitmapCastMember::load() {
 
 	setPicture(*img, true);
 
+	if (ConfMan.getBool("dump_scripts")) {
+
+		Common::String prepend = "stream";
+		Common::String filename = Common::String::format("./dumps/%s-%s-%d.png", encodePathForDump(prepend).c_str(), tag2str(tag), imgId);
+		Common::DumpFile bitmapFile;
+
+		bitmapFile.open(Common::Path(filename), true);
+		Image::writePNG(bitmapFile, *img->getSurface(), img->getPalette());
+
+		bitmapFile.close();
+	}
+
 	delete img;
 	delete pic;
 




More information about the Scummvm-git-logs mailing list