0
0
Fork 0

UI - Scale end framebuffer blit (#3342)

* Scale end framebuffer blit

* fix

* fix

* apply changes to avalonia
This commit is contained in:
Emmanuel Hansen 2022-05-16 21:10:29 +00:00 committed by GitHub
parent b8fc97adf2
commit 7b9c4757dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 20 deletions

View file

@ -177,7 +177,7 @@ namespace Ryujinx.Ava
{ {
if (_renderer != null) if (_renderer != null)
{ {
double scale = Program.WindowScaleFactor; double scale = _parent.PlatformImpl.RenderScaling;
_renderer.Window.SetSize((int)(size.Width * scale), (int)(size.Height * scale)); _renderer.Window.SetSize((int)(size.Width * scale), (int)(size.Height * scale));
} }
} }
@ -809,7 +809,7 @@ namespace Ryujinx.Ava
Width = (int)Renderer.Bounds.Width; Width = (int)Renderer.Bounds.Width;
Height = (int)Renderer.Bounds.Height; Height = (int)Renderer.Bounds.Height;
_renderer.Window.SetSize((int)(Width * Program.WindowScaleFactor), (int)(Height * Program.WindowScaleFactor)); _renderer.Window.SetSize((int)(Width * _parent.PlatformImpl.RenderScaling), (int)(Height * _parent.PlatformImpl.RenderScaling));
Device.Gpu.Renderer.RunLoop(() => Device.Gpu.Renderer.RunLoop(() =>
{ {

View file

@ -73,10 +73,13 @@ namespace Ryujinx.Ava.Ui.Controls
{ {
SizeChanged?.Invoke(this, rect.Size); SizeChanged?.Invoke(this, rect.Size);
RenderSize = rect.Size * Program.WindowScaleFactor; if (!rect.IsEmpty)
{
RenderSize = rect.Size * VisualRoot.RenderScaling;
_glDrawOperation?.Dispose(); _glDrawOperation?.Dispose();
_glDrawOperation = new GlDrawOperation(this); _glDrawOperation = new GlDrawOperation(this);
}
} }
public override void Render(DrawingContext context) public override void Render(DrawingContext context)

View file

@ -123,10 +123,6 @@ namespace Ryujinx.Ava.Ui.Windows
CheckLaunchState(); CheckLaunchState();
} }
if (OperatingSystem.IsLinux())
{
Program.WindowScaleFactor = this.PlatformImpl.RenderScaling;
}
_rendererWaitEvent = new AutoResetEvent(false); _rendererWaitEvent = new AutoResetEvent(false);
} }

View file

@ -114,12 +114,12 @@ namespace Ryujinx.Ui
GL.BlitFramebuffer(0, GL.BlitFramebuffer(0,
0, 0,
AllocatedWidth, WindowWidth,
AllocatedHeight, WindowHeight,
0, 0,
0, 0,
AllocatedWidth, WindowWidth,
AllocatedHeight, WindowHeight,
ClearBufferMask.ColorBufferBit, ClearBufferMask.ColorBufferBit,
BlitFramebufferFilter.Linear); BlitFramebufferFilter.Linear);
} }

View file

@ -41,6 +41,8 @@ namespace Ryujinx.Ui
public IRenderer Renderer { get; private set; } public IRenderer Renderer { get; private set; }
public bool ScreenshotRequested { get; set; } public bool ScreenshotRequested { get; set; }
protected int WindowWidth { get; private set; }
protected int WindowHeight { get; private set; }
public static event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent; public static event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
@ -71,9 +73,6 @@ namespace Ryujinx.Ui
private IKeyboard _keyboardInterface; private IKeyboard _keyboardInterface;
private GraphicsDebugLevel _glLogLevel; private GraphicsDebugLevel _glLogLevel;
private string _gpuVendorName; private string _gpuVendorName;
private int _windowHeight;
private int _windowWidth;
private bool _isMouseInClient; private bool _isMouseInClient;
public RendererWidgetBase(InputManager inputManager, GraphicsDebugLevel glLogLevel) public RendererWidgetBase(InputManager inputManager, GraphicsDebugLevel glLogLevel)
@ -223,10 +222,10 @@ namespace Ryujinx.Ui
Gdk.Monitor monitor = Display.GetMonitorAtWindow(Window); Gdk.Monitor monitor = Display.GetMonitorAtWindow(Window);
_windowWidth = evnt.Width * monitor.ScaleFactor; WindowWidth = evnt.Width * monitor.ScaleFactor;
_windowHeight = evnt.Height * monitor.ScaleFactor; WindowHeight = evnt.Height * monitor.ScaleFactor;
Renderer?.Window.SetSize(_windowWidth, _windowHeight); Renderer?.Window.SetSize(WindowWidth, WindowHeight);
return result; return result;
} }
@ -307,7 +306,7 @@ namespace Ryujinx.Ui
} }
Renderer = renderer; Renderer = renderer;
Renderer?.Window.SetSize(_windowWidth, _windowHeight); Renderer?.Window.SetSize(WindowWidth, WindowHeight);
if (Renderer != null) if (Renderer != null)
{ {