diff --git a/plugins/Eq/EqCurve.cpp b/plugins/Eq/EqCurve.cpp index 10213bfa9..bb721a7e4 100644 --- a/plugins/Eq/EqCurve.cpp +++ b/plugins/Eq/EqCurve.cpp @@ -65,6 +65,7 @@ QRectF EqHandle::boundingRect() const float EqHandle::freqToXPixel( float freq , int w ) { + if (typeInfo::isEqual(freq, 0.0f)) { return 0.0f; } float min = log10f( 20 ); float max = log10f( 20000 ); float range = max - min; @@ -739,14 +740,18 @@ void EqCurve::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, } //compute a QPainterPath m_curve = QPainterPath(); - for ( int x = 0; x < m_width ; x++ ) + //only draw the EQ curve if there are any activeHandles + if (activeHandles != 0) { - mainCurve[x] = ( ( mainCurve[x] / activeHandles ) ) - ( m_heigth/2 ); - if ( x==0 ) + for (int x = 0; x < m_width; x++) { - m_curve.moveTo( x, mainCurve[x] ); + mainCurve[x] = ((mainCurve[x] / activeHandles)) - (m_heigth / 2); + if (x == 0) + { + m_curve.moveTo(x, mainCurve[x]); + } + m_curve.lineTo(x, mainCurve[x]); } - m_curve.lineTo( x, mainCurve[x] ); } //we cache the curve painting in a pixmap for saving cpu QPixmap cacheMap( boundingRect().size().toSize() );