| 1015 | } |
| 1016 | |
| 1017 | void DsoSignal::paint_envelope(QPainter &p, |
| 1018 | const pv::data::DsoSnapshot *snapshot, |
| 1019 | int zeroY, int left, const int64_t start, const int64_t end, int hw_offset, |
| 1020 | const double pixels_offset, const double samples_per_pixel, uint64_t num_channels) |
| 1021 | { |
| 1022 | using namespace Qt; |
| 1023 | using pv::data::DsoSnapshot; |
| 1024 | |
| 1025 | data::DsoSnapshot *pshot = const_cast<data::DsoSnapshot*>(snapshot); |
| 1026 | |
| 1027 | DsoSnapshot::EnvelopeSection e; |
| 1028 | const uint16_t index = get_index() % num_channels; |
| 1029 | pshot->get_envelope_section(e, start, end, samples_per_pixel, index); |
| 1030 | |
| 1031 | if (e.length < 2) |
| 1032 | return; |
| 1033 | |
| 1034 | p.setPen(QPen(NoPen)); |
| 1035 | //p.setPen(QPen(_colour, 2, Qt::SolidLine)); |
| 1036 | QColor envelope_colour = _colour; |
| 1037 | envelope_colour.setAlpha(View::ForeAlpha); |
| 1038 | p.setBrush(envelope_colour); |
| 1039 | |
| 1040 | QRectF *const rects = new QRectF[e.length]; |
| 1041 | QRectF *rect = rects; |
| 1042 | float top = get_view_rect().top(); |
| 1043 | float bottom = get_view_rect().bottom(); |
| 1044 | for(uint64_t sample = 0; sample < e.length-1; sample++) { |
| 1045 | const float x = ((e.scale * sample + e.start) / |
| 1046 | samples_per_pixel - pixels_offset) + left + _view->trig_hoff()/samples_per_pixel; |
| 1047 | const DsoSnapshot::EnvelopeSample *const s = |
| 1048 | e.samples + sample; |
| 1049 | |
| 1050 | // We overlap this sample with the next so that vertical |
| 1051 | // gaps do not appear during steep rising or falling edges |
| 1052 | const float b = min(max(top, ((max(s->max, (s+1)->min) - hw_offset) * _scale + zeroY)), bottom); |
| 1053 | const float t = min(max(top, ((min(s->min, (s+1)->max) - hw_offset) * _scale + zeroY)), bottom); |
| 1054 | |
| 1055 | float h = b - t; |
| 1056 | if(h >= 0.0f && h <= 1.0f) |
| 1057 | h = 1.0f; |
| 1058 | if(h <= 0.0f && h >= -1.0f) |
| 1059 | h = -1.0f; |
| 1060 | |
| 1061 | *rect++ = QRectF(x, t, 1.0f, h); |
| 1062 | } |
| 1063 | |
| 1064 | p.drawRects(rects, e.length); |
| 1065 | |
| 1066 | delete[] rects; |
| 1067 | //delete[] e.samples; |
| 1068 | } |
| 1069 | |
| 1070 | void DsoSignal::paint_type_options(QPainter &p, int right, const QPoint pt, QColor fore) |
| 1071 | { |
nothing calls this directly
no test coverage detected