]> sigrok.org Git - pulseview.git/commitdiff
Fix #956 by adding the missing final sample to the range
authorSoeren Apel <redacted>
Wed, 30 May 2018 15:55:32 +0000 (17:55 +0200)
committerSoeren Apel <redacted>
Wed, 30 May 2018 22:33:59 +0000 (00:33 +0200)
pv/views/trace/analogsignal.cpp

index 8a055729e10d6305a2887e33cd87f660e516896f..655954a4812380eb5128a8b442ca4dbf405756d1 100644 (file)
@@ -407,7 +407,7 @@ void AnalogSignal::paint_trace(QPainter &p,
 
        p.setPen(base_->color());
 
-       const int64_t points_count = end - start;
+       const int64_t points_count = end - start + 1;
 
        QPointF *points = new QPointF[points_count];
        QPointF *point = points;
@@ -420,7 +420,7 @@ void AnalogSignal::paint_trace(QPainter &p,
        segment->get_samples(start, start + sample_count, sample_block);
 
        const int w = 2;
-       for (int64_t sample = start; sample != end; sample++, block_sample++) {
+       for (int64_t sample = start; sample <= end; sample++, block_sample++) {
 
                if (block_sample == TracePaintBlockSize) {
                        block_sample = 0;
@@ -428,8 +428,7 @@ void AnalogSignal::paint_trace(QPainter &p,
                        segment->get_samples(sample, sample + sample_count, sample_block);
                }
 
-               const float x = (sample / samples_per_pixel -
-                       pixels_offset) + left;
+               const float x = left + (sample / samples_per_pixel - pixels_offset);
 
                *point++ = QPointF(x, y - sample_block[block_sample] * scale_);