mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-18 11:45:04 -04:00
Fix visual glitch with automation patterns (#3945)
Fix off-by-one visual glitch in automation editor and automation pattern view
This commit is contained in:
@@ -319,6 +319,16 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
|
||||
|
||||
float *values = m_pat->valuesAfter( it.key() );
|
||||
|
||||
float nextValue;
|
||||
if( m_pat->progressionType() == AutomationPattern::DiscreteProgression )
|
||||
{
|
||||
nextValue = it.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
nextValue = ( it + 1 ).value();
|
||||
}
|
||||
|
||||
QPainterPath path;
|
||||
QPointF origin = QPointF( x_base + it.key() * ppTick, 0.0f );
|
||||
path.moveTo( origin );
|
||||
@@ -332,7 +342,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
|
||||
path.lineTo( QPointF( x, value ) );
|
||||
|
||||
}
|
||||
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTick, values[ ( it + 1 ).key() - 1 - it.key() ] );
|
||||
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTick, nextValue );
|
||||
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTick, 0.0f );
|
||||
path.lineTo( origin );
|
||||
|
||||
|
||||
@@ -1378,13 +1378,13 @@ void AutomationEditor::paintEvent(QPaintEvent * pe )
|
||||
float *values = m_pattern->valuesAfter( it.key() );
|
||||
|
||||
float nextValue;
|
||||
if ( m_pattern->valuesAfter( ( it + 1 ).key() ) != NULL )
|
||||
if( m_pattern->progressionType() == AutomationPattern::DiscreteProgression )
|
||||
{
|
||||
nextValue = *( m_pattern->valuesAfter( ( it + 1 ).key() ) );
|
||||
nextValue = it.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
nextValue = values[ ( it + 1 ).key() - it.key() -1 ];
|
||||
nextValue = ( it + 1 ).value();
|
||||
}
|
||||
|
||||
p.setRenderHints( QPainter::Antialiasing, true );
|
||||
|
||||
Reference in New Issue
Block a user