Unindented #if's and #regions

This commit is contained in:
Andy Adshead 2019-04-26 00:50:15 +01:00
parent 7c46899e2a
commit 464eb95a69
3 changed files with 51 additions and 51 deletions

View file

@ -35,7 +35,7 @@ namespace Ryujinx.Profiler
public static bool ProfilingEnabled()
{
#if USE_PROFILING
#if USE_PROFILING
if (!_settings.Enabled)
return false;
@ -43,9 +43,9 @@ namespace Ryujinx.Profiler
_profileInstance = new InternalProfile(_settings.History, _settings.MaxFlags);
return true;
#else
#else
return false;
#endif
#endif
}
[Conditional("USE_PROFILING")]
@ -98,46 +98,46 @@ namespace Ryujinx.Profiler
public static string GetSession()
{
#if USE_PROFILING
#if USE_PROFILING
if (!ProfilingEnabled())
return null;
return _profileInstance.GetSession();
#else
#else
return "";
#endif
#endif
}
public static List<KeyValuePair<ProfileConfig, TimingInfo>> GetProfilingData()
{
#if USE_PROFILING
#if USE_PROFILING
if (!ProfilingEnabled())
return new List<KeyValuePair<ProfileConfig, TimingInfo>>();
return _profileInstance.GetProfilingData();
#else
#else
return new List<KeyValuePair<ProfileConfig, TimingInfo>>();
#endif
#endif
}
public static TimingFlag[] GetTimingFlags()
{
#if USE_PROFILING
#if USE_PROFILING
if (!ProfilingEnabled())
return new TimingFlag[0];
return _profileInstance.GetTimingFlags();
#else
#else
return new TimingFlag[0];
#endif
#endif
}
public static (long[], long[]) GetTimingAveragesAndLast()
{
#if USE_PROFILING
#if USE_PROFILING
if (!ProfilingEnabled())
return (new long[0], new long[0]);
return _profileInstance.GetTimingAveragesAndLast();
#else
#else
return (new long[0], new long[0]);
#endif
#endif
}
}
}

View file

@ -137,7 +137,7 @@ namespace Ryujinx.Profiler.UI
_profileUpdated = true;
}
#region OnLoad
#region OnLoad
/// <summary>
/// Setup OpenGL and load resources
/// </summary>
@ -186,9 +186,9 @@ namespace Ryujinx.Profiler.UI
Visible = _visible;
}
#endregion
#endregion
#region OnResize
#region OnResize
/// <summary>
/// Respond to resize events
/// </summary>
@ -198,9 +198,9 @@ namespace Ryujinx.Profiler.UI
{
_viewportUpdated = true;
}
#endregion
#endregion
#region OnClose
#region OnClose
/// <summary>
/// Intercept close event and hide instead
/// </summary>
@ -215,9 +215,9 @@ namespace Ryujinx.Profiler.UI
base.OnClosing(e);
}
#endregion
#endregion
#region OnUpdateFrame
#region OnUpdateFrame
/// <summary>
/// Profile Update Loop
/// </summary>
@ -338,9 +338,9 @@ namespace Ryujinx.Profiler.UI
_processEventTimer = 0;
}
}
#endregion
#endregion
#region OnRenderFrame
#region OnRenderFrame
/// <summary>
/// Profile Render Loop
/// </summary>
@ -411,12 +411,12 @@ namespace Ryujinx.Profiler.UI
}
GL.End();
_maxScroll = (LineHeight + LinePadding) * (_sortedProfileData.Count - 1);
#endregion
#endregion
lock (_profileDataLock)
{
// Display category
#region Category
// Display category
#region Category
verticalIndex = 0;
foreach (var entry in _sortedProfileData)
{
@ -441,10 +441,10 @@ namespace Ryujinx.Profiler.UI
maxWidth = width;
xOffset += maxWidth + ColumnSpacing;
#endregion
#endregion
// Display session group
#region Session Group
// Display session group
#region Session Group
maxWidth = 0;
verticalIndex = 0;
@ -472,10 +472,10 @@ namespace Ryujinx.Profiler.UI
maxWidth = width;
xOffset += maxWidth + ColumnSpacing;
#endregion
#endregion
// Display session item
#region Session Item
// Display session item
#region Session Item
maxWidth = 0;
verticalIndex = 0;
GL.Enable(EnableCap.ScissorTest);
@ -503,7 +503,7 @@ namespace Ryujinx.Profiler.UI
xOffset += maxWidth + ColumnSpacing;
_buttons[(int)ButtonIndex.TagTitle].UpdateSize(0, Height - TitleFontHeight, 0, (int)xOffset, TitleFontHeight);
#endregion
#endregion
// Timing data
timingWidth = Width - xOffset - 370;
@ -529,8 +529,8 @@ namespace Ryujinx.Profiler.UI
xOffset = Width - 360;
// Display timestamps
#region Timestamps
// Display timestamps
#region Timestamps
verticalIndex = 0;
long totalInstant = 0;
long totalAverage = 0;
@ -583,10 +583,10 @@ namespace Ryujinx.Profiler.UI
_fontService.DrawText($"{GetTimeString(totalInstant)} ({totalCount})", xOffset, yHeight, textHeight);
_fontService.DrawText(GetTimeString(totalAverage), 150 + xOffset, yHeight, textHeight);
_fontService.DrawText(GetTimeString(totalTime), 260 + xOffset, yHeight, textHeight);
#endregion
#endregion
}
#region Bottom bar
#region Bottom bar
// Show/Hide Inactive
float widthShowHideButton = _buttons[(int)ButtonIndex.ShowHideInactive].UpdateSize($"{(_showInactive ? "Hide" : "Show")} Inactive", 5, 5, 4, 16);
@ -616,7 +616,7 @@ namespace Ryujinx.Profiler.UI
// Filter bar
_fontService.DrawText($"{(_regexEnabled ? "Regex " : "Filter")}: {_filterText}", 35 + width, 7, 16);
_buttons[(int)ButtonIndex.FilterBar].UpdateSize((int)(45 + width), 0, 0, Width, FilterHeight);
#endregion
#endregion
// Draw buttons
for (int i = 0; i < (int)ButtonIndex.Autodraw; i++)
@ -624,8 +624,8 @@ namespace Ryujinx.Profiler.UI
_buttons[i].Draw();
}
// Dividing lines
#region Dividing lines
// Dividing lines
#region Dividing lines
GL.Color3(Color.White);
GL.Begin(PrimitiveType.Lines);
// Top divider
@ -670,12 +670,12 @@ namespace Ryujinx.Profiler.UI
GL.Vertex2(timingWidth + timingDataLeft, FilterHeight);
GL.Vertex2(timingWidth + timingDataLeft, timingDataTop);
GL.End();
#endregion
#endregion
_redrawPending = false;
SwapBuffers();
}
#endregion
#endregion
private string GetTimeString(long timestamp)
{

View file

@ -36,9 +36,9 @@ namespace Ryujinx
private string _newTitle;
#if USE_PROFILING
#if USE_PROFILING
private ProfileWindowManager _profileWindow;
#endif
#endif
public GlScreen(Switch device, IGalRenderer renderer)
: base(1280, 720,
@ -53,10 +53,10 @@ namespace Ryujinx
(DisplayDevice.Default.Width / 2) - (Width / 2),
(DisplayDevice.Default.Height / 2) - (Height / 2));
#if USE_PROFILING
#if USE_PROFILING
// Start profile window, it will handle itself from there
_profileWindow = new ProfileWindowManager();
#endif
#endif
}
private void RenderLoop()
@ -153,10 +153,10 @@ namespace Ryujinx
{
KeyboardState keyboard = _keyboard.Value;
#if USE_PROFILING
#if USE_PROFILING
// Profiler input, lets the profiler get access to the main windows keyboard state
_profileWindow.UpdateKeyInput(keyboard);
#endif
#endif
// Normal Input
currentButton = Configuration.Instance.KeyboardControls.GetButtons(keyboard);
@ -283,9 +283,9 @@ namespace Ryujinx
protected override void OnUnload(EventArgs e)
{
#if USE_PROFILING
#if USE_PROFILING
_profileWindow.Close();
#endif
#endif
_renderThread.Join();