[gnome-games/wip/exalm/runner-refactor: 22/33] retro-runner: Move save_screenshot() to where it's used
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/runner-refactor: 22/33] retro-runner: Move save_screenshot() to where it's used
- Date: Fri, 6 Mar 2020 14:18:47 +0000 (UTC)
commit 089bf2d3a0baf21197244827d0db881a34e85c79
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Mar 6 17:01:45 2020 +0500
retro-runner: Move save_screenshot() to where it's used
src/retro/retro-runner.vala | 58 ++++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 6ed90cbf..7a8f2eae 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -552,35 +552,6 @@ public class Games.RetroRunner : Object, Runner {
core.load_memory (Retro.MemoryType.SAVE_RAM, save_ram_path);
}
- private void save_screenshot (string path) throws Error {
- var pixbuf = current_state_pixbuf;
- if (pixbuf == null)
- return;
-
- var now = new GLib.DateTime.now_local ();
- var creation_time = now.to_string ();
- var game_title = game.name;
- var platform = game.platform;
- var platform_name = platform.get_name ();
- var platform_id = platform.get_id ();
- if (platform_name == null) {
- critical ("Unknown name for platform %s", platform_id);
- platform_name = _("Unknown platform");
- }
-
-
- // See http://www.libpng.org/pub/png/spec/iso/index-object.html#11textinfo
- // for description of used keys. "Game Title" and "Platform" are
- // non-standard fields as allowed by PNG specification.
- pixbuf.save (path, "png",
- "tEXt::Software", "GNOME Games",
- "tEXt::Title", @"Screenshot of $game_title on $platform_name",
- "tEXt::Creation Time", creation_time.to_string (),
- "tEXt::Game Title", game_title,
- "tEXt::Platform", platform_name,
- null);
- }
-
public Retro.Core get_core () {
return core;
}
@@ -632,6 +603,35 @@ public class Games.RetroRunner : Object, Runner {
}
}
+ private void save_screenshot (string path) throws Error {
+ var pixbuf = current_state_pixbuf;
+ if (pixbuf == null)
+ return;
+
+ var now = new GLib.DateTime.now_local ();
+ var creation_time = now.to_string ();
+ var game_title = game.name;
+ var platform = game.platform;
+ var platform_name = platform.get_name ();
+ var platform_id = platform.get_id ();
+ if (platform_name == null) {
+ critical ("Unknown name for platform %s", platform_id);
+ platform_name = _("Unknown platform");
+ }
+
+
+ // See http://www.libpng.org/pub/png/spec/iso/index-object.html#11textinfo
+ // for description of used keys. "Game Title" and "Platform" are
+ // non-standard fields as allowed by PNG specification.
+ pixbuf.save (path, "png",
+ "tEXt::Software", "GNOME Games",
+ "tEXt::Title", @"Screenshot of $game_title on $platform_name",
+ "tEXt::Creation Time", creation_time.to_string (),
+ "tEXt::Game Title", game_title,
+ "tEXt::Platform", platform_name,
+ null);
+ }
+
protected virtual void save_to_snapshot (Savestate savestate) throws Error {
// Populate the savestate in tmp with data from the current state of the game
store_save_ram_in_tmp ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]