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

Method get_point

DSView/pv/view/analogsignal.cpp:188–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188QPointF AnalogSignal::get_point(uint64_t index, float &value)
189{
190 QPointF pt = QPointF(-1, -1);
191
192 if (!enabled())
193 return pt;
194
195 const int order = _data->get_ch_order(get_index());
196 if (order == -1)
197 return pt;
198
199 const double scale = _view->scale();
200 assert(scale > 0);
201 const int64_t pixels_offset = _view->offset();
202 const double samplerate = _view->session().cur_snap_samplerate();
203 const double samples_per_pixel = samplerate * scale;
204
205 if (index >= _data->get_sample_count())
206 return pt;
207
208 const uint64_t ring_index = (uint64_t)(_data->get_ring_start() + floor(index)) % _data->get_sample_count();
209 value = *(_data->get_samples(ring_index) + order * _data->get_unit_bytes());
210
211 const int height = get_totalHeight();
212 const float top = get_y() - height * 0.5;
213 const float bottom = get_y() + height * 0.5;
214 const int hw_offset = get_hw_offset();
215 const float x = (index / samples_per_pixel - pixels_offset);
216 const float y = min(max(top, get_zero_vpos() + (value - hw_offset)* _scale), bottom);
217 pt = QPointF(x, y);
218
219 return pt;
220}
221
222/**
223 * Probe options

Callers

nothing calls this directly

Calls 9

scaleMethod · 0.80
offsetMethod · 0.80
cur_snap_samplerateMethod · 0.80
sessionMethod · 0.80
get_sample_countMethod · 0.80
get_ring_startMethod · 0.80
get_unit_bytesMethod · 0.80
get_ch_orderMethod · 0.45
get_samplesMethod · 0.45

Tested by

no test coverage detected