| 198 | } |
| 199 | |
| 200 | void MathTrace::paint_mid(QPainter &p, int left, int right, QColor fore, QColor back) |
| 201 | { |
| 202 | (void)fore; |
| 203 | (void)back; |
| 204 | |
| 205 | if (!_show) |
| 206 | return; |
| 207 | |
| 208 | assert(_math_stack); |
| 209 | assert(_view); |
| 210 | assert(right >= left); |
| 211 | |
| 212 | if (enabled()) { |
| 213 | const float top = get_view_rect().top(); |
| 214 | const int height = get_view_rect().height(); |
| 215 | const int width = right - left; |
| 216 | const float zeroY = _zero_vrate * height + top; |
| 217 | |
| 218 | const double scale = _view->scale(); |
| 219 | assert(scale > 0); |
| 220 | const int64_t offset = _view->offset(); |
| 221 | |
| 222 | const double pixels_offset = offset; |
| 223 | //const double samplerate = _view->session().cur_snap_samplerate(); |
| 224 | const double samplerate = _math_stack->samplerate(); |
| 225 | const int64_t last_sample = max((int64_t)(_math_stack->get_sample_num() - 1), (int64_t)0); |
| 226 | const double samples_per_pixel = samplerate * scale; |
| 227 | const double start = offset * samples_per_pixel - _view->trig_hoff(); |
| 228 | const double end = start + samples_per_pixel * width; |
| 229 | |
| 230 | const int64_t start_sample = min(max((int64_t)floor(start), |
| 231 | (int64_t)0), last_sample); |
| 232 | const int64_t end_sample = min(max((int64_t)ceil(end) + 1, |
| 233 | (int64_t)0), last_sample); |
| 234 | |
| 235 | _scale = get_view_rect().height() * _math_stack->get_math_scale() * 1000.0 / get_vDialValue(); |
| 236 | |
| 237 | if (samples_per_pixel < DsoSignal::EnvelopeThreshold) { |
| 238 | _math_stack->enable_envelope(false); |
| 239 | paint_trace(p, zeroY, left, |
| 240 | start_sample, end_sample, |
| 241 | pixels_offset, samples_per_pixel); |
| 242 | } else { |
| 243 | _math_stack->enable_envelope(true); |
| 244 | paint_envelope(p, zeroY, left, |
| 245 | start_sample, end_sample, |
| 246 | pixels_offset, samples_per_pixel); |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | void MathTrace::paint_fore(QPainter &p, int left, int right, QColor fore, QColor back) |
| 252 | { |
nothing calls this directly
no test coverage detected