From 11222516c4b5042cd8da6fdd72f53ee736139b66 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Wed, 16 Dec 2020 03:19:07 +0100 Subject: gui/gpu: Implement setting and toggle for Aspect Ratio (#1777) * gui/gpu: Implement setting and toggle for Aspect Ratio * address gdkchan feedback and add 16:10 * fix config.json file * Fix rebase * Address gdkchan feedback * Address rip feedback * Fix aspectWidth --- Ryujinx.Graphics.OpenGL/Window.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'Ryujinx.Graphics.OpenGL') diff --git a/Ryujinx.Graphics.OpenGL/Window.cs b/Ryujinx.Graphics.OpenGL/Window.cs index 4abc408e..80149bf7 100644 --- a/Ryujinx.Graphics.OpenGL/Window.cs +++ b/Ryujinx.Graphics.OpenGL/Window.cs @@ -1,7 +1,5 @@ -using OpenTK; using OpenTK.Graphics; using OpenTK.Graphics.OpenGL; -using OpenTK.Platform; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.OpenGL.Image; using System; @@ -10,9 +8,6 @@ namespace Ryujinx.Graphics.OpenGL { class Window : IWindow, IDisposable { - private const int NativeWidth = 1280; - private const int NativeHeight = 720; - private readonly Renderer _renderer; private int _width; @@ -25,9 +20,6 @@ namespace Ryujinx.Graphics.OpenGL public Window(Renderer renderer) { _renderer = renderer; - - _width = NativeWidth; - _height = NativeHeight; } public void Present(ITexture texture, ImageCrop crop) @@ -104,8 +96,8 @@ namespace Ryujinx.Graphics.OpenGL srcY1 = (int)Math.Ceiling(srcY1 * scale); } - float ratioX = MathF.Min(1f, (_height * (float)NativeWidth) / ((float)NativeHeight * _width)); - float ratioY = MathF.Min(1f, (_width * (float)NativeHeight) / ((float)NativeWidth * _height)); + float ratioX = crop.IsStretched ? 1.0f : MathF.Min(1.0f, _height * crop.AspectRatioX / (_width * crop.AspectRatioY)); + float ratioY = crop.IsStretched ? 1.0f : MathF.Min(1.0f, _width * crop.AspectRatioY / (_height * crop.AspectRatioX)); int dstWidth = (int)(_width * ratioX); int dstHeight = (int)(_height * ratioY); -- cgit v1.2.3