X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fdecodetrace.cpp;h=b2ead1a66848600e1ae11425fe874d708b73f39a;hp=6f00a451fba062abfc9ccf13bc3c464f1ce0ac69;hb=da50281d;hpb=aee9dcf34d3bb5bf53803d3e132ae69475e434b7 diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index 6f00a451..b2ead1a6 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -199,8 +199,8 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp) const vector rows(decoder_stack_->get_visible_rows()); visible_rows_.clear(); - for (size_t i = 0; i < rows.size(); i++) { - const Row &row = rows[i]; + for (auto i : rows) { + const Row &row = i; // Cache the row title widths int row_title_width; @@ -229,7 +229,7 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp) y += row_height_; - visible_rows_.push_back(rows[i]); + visible_rows_.push_back(i); } } @@ -431,16 +431,16 @@ void DecodeTrace::draw_annotation(const pv::data::decode::Annotation &a, pixels_offset; const size_t colour = (base_colour + a.format()) % countof(Colours); - const QColor &fill = Colours[colour]; - const QColor &outline = OutlineColours[colour]; + p.setPen(OutlineColours[colour]); + p.setBrush(Colours[colour]); if (start > pp.right() + DrawPadding || end < pp.left() - DrawPadding) return; if (a.start_sample() == a.end_sample()) - draw_instant(a, p, fill, outline, h, start, y); + draw_instant(a, p, h, start, y); else - draw_range(a, p, fill, outline, h, start, end, y, pp, + draw_range(a, p, h, start, end, y, pp, row_title_width); } @@ -483,7 +483,7 @@ void DecodeTrace::draw_annotation_block( } void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter &p, - QColor fill, QColor outline, int h, double x, int y) const + int h, double x, int y) const { const QString text = a.annotations().empty() ? QString() : a.annotations().back(); @@ -491,8 +491,6 @@ void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter & 0.0) + h; const QRectF rect(x - w / 2, y - h / 2, w, h); - p.setPen(outline); - p.setBrush(fill); p.drawRoundedRect(rect, h / 2, h / 2); p.setPen(Qt::black); @@ -500,16 +498,13 @@ void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter & } void DecodeTrace::draw_range(const pv::data::decode::Annotation &a, QPainter &p, - QColor fill, QColor outline, int h, double start, - double end, int y, const ViewItemPaintParams &pp, int row_title_width) const + int h, double start, double end, int y, const ViewItemPaintParams &pp, + int row_title_width) const { const double top = y + .5 - h / 2; const double bottom = y + .5 + h / 2; const vector annotations = a.annotations(); - p.setPen(outline); - p.setBrush(fill); - // If the two ends are within 1 pixel, draw a vertical line if (start + 1.0 > end) { p.drawLine(QPointF(start, top), QPointF(start, bottom));