]> sigrok.org Git - pulseview.git/commitdiff
AnalogSignal::paint_trace(): Factor out a const variable.
authorUwe Hermann <redacted>
Fri, 17 Mar 2017 22:00:04 +0000 (23:00 +0100)
committerUwe Hermann <redacted>
Fri, 17 Mar 2017 22:56:05 +0000 (23:56 +0100)
pv/view/analogsignal.cpp

index 399802b5e0f754ca0eebded3393344f52bb2e053..c393bc7cdc00adc9a5b0062530e53cfba1a98a02 100644 (file)
@@ -277,7 +277,9 @@ void AnalogSignal::paint_trace(QPainter &p,
 {
        p.setPen(base_->colour());
 
-       QPointF *points = new QPointF[end - start];
+       const int64_t points_count = end - start;
+
+       QPointF *points = new QPointF[points_count];
        QPointF *point = points;
 
        pv::data::SegmentAnalogDataIterator* it =
@@ -292,7 +294,7 @@ void AnalogSignal::paint_trace(QPainter &p,
        }
        segment->end_sample_iteration(it);
 
-       p.drawPolyline(points, point - points);
+       p.drawPolyline(points, points_count);
 
        delete[] points;
 }