traceplot: Fix plotting of first sample in painter path

Previously was drawing a line from (0,0) to the first sample rather
than setting the initial position to the first sample then drawing
from there.
This commit is contained in:
Mike Walters
2016-03-26 03:41:49 +00:00
parent 2d948d2e67
commit 8ad24ac48f

View File

@@ -101,10 +101,13 @@ void TracePlot::plotTrace(QPainter &painter, const QRect &rect, float *samples,
float x = i * xStep;
float y = (1 - sample) * (rect.height() / 2);
x = xRange.clip(x);
y = yRange.clip(y);
x = xRange.clip(x) + rect.x();
y = yRange.clip(y) + rect.y();
path.lineTo(x + rect.x(), y + rect.y());
if (i == 0)
path.moveTo(x, y);
else
path.lineTo(x, y);
}
painter.drawPath(path);
}