projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
06ef804
)
DecodeTrace: Use an stl algorithm to find if all annotations are the same colour
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sat, 2 Jan 2016 15:32:02 +0000
(15:32 +0000)
committer
Uwe Hermann
<uwe@hermann-uwe.de>
Sun, 3 Jan 2016 19:09:30 +0000
(20:09 +0100)
pv/view/decodetrace.cpp
patch
|
blob
|
history
diff --git
a/pv/view/decodetrace.cpp
b/pv/view/decodetrace.cpp
index f2aadd1b18ff3c7e4b8904a53aeef1b8f7c8d0a9..30d1667c5744073f310e7c4001aecfb5b90ce5aa 100644
(file)
--- a/
pv/view/decodetrace.cpp
+++ b/
pv/view/decodetrace.cpp
@@
-431,14
+431,10
@@
void DecodeTrace::draw_annotation_block(
// Check if all annotations are of the same type (i.e. we can use one color)
// or if we should use a neutral color (i.e. gray)
// Check if all annotations are of the same type (i.e. we can use one color)
// or if we should use a neutral color (i.e. gray)
- bool single_format = true;
- int format = annotations.front().format();
-
- for (const Annotation &a : annotations)
- if (a.format() != format) {
- single_format = false;
- break;
- }
+ const int format = annotations.front().format();
+ const bool single_format = std::all_of(
+ annotations.begin(), annotations.end(),
+ [&](const Annotation &a) { return a.format() == format; });
p.setPen((single_format ? OutlineColours[colour] : Qt::gray));
p.setBrush(QBrush((single_format ? Colours[colour] : Qt::gray),
p.setPen((single_format ? OutlineColours[colour] : Qt::gray));
p.setBrush(QBrush((single_format ? Colours[colour] : Qt::gray),