diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index f9124aaa865..99e284f64b7 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -434,9 +434,11 @@ void AutomationEditor::leaveEvent(QEvent * e ) } -void AutomationEditor::drawLine( int x0, float y0, int x1, float y1 ) +void AutomationEditor::drawLine( int x0In, float y0, int x1In, float y1 ) { - int deltax = qRound( qAbs( x1 - x0 ) ); + int x0 = Note::quantized( x0In, AutomationPattern::quantization() ); + int x1 = Note::quantized( x1In, AutomationPattern::quantization() ); + int deltax = qAbs( x1 - x0 ); float deltay = qAbs( y1 - y0 ); int x = x0; float y = y0; @@ -452,7 +454,7 @@ void AutomationEditor::drawLine( int x0, float y0, int x1, float y1 ) float yscale = deltay / ( deltax ); - if( x0 < x1) + if( x0 < x1 ) { xstep = AutomationPattern::quantization(); } @@ -461,19 +463,22 @@ void AutomationEditor::drawLine( int x0, float y0, int x1, float y1 ) xstep = -( AutomationPattern::quantization() ); } + float lineAdjust; if( y0 < y1 ) { ystep = 1; + lineAdjust = yscale; } else { ystep = -1; + lineAdjust = -( yscale ); } int i = 0; while( i < deltax ) { - y = y0 + ( ystep * yscale * i ); + y = y0 + ( ystep * yscale * i ) + lineAdjust; x += xstep; i += 1;