[gnome-games/wip/exalm/ds: 3/15] retro-runner: Use savestate aspect ratio for pixbufs



commit 73e19de5b2190aace53eb87d5d438745ab36fda5
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Wed Aug 14 00:43:53 2019 +0500

    retro-runner: Use savestate aspect ratio for pixbufs
    
    Use Retro.pixbuf_set_aspect_ratio() before sending the pxibuf to retro-gtk.
    This ensures that the pixbuf is displayed with correct aspect ratio.
    
    If no aspect ratio is present, do nothing, falling back to the previous
    behavior.

 src/retro/retro-runner.vala | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index a48b6220..5e2ab607 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -182,6 +182,11 @@ public class Games.RetroRunner : Object, Runner {
                // a critical operation
                try {
                        pixbuf = new Gdk.Pixbuf.from_file (screenshot_path);
+
+                       var aspect_ratio = savestate.get_screenshot_aspect_ratio ();
+
+                       if (aspect_ratio != 0)
+                               Retro.pixbuf_set_aspect_ratio (pixbuf, (float) aspect_ratio);
                }
                catch (Error e) {
                        warning ("Couldn't load %s: %s", screenshot_path, e.message);


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