[gnome-games] runner: Add capture_current_state_pixbuf()



commit a218fb8316b9dfca187f81967e0b9663978a00e1
Author: Yetizone <andreii lisita gmail com>
Date:   Thu Aug 8 12:22:50 2019 +0300

    runner: Add capture_current_state_pixbuf()

 src/command/command-runner.vala | 3 +++
 src/core/runner.vala            | 3 +++
 src/dummy/dummy-runner.vala     | 3 +++
 src/retro/retro-runner.vala     | 8 +++++++-
 4 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/command/command-runner.vala b/src/command/command-runner.vala
index e53b3db9..ddc569e9 100644
--- a/src/command/command-runner.vala
+++ b/src/command/command-runner.vala
@@ -53,6 +53,9 @@ public class Games.CommandRunner : Object, Runner {
                return null;
        }
 
+       public void capture_current_state_pixbuf () {
+       }
+
        public void start () throws Error {
                string? working_directory = null;
                string[]? envp = null;
diff --git a/src/core/runner.vala b/src/core/runner.vala
index dc186643..055214a0 100644
--- a/src/core/runner.vala
+++ b/src/core/runner.vala
@@ -17,6 +17,9 @@ public interface Games.Runner : Object {
        public abstract void resume () throws Error;
        public abstract void pause ();
        public abstract void stop ();
+
+       public abstract void capture_current_state_pixbuf ();
+
        public abstract bool try_create_savestate (bool is_automatic);
        public abstract void load_savestate (Savestate savestate) throws Error;
        public abstract Savestate[] get_savestates ();
diff --git a/src/dummy/dummy-runner.vala b/src/dummy/dummy-runner.vala
index df750e48..84fa4c57 100644
--- a/src/dummy/dummy-runner.vala
+++ b/src/dummy/dummy-runner.vala
@@ -40,6 +40,9 @@ private class Games.DummyRunner : Object, Runner {
                return null;
        }
 
+       public void capture_current_state_pixbuf () {
+       }
+
        public void start () throws Error {
        }
 
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index ffe8ebbd..72b6e3d7 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -49,6 +49,8 @@ public class Games.RetroRunner : Object, Runner {
        private Savestate latest_savestate;
        private Savestate tmp_live_savestate;
 
+       private Gdk.Pixbuf current_state_pixbuf;
+
        private bool _running;
        private bool running {
                get { return _running; }
@@ -148,6 +150,10 @@ public class Games.RetroRunner : Object, Runner {
                return view;
        }
 
+       public void capture_current_state_pixbuf () {
+               current_state_pixbuf = view.get_pixbuf ();
+       }
+
        public virtual Gtk.Widget? get_extra_widget () {
                return null;
        }
@@ -493,7 +499,7 @@ public class Games.RetroRunner : Object, Runner {
        }
 
        private void save_screenshot_in_tmp () throws Error {
-               var pixbuf = view.get_pixbuf ();
+               var pixbuf = current_state_pixbuf;
                if (pixbuf == null)
                        return;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]