Unindented #if's and #regions

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

View file

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

View file

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

View file

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