Couple alignment changes

This commit is contained in:
Andy Adshead 2019-02-02 03:37:03 +00:00
commit 6329ee96b2

View file

@ -13,7 +13,7 @@ namespace Ryujinx.Profiler.UI
private const float GraphZoomSpeed = 50; private const float GraphZoomSpeed = 50;
private float _graphZoom = 1; private float _graphZoom = 1;
private float _graphPosition = 0; private float _graphPosition = 0;
private void DrawGraph(float xOffset, float yOffset, float width) private void DrawGraph(float xOffset, float yOffset, float width)
{ {
@ -28,13 +28,13 @@ namespace Ryujinx.Profiler.UI
long history = Profile.HistoryLength; long history = Profile.HistoryLength;
double timeWidthTicks = history / (double)_graphZoom; double timeWidthTicks = history / (double)_graphZoom;
long graphPositionTicks = (long)(_graphPosition * PerformanceCounter.TicksPerMillisecond); long graphPositionTicks = (long)(_graphPosition * PerformanceCounter.TicksPerMillisecond);
long ticksPerPixel = (long)(timeWidthTicks / width); long ticksPerPixel = (long)(timeWidthTicks / width);
// Reset start point if out of bounds // Reset start point if out of bounds
if (timeWidthTicks + graphPositionTicks > history) if (timeWidthTicks + graphPositionTicks > history)
{ {
graphPositionTicks = history - (long)timeWidthTicks; graphPositionTicks = history - (long)timeWidthTicks;
_graphPosition = (float)graphPositionTicks / PerformanceCounter.TicksPerMillisecond; _graphPosition = (float)graphPositionTicks / PerformanceCounter.TicksPerMillisecond;
} }
graphPositionTicks = _captureTime - graphPositionTicks; graphPositionTicks = _captureTime - graphPositionTicks;
@ -58,7 +58,7 @@ namespace Ryujinx.Profiler.UI
long furthest = 0; long furthest = 0;
bottom = GetLineY(yOffset, LineHeight, LinePadding, true, verticalIndex); bottom = GetLineY(yOffset, LineHeight, LinePadding, true, verticalIndex);
top = bottom + barHeight; top = bottom + barHeight;
// Skip rendering out of bounds bars // Skip rendering out of bounds bars
if (top < 0 || bottom > Height) if (top < 0 || bottom > Height)
@ -93,7 +93,7 @@ namespace Ryujinx.Profiler.UI
long entryBegin = entry.Value.BeginTime; long entryBegin = entry.Value.BeginTime;
if (entryBegin != -1) if (entryBegin != -1)
{ {
left = (int)(graphRight - ((graphPositionTicks - entryBegin) / timeWidthTicks) * width); left = (int)(graphRight - ((graphPositionTicks - entryBegin) / timeWidthTicks) * width);
// Make sure width is at least 1px // Make sure width is at least 1px
left = Math.Min(left - 1, (int)graphRight); left = Math.Min(left - 1, (int)graphRight);