diff --git a/src/gui/widgets/graph.cpp b/src/gui/widgets/graph.cpp index 966d94486..f336434fa 100644 --- a/src/gui/widgets/graph.cpp +++ b/src/gui/widgets/graph.cpp @@ -209,7 +209,7 @@ void graph::drawLineAt( int _x, int _y, int _lastx ) _lastx = qMax( 0, qMin( _lastx, width()-5 ) ); float range = minVal - maxVal; - float val = ( _y*range/( height()-4 ) ) + maxVal; + float val = ( _y*range/( height()-5 ) ) + maxVal; float lastval = model() -> m_samples[ (int)( _lastx * xscale ) ]; // calculate line drawing variables @@ -245,7 +245,7 @@ void graph::changeSampleAt( int _x, int _y ) // subtract max from min because Qt's Y-axis is backwards float range = minVal - maxVal; - float val = ( _y*range/( height()-4 ) ) + maxVal; + float val = ( _y*range/( height()-5 ) ) + maxVal; model()->setSampleAt( (int)( _x*xscale ), val ); } @@ -619,12 +619,12 @@ void graphModel::smoothNonCyclic() QVector temp = m_samples; // Smoothing - m_samples[0] = ( ( temp[0] * 2 ) + temp[1] ) / 3.0f; + m_samples[0] = ( ( temp[0] * 3 ) + temp[1] ) * 0.25f; for ( int i=1; i < ( length()-1 ); i++ ) { m_samples[i] = ( temp[i-1] + ( temp[i] * 2 ) + temp[i+1] ) * 0.25f; } - m_samples[length()-1] = ( temp[length()-2] + ( temp[length()-1] * 2 ) ) / 3.0f; + m_samples[length()-1] = ( temp[length()-2] + ( temp[length()-1] * 3 ) ) * 0.25f; emit samplesChanged(0, length()-1); }