| 646 | } |
| 647 | |
| 648 | void DsoSignal::paint_prepare() |
| 649 | { |
| 650 | assert(_view); |
| 651 | |
| 652 | if (_data->empty() || !_data->has_data(get_index())) |
| 653 | return; |
| 654 | |
| 655 | if (session->trigd()) { |
| 656 | if (get_index() == session->trigd_ch()) { |
| 657 | uint8_t slope = DSO_TRIGGER_RISING; |
| 658 | int v; |
| 659 | bool ret; |
| 660 | |
| 661 | ret = session->get_device()->get_config_byte(SR_CONF_TRIGGER_SLOPE, v); |
| 662 | if (ret) { |
| 663 | slope = (uint8_t)v; |
| 664 | } |
| 665 | |
| 666 | int64_t trig_index = _view->get_trig_cursor()->index(); |
| 667 | if (trig_index >= (int64_t)_data->get_sample_count()) |
| 668 | return; |
| 669 | |
| 670 | const uint8_t *const trig_samples = _data->get_samples(0, 0, get_index()); |
| 671 | for (uint16_t i = 0; i < TrigHRng; i++) { |
| 672 | const int64_t i0 = trig_index - i - 1; |
| 673 | const int64_t i1 = trig_index - i; |
| 674 | if (i1 < 0) |
| 675 | break; |
| 676 | const uint8_t t0 = trig_samples[i0]; |
| 677 | const uint8_t t1 = trig_samples[i1]; |
| 678 | if((slope == DSO_TRIGGER_RISING && t0 >= _trig_value && t1 <= _trig_value) || |
| 679 | (slope == DSO_TRIGGER_FALLING && t0 <= _trig_value && t1 >= _trig_value)) { |
| 680 | const double xoff = (t1 == t0) ? 0 : (_trig_value - t0) * 1.0 / (t1 - t0); |
| 681 | _view->set_trig_hoff(i + 1 - xoff); |
| 682 | break; |
| 683 | } |
| 684 | } |
| 685 | } |
| 686 | } else { |
| 687 | _view->set_trig_hoff(0); |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | void DsoSignal::paint_back(QPainter &p, int left, int right, QColor fore, QColor back) |
| 692 | { |
nothing calls this directly
no test coverage detected