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:
Hyunjin Song
2017-11-09 06:58:51 +09:00
committed by GitHub
parent 8baf42fca0
commit 48b9b6508e
2 changed files with 14 additions and 4 deletions

View File

@@ -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 );

View File

@@ -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 );