| 947 | |
| 948 | |
| 949 | void SampleBuffer::visualize( QPainter & _p, const QRect & _dr, |
| 950 | const QRect & _clip, f_cnt_t _from_frame, f_cnt_t _to_frame ) |
| 951 | { |
| 952 | if( m_frames == 0 ) return; |
| 953 | |
| 954 | const bool focus_on_range = _to_frame <= m_frames |
| 955 | && 0 <= _from_frame && _from_frame < _to_frame; |
| 956 | //_p.setClipRect( _clip ); |
| 957 | const int w = _dr.width(); |
| 958 | const int h = _dr.height(); |
| 959 | |
| 960 | const int yb = h / 2 + _dr.y(); |
| 961 | const float y_space = h*0.5f; |
| 962 | const int nb_frames = focus_on_range ? _to_frame - _from_frame : m_frames; |
| 963 | |
| 964 | const int fpp = tLimit<int>( nb_frames / w, 1, 20 ); |
| 965 | QPointF * l = new QPointF[nb_frames / fpp + 1]; |
| 966 | QPointF * r = new QPointF[nb_frames / fpp + 1]; |
| 967 | int n = 0; |
| 968 | const int xb = _dr.x(); |
| 969 | const int first = focus_on_range ? _from_frame : 0; |
| 970 | const int last = focus_on_range ? _to_frame : m_frames; |
| 971 | for( int frame = first; frame < last; frame += fpp ) |
| 972 | { |
| 973 | l[n] = QPointF( xb + ( (frame - first) * double( w ) / nb_frames ), |
| 974 | ( yb - ( m_data[frame][0] * y_space * m_amplification ) ) ); |
| 975 | r[n] = QPointF( xb + ( (frame - first) * double( w ) / nb_frames ), |
| 976 | ( yb - ( m_data[frame][1] * y_space * m_amplification ) ) ); |
| 977 | ++n; |
| 978 | } |
| 979 | _p.setRenderHint( QPainter::Antialiasing ); |
| 980 | _p.drawPolyline( l, nb_frames / fpp ); |
| 981 | _p.drawPolyline( r, nb_frames / fpp ); |
| 982 | delete[] l; |
| 983 | delete[] r; |
| 984 | } |
| 985 | |
| 986 | |
| 987 |
no outgoing calls
no test coverage detected