MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / get_display_edges

Method get_display_edges

DSView/pv/data/logicsnapshot.cpp:678–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678bool LogicSnapshot::get_display_edges(std::vector<std::pair<bool, bool> > &edges,
679 std::vector<std::pair<uint16_t, bool> > &togs,
680 uint64_t start, uint64_t end, uint16_t width, uint16_t max_togs,
681 double pixels_offset, double min_length, uint16_t sig_index)
682{
683 if (!edges.empty())
684 edges.clear();
685 if (!togs.empty())
686 togs.clear();
687
688 std::lock_guard<std::mutex> lock(_mutex);
689
690 if (_ring_sample_count == 0)
691 return false;
692
693 assert(end < _ring_sample_count);
694 assert(start <= end);
695 assert(min_length > 0);
696
697 uint64_t index = start;
698 bool last_sample;
699 bool start_sample;
700
701 // Get the initial state
702 start_sample = last_sample = get_sample_unlock(index++, sig_index);
703 togs.push_back(pair<uint16_t, bool>(0, last_sample));
704
705 while(edges.size() < width) {
706 // search next edge
707 bool has_edge = get_nxt_edge_unlock(index, last_sample, end, 0, sig_index);
708
709 // calc the edge position
710 int64_t gap = (index / min_length) - pixels_offset;
711 index = max((uint64_t)ceil((floor(index/min_length) + 1) * min_length), index + 1);
712
713 while(gap > (int64_t)edges.size() && edges.size() < width){
714 edges.push_back(pair<bool, bool>(false, last_sample));
715 }
716
717 if (index > end)
718 last_sample = get_sample_unlock(end, sig_index);
719 else
720 last_sample = get_sample_unlock(index - 1, sig_index);
721
722 if (has_edge) {
723 edges.push_back(pair<bool, bool>(true, last_sample));
724 if (togs.size() < max_togs)
725 togs.push_back(pair<uint16_t, bool>(edges.size() - 1, last_sample));
726 }
727
728 while(index > end && edges.size() < width)
729 edges.push_back(pair<bool, bool>(false, last_sample));
730 }
731
732 if (togs.size() < max_togs) {
733 last_sample = get_sample_unlock(end, sig_index);
734 togs.push_back(pair<uint16_t, bool>(edges.size() - 1, last_sample));
735 }

Callers 1

paint_mid_alignMethod · 0.80

Calls 3

emptyMethod · 0.80
sizeMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected