pulseview/0009-DecodeTrace-Remove-unn...

94 lines
3.2 KiB
Diff

From f765c3db91d60e9b038ee05f2fa6acc8587d8470 Mon Sep 17 00:00:00 2001
From: Soeren Apel <soeren@apelpie.net>
Date: Thu, 4 Feb 2016 22:39:35 +0100
Subject: [PATCH 09/13] DecodeTrace: Remove unnecessary parameters
---
pv/view/decodetrace.cpp | 19 +++++++------------
pv/view/decodetrace.hpp | 5 ++---
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp
index 6f00a45..95e0e5e 100644
--- a/pv/view/decodetrace.cpp
+++ b/pv/view/decodetrace.cpp
@@ -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<QString> 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));
diff --git a/pv/view/decodetrace.hpp b/pv/view/decodetrace.hpp
index fb14ae0..eb011e7 100644
--- a/pv/view/decodetrace.hpp
+++ b/pv/view/decodetrace.hpp
@@ -138,11 +138,10 @@ private:
QPainter &p, int h, int y, size_t base_colour) const;
void 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;
void 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 h, double start, double end, int y, const ViewItemPaintParams &pp,
int row_title_width) const;
void draw_error(QPainter &p, const QString &message,
--
2.4.3