From ca04c4b272232111503fec2b135c065b9b86f64f Mon Sep 17 00:00:00 2001 From: Andy Adshead Date: Sat, 26 Jan 2019 20:04:41 +0000 Subject: [PATCH] Fix viewport errors --- Ryujinx.Profiler/UI/ProfileWindow.cs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Ryujinx.Profiler/UI/ProfileWindow.cs b/Ryujinx.Profiler/UI/ProfileWindow.cs index 4559ddd07e..4448ae7f43 100644 --- a/Ryujinx.Profiler/UI/ProfileWindow.cs +++ b/Ryujinx.Profiler/UI/ProfileWindow.cs @@ -26,7 +26,7 @@ namespace Ryujinx Pause = 6, } - private bool visible = true, initComplete = false; + private bool visible = true, initComplete = false, viewportUpdated = true; public bool visibleChanged; private FontService fontService; private List> rawPofileData, profileData; @@ -105,13 +105,7 @@ namespace Ryujinx /// There is no need to call the base implementation. protected override void OnResize(EventArgs e) { - GL.Viewport(0, 0, Width, Height); - - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - GL.Ortho(0, Width, 0, Height, 0.0, 4.0); - - fontService.UpdateScreenHeight(Height); + viewportUpdated = true; } #endregion @@ -228,10 +222,25 @@ namespace Ryujinx { return; } + + // Update viewport + if (viewportUpdated) + { + GL.Viewport(0, 0, Width, Height); + GL.MatrixMode(MatrixMode.Projection); + GL.LoadIdentity(); + GL.Ortho(0, Width, 0, Height, 0.0, 4.0); + + fontService.UpdateScreenHeight(Height); + + viewportUpdated = false; + } + + // Frame setup GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); - GL.ClearColor(Color.Black); + fontService.fontColor = Color.White; int verticalIndex = 0; int lineHeight = 16;