From 8ad24ac48f4fbcc6006359dcac4cf128019249f8 Mon Sep 17 00:00:00 2001 From: Mike Walters Date: Sat, 26 Mar 2016 03:41:49 +0000 Subject: [PATCH] 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. --- traceplot.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/traceplot.cpp b/traceplot.cpp index f8b169c..42af4bb 100644 --- a/traceplot.cpp +++ b/traceplot.cpp @@ -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); }