| 393 | } |
| 394 | |
| 395 | void AnalogSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor back) |
| 396 | { |
| 397 | (void)fore; |
| 398 | (void)back; |
| 399 | |
| 400 | assert(_data); |
| 401 | assert(_view); |
| 402 | assert(right >= left); |
| 403 | |
| 404 | const int height = get_totalHeight(); |
| 405 | const float top = get_y() - height * 0.5; |
| 406 | const float bottom = get_y() + height * 0.5; |
| 407 | const float zeroY = ratio2pos(get_zero_ratio()); |
| 408 | const int width = right - left + 1; |
| 409 | |
| 410 | const double scale = _view->scale(); |
| 411 | |
| 412 | assert(scale > 0); |
| 413 | const int64_t offset = _view->offset(); |
| 414 | |
| 415 | const int order = _data->get_ch_order(get_index()); |
| 416 | if (order == -1) |
| 417 | return; |
| 418 | |
| 419 | //The channel have no data. |
| 420 | if (_data->has_enabled_channel(get_index()) == false){ |
| 421 | return; |
| 422 | } |
| 423 | |
| 424 | const double pixels_offset = offset; |
| 425 | const double samplerate = _data->samplerate(); |
| 426 | const int64_t cur_sample_count = _data->get_sample_count(); |
| 427 | const double samples_per_pixel = samplerate * scale; |
| 428 | const uint64_t ring_start = _data->get_ring_start(); |
| 429 | |
| 430 | int64_t start_pixel; |
| 431 | uint64_t start_index; |
| 432 | const double index_offset = pixels_offset * samples_per_pixel; |
| 433 | start_index = (uint64_t)(ring_start + floor(index_offset)) % cur_sample_count; |
| 434 | start_pixel = (floor(index_offset) - index_offset) / samples_per_pixel ; |
| 435 | |
| 436 | int64_t show_length = min(floor(cur_sample_count - floor(index_offset)), ceil(width*samples_per_pixel + 1)); |
| 437 | if (show_length <= 0) |
| 438 | return; |
| 439 | |
| 440 | if (samples_per_pixel < EnvelopeThreshold){ |
| 441 | paint_trace(p, _data, zeroY, |
| 442 | start_pixel, start_index, show_length, |
| 443 | samples_per_pixel, order, |
| 444 | top, bottom, width); |
| 445 | } |
| 446 | else{ |
| 447 | paint_envelope(p, _data, zeroY, |
| 448 | start_pixel, start_index, show_length, |
| 449 | samples_per_pixel, order, |
| 450 | top, bottom, width); |
| 451 | } |
| 452 | } |
nothing calls this directly
no test coverage detected