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
This commit is contained in:
parent
808380690c
commit
11222516c4
14 changed files with 264 additions and 57 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue