Fix EQ effect warnings (#6655)
* Fix warnings "QPainterPath::lineTo Invalid coordinates" on console when loading the effect or changing some paramenters, by not "drawing" the EQ curve when there is no EQ band active. * Fix warnings on console "QPainterPath::lineTo Invalid coordinates" when EQ is processing a sound, because in this function log10f generates a pole error when freq is 0, returning and invalid x value pixel * Update plugins/Eq/EqCurve.cpp --------- Co-authored-by: Dalton Messmer <33463986+messmerd@users.noreply.github.com>
This commit is contained in:
@@ -65,6 +65,7 @@ QRectF EqHandle::boundingRect() const
|
||||
|
||||
float EqHandle::freqToXPixel( float freq , int w )
|
||||
{
|
||||
if (typeInfo<float>::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() );
|
||||
|
||||
Reference in New Issue
Block a user