X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fdecodetrace.cpp;h=e0f3a0f262734509dadd3d412a920fb2dfe789fc;hp=f2aadd1b18ff3c7e4b8904a53aeef1b8f7c8d0a9;hb=086f4df565d8e70328f3c4bbc92949e0817dc6d4;hpb=eee89ff865c28854eebdcecbe344f225b9ee366f diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index f2aadd1b..e0f3a0f2 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -415,36 +415,22 @@ void DecodeTrace::draw_annotation_block( const double top = y + .5 - h / 2; const double bottom = y + .5 + h / 2; - const double cap_width = min((end - start) / 4, EndCapWidth); - - QPointF pts[] = { - QPointF(start, y + .5f), - QPointF(start + cap_width, top), - QPointF(end - cap_width, top), - QPointF(end, y + .5f), - QPointF(end - cap_width, bottom), - QPointF(start + cap_width, bottom) - }; const size_t colour = (base_colour + annotations.front().format()) % countof(Colours); // 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), Qt::Dense4Pattern)); - - p.drawConvexPolygon(pts, countof(pts)); + p.drawRoundedRect( + QRectF(start, top, end - start, bottom - top), h/4, h/4); } void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter &p,