Skip to content

Commit

Permalink
Enable antialiasing for sample visualizing (#3057)
Browse files Browse the repository at this point in the history
  • Loading branch information
Umcaruje authored and RebeccaDeField committed Sep 29, 2016
1 parent 1eded63 commit 919ca8b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>( 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;
Expand Down

0 comments on commit 919ca8b

Please sign in to comment.