Optimize and simplify MarkerView_QueryItemBkColor

This commit is contained in:
Morilli 2024-10-01 20:36:02 +02:00
parent 0fe8fadc39
commit 5cc4c1f924
1 changed files with 16 additions and 22 deletions

View File

@ -51,26 +51,21 @@ namespace BizHawk.Client.EmuHawk
private void MarkerView_QueryItemBkColor(int index, RollColumn column, ref Color color)
{
// This could happen if the control is told to redraw while Tastudio is rebooting, as we would not have a TasMovie just yet
if (Tastudio.CurrentTasMovie is null)
{
return;
}
if (Tastudio.CurrentTasMovie is null) return;
if (index >= Markers.Count) return; // this should never happen
var marker = Markers[index];
var prev = Markers.PreviousOrCurrent(Tastudio.Emulator.Frame);
if (prev != null && index == Markers.IndexOf(prev))
if (ReferenceEquals(marker, prev))
{
// feos: taseditor doesn't have it, so we're free to set arbitrary color scheme. and I prefer consistency
color = Tastudio.Palette.CurrentFrame_InputLog;
}
else if (index < Markers.Count)
else if (Tastudio.CurrentTasMovie.LagLog[marker.Frame + 1] is bool lagged)
{
var marker = Markers[index];
bool? lagged = Tastudio.CurrentTasMovie.LagLog[marker.Frame + 1];
if (lagged.HasValue)
{
if (lagged.Value)
if (lagged)
{
color = column.Name == "FrameColumn"
? Tastudio.Palette.LagZone_FrameCol
@ -84,7 +79,6 @@ namespace BizHawk.Client.EmuHawk
}
}
}
}
private void MarkerView_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY)
{