aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Window.cs
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2020-12-16 03:19:07 +0100
committerGitHub <noreply@github.com>2020-12-15 23:19:07 -0300
commit11222516c4b5042cd8da6fdd72f53ee736139b66 (patch)
treea58a7870dbe3ac59a2b7fc4229dc507a753adbea /Ryujinx.Graphics.OpenGL/Window.cs
parent808380690c684a7598efad791f560e02ce70bc82 (diff)
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
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Window.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/Window.cs12
1 files changed, 2 insertions, 10 deletions
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);