projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d37ff80
)
AnalogSignal: Prevent threshold bg from spilling beyond extents
author
Soeren Apel
<soeren@apelpie.net>
Mon, 21 Aug 2017 17:58:49 +0000
(19:58 +0200)
committer
Soeren Apel
<soeren@apelpie.net>
Mon, 21 Aug 2017 17:58:49 +0000
(19:58 +0200)
pv/views/trace/analogsignal.cpp
patch
|
blob
|
history
diff --git
a/pv/views/trace/analogsignal.cpp
b/pv/views/trace/analogsignal.cpp
index 2c5c82a9d1d18c5609d9d7965d2a10f35a6e2149..07fc7cf72add70fda687d3bc9b304bcfdf1d72fc 100644
(file)
--- a/
pv/views/trace/analogsignal.cpp
+++ b/
pv/views/trace/analogsignal.cpp
@@
-225,8
+225,10
@@
void AnalogSignal::paint_back(QPainter &p, ViewItemPaintParams &pp)
// Draw high/neutral/low areas
if (thresholds.size() == 2) {
// Draw high/neutral/low areas
if (thresholds.size() == 2) {
- const double thr_lo = visual_y - thresholds[0] * scale_;
- const double thr_hi = visual_y - thresholds[1] * scale_;
+ int thr_lo = visual_y - thresholds[0] * scale_;
+ int thr_hi = visual_y - thresholds[1] * scale_;
+ thr_lo = min(max(thr_lo, top), btm);
+ thr_hi = min(max(thr_hi, top), btm);
p.fillRect(QRectF(pp.left(), top, pp.width(), thr_hi - top),
QBrush(ThresholdColorHi));
p.fillRect(QRectF(pp.left(), top, pp.width(), thr_hi - top),
QBrush(ThresholdColorHi));
@@
-235,7
+237,8
@@
void AnalogSignal::paint_back(QPainter &p, ViewItemPaintParams &pp)
p.fillRect(QRectF(pp.left(), thr_lo, pp.width(), btm - thr_lo),
QBrush(ThresholdColorLo));
} else {
p.fillRect(QRectF(pp.left(), thr_lo, pp.width(), btm - thr_lo),
QBrush(ThresholdColorLo));
} else {
- const double thr = visual_y - thresholds[0] * scale_;
+ int thr = visual_y - thresholds[0] * scale_;
+ thr = min(max(thr, top), btm);
p.fillRect(QRectF(pp.left(), top, pp.width(), thr - top),
QBrush(ThresholdColorHi));
p.fillRect(QRectF(pp.left(), top, pp.width(), thr - top),
QBrush(ThresholdColorHi));