GUI: FIx dialog dumping to PNG

This commit is contained in:
Eugene Sandulenko 2023-07-30 21:34:08 +02:00
parent 80df0fab4f
commit 3ff0d353be
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 10 additions and 4 deletions

View File

@ -92,10 +92,10 @@ public:
virtual void lostFocus();
virtual void receivedFocus(int x = -1, int y = -1) { if (x >= 0 && y >= 0) handleMouseMoved(x, y, 0); }
protected:
virtual void open();
virtual void close();
protected:
/** Recursively mark all the widgets in this dialog as dirty so they are redrawn */
void markWidgetsAsDirty();

View File

@ -44,6 +44,8 @@ void saveGUISnapshot(Graphics::Surface surf, const Common::String &filename) {
Image::writePNG(outFile, surf);
outFile.finalize();
outFile.close();
warning("Dumped %s", filename.c_str());
}
}
@ -65,15 +67,16 @@ void dumpDialogs(const Common::String &message, int res, const Common::String &l
// MessageDialog
GUI::MessageDialog messageDialog(message);
messageDialog.runModal(); // For rendering
messageDialog.open(); // For rendering
messageDialog.reflowLayout(); // For updating surface
g_gui.redrawFull();
g_system->grabOverlay(surf);
saveGUISnapshot(surf, "message-" + filename);
messageDialog.close();
// AboutDialog
GUI::AboutDialog aboutDialog;
aboutDialog.runModal(); // For rendering
aboutDialog.open(); // For rendering
aboutDialog.reflowLayout(); // For updating surface
g_gui.redrawFull();
g_system->grabOverlay(surf);
@ -81,11 +84,14 @@ void dumpDialogs(const Common::String &message, int res, const Common::String &l
aboutDialog.close();
// LauncherDialog
#if 0
GUI::LauncherChooser chooser;
chooser.selectLauncher();
chooser.runModal();
chooser.open();
g_system->grabOverlay(surf);
saveGUISnapshot(surf, "launcher-" + filename);
chooser.close();
#endif
}
void dumpAllDialogs(const Common::String &message) {