From: Uwe Hermann Date: Fri, 17 Mar 2017 22:00:04 +0000 (+0100) Subject: AnalogSignal::paint_trace(): Factor out a const variable. X-Git-Tag: pulseview-0.4.0~146 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=76ce6c7ae29059774c36bee27f6e09bfec94b358;p=pulseview.git AnalogSignal::paint_trace(): Factor out a const variable. --- diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index 399802b5..c393bc7c 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -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; }