From 919ca8b4d71a79cfb899b0a81c8bcc49cc8d08b3 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Fri, 30 Sep 2016 00:18:03 +0200 Subject: [PATCH] Enable antialiasing for sample visualizing (#3057) --- src/core/SampleBuffer.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index c0fc2d4d1..38236e435 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -911,27 +911,22 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr, const float y_space = h*0.5f; const int nb_frames = focus_on_range ? _to_frame - _from_frame : m_frames; - if( nb_frames < 60000 ) - { - _p.setRenderHint( QPainter::Antialiasing ); - QColor c = _p.pen().color(); - _p.setPen( QPen( c, 0.7 ) ); - } const int fpp = tLimit( nb_frames / w, 1, 20 ); - QPoint * l = new QPoint[nb_frames / fpp + 1]; - QPoint * r = new QPoint[nb_frames / fpp + 1]; + QPointF * l = new QPointF[nb_frames / fpp + 1]; + QPointF * r = new QPointF[nb_frames / fpp + 1]; int n = 0; const int xb = _dr.x(); const int first = focus_on_range ? _from_frame : 0; const int last = focus_on_range ? _to_frame : m_frames; for( int frame = first; frame < last; frame += fpp ) { - l[n] = QPoint( xb + ( (frame - first) * double( w ) / nb_frames ), - (int)( yb - ( m_data[frame][0] * y_space * m_amplification ) ) ); - r[n] = QPoint( xb + ( (frame - first) * double( w ) / nb_frames ), - (int)( yb - ( m_data[frame][1] * y_space * m_amplification ) ) ); + l[n] = QPointF( xb + ( (frame - first) * double( w ) / nb_frames ), + ( yb - ( m_data[frame][0] * y_space * m_amplification ) ) ); + r[n] = QPointF( xb + ( (frame - first) * double( w ) / nb_frames ), + ( yb - ( m_data[frame][1] * y_space * m_amplification ) ) ); ++n; } + _p.setRenderHint( QPainter::Antialiasing ); _p.drawPolyline( l, nb_frames / fpp ); _p.drawPolyline( r, nb_frames / fpp ); delete[] l;