MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / paint_mid

Method paint_mid

DSView/pv/view/dsosignal.cpp:766–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

764}
765
766void DsoSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor back)
767{
768 (void)fore;
769 (void)back;
770
771 if (!_show || right <= left){
772 return;
773 }
774
775 assert(_data);
776 assert(_view);
777
778 if (enabled()) {
779 const int index = get_index();
780 const int width = right - left;
781 const float zeroY = get_zero_vpos();
782
783 const double scale = _view->scale();
784 assert(scale > 0);
785 const int64_t offset = _view->offset();
786
787 if (_data->empty() || !_data->has_data(index))
788 return;
789
790 const uint16_t enabled_channels = _data->get_channel_num();
791 const double pixels_offset = offset;
792 const double samplerate = _data->samplerate();
793
794 assert(samplerate > 0);
795
796 const int64_t last_sample = max((int64_t)(_data->get_sample_count() - 1), (int64_t)0);
797 const double samples_per_pixel = samplerate * scale;
798 const double start = offset * samples_per_pixel - _view->trig_hoff();
799 const double end = start + samples_per_pixel * width;
800
801 const int64_t start_sample = min(max((int64_t)floor(start),
802 (int64_t)0), last_sample);
803 const int64_t end_sample = min(max((int64_t)ceil(end) + 1,
804 (int64_t)0), last_sample);
805 const int hw_offset = get_hw_offset();
806
807 if (samples_per_pixel < EnvelopeThreshold) {
808 _data->enable_envelope(false);
809 paint_trace(p, _data, zeroY, left,
810 start_sample, end_sample, hw_offset,
811 pixels_offset, samples_per_pixel, enabled_channels);
812 } else {
813 _data->enable_envelope(true);
814 paint_envelope(p, _data, zeroY, left,
815 start_sample, end_sample, hw_offset,
816 pixels_offset, samples_per_pixel, enabled_channels);
817 }
818
819 sr_status status;
820
821 if (session->dso_status_is_valid()) {
822 _mValid = true;
823 status = session->get_dso_status();

Callers

nothing calls this directly

Calls 14

scaleMethod · 0.80
offsetMethod · 0.80
emptyMethod · 0.80
get_channel_numMethod · 0.80
get_sample_countMethod · 0.80
trig_hoffMethod · 0.80
dso_status_is_validMethod · 0.80
get_dso_statusMethod · 0.80
get_channelsMethod · 0.80
get_deviceMethod · 0.80
has_dataMethod · 0.45
samplerateMethod · 0.45

Tested by

no test coverage detected