Skip repeating pixels during draw

This commit is contained in:
Andy Adshead 2019-01-31 23:57:22 +00:00
parent c7bc7ba166
commit e350fc5113

View file

@ -47,6 +47,8 @@ namespace Ryujinx.Profiler.UI
}
GL.End();
int furthest = 0;
// Draw bars
GL.Begin(PrimitiveType.Triangles);
foreach (var entry in _sortedProfileData)
@ -54,14 +56,21 @@ namespace Ryujinx.Profiler.UI
GL.Color3(Color.Green);
foreach (Timestamp timestamp in entry.Value.GetAllTimestamps())
{
right = (int)(xOffset + width - ((float)(_captureTime - (timestamp.EndTime + graphPositionTicks)) / timeWidthTicks) * width);
// Skip drawing multiple timestamps on same pixel
if (right <= furthest)
continue;
left = (int)(xOffset + width - ((float)(_captureTime - (timestamp.BeginTime + graphPositionTicks)) / timeWidthTicks) * width);
right = (int)(xOffset + width - ((float)(_captureTime - (timestamp.EndTime + graphPositionTicks)) / timeWidthTicks) * width);
bottom = GetLineY(yOffset, LineHeight, LinePadding, true, verticalIndex);
top = bottom + barHeight;
// Make sure width is at least 1px
right = Math.Max(left + 1, right);
furthest = right;
// Skip rendering out of bounds bars
if (top < 0 || bottom > Height)
continue;