mirror of
https://github.com/miek/inspectrum.git
synced 2026-03-07 00:37:05 +01:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user