-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aliasing in AutomationPatternView and AutomationEditor fixed #3386
Conversation
No need to apologize. There's no easy way to switch off of a master branch, this was the right thing to do. The only portion that may be worth carrying over is any remaining discussion items such as this:
|
Ok awesome! Seems to work now without and shading inconsistencies or leaving out somethings... Now all that needs to be done is the same for the editor itself. @Umcaruje Thanks for pointing out the QPointF thing. It was driving me crazy. |
src/gui/AutomationPatternView.cpp
Outdated
p.fillRect( QRectF( x1, 0.0f, x2 - x1, value ), col ); | ||
} | ||
} | ||
path.lineTo(x_base + ((it + 1).key()) * ppt / MidiTime::ticksPerTact(),values[(it + 1).key() - 1 - it.key()]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ppt / MidiTime::ticksPerTact()
appears a lot of time in the code, you could make it a seperate variable so we don't calculate this all the time.
Done! |
src/gui/AutomationPatternView.cpp
Outdated
@@ -278,6 +278,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) | |||
|
|||
const float y_scale = max - min; | |||
const float h = ( height() - 2 * TCO_BORDER_WIDTH ) / y_scale; | |||
const int MidiTpT = MidiTime::ticksPerTact(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what was suggested was to do away with a computation by doing it once, such as:
const int MidiTpT = ppt / MidiTime::ticksPerTact();
Done... I was quite silly there |
Cool, could you also adjust the spaces in parenthesis to be consistent with the rest of the file? I know this is not required anymore, but it really stands out. Also would you do the same rendering process for the automation editor in this PR? So we could kill two birds with one stone. |
src/gui/AutomationPatternView.cpp
Outdated
@@ -278,6 +278,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) | |||
|
|||
const float y_scale = max - min; | |||
const float h = ( height() - 2 * TCO_BORDER_WIDTH ) / y_scale; | |||
const float ppTact = ppt / MidiTime::ticksPerTact(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should actually be named ppTick
, cause ppt
already means pixels per tact, and you're dividing it with the number of ticks in a tact 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a tact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the german/european word for a Bar in music: https://en.wikipedia.org/wiki/Bar_(music)
src/gui/AutomationPatternView.cpp
Outdated
if( x1 > ( width() - TCO_BORDER_WIDTH ) ) break; | ||
float value = values[ i - it.key() ]; | ||
path.lineTo( QPointF( x1,value ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a space after the comma: x1, value
src/gui/AutomationPatternView.cpp
Outdated
MidiTime::ticksPerTact(); | ||
const float x2 = x_base + (i + 1) * ppt / | ||
MidiTime::ticksPerTact(); | ||
const float x1 = x_base + i * ppTact; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as there is no x2
now, this variable could be called just x
to avoid confusion.
src/gui/AutomationPatternView.cpp
Outdated
p.fillRect( QRectF( x1, 0.0f, x2 - x1, value ), col ); | ||
} | ||
} | ||
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTact,values[ ( it + 1 ).key() - 1 - it.key() ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, space after comma
src/gui/AutomationPatternView.cpp
Outdated
} | ||
} | ||
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTact,values[ ( it + 1 ).key() - 1 - it.key() ] ); | ||
path.lineTo( x_base + ( ( it + 1 ).key() ) * ppTact,0.0f ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previous comment
src/gui/AutomationPatternView.cpp
Outdated
for( int i = it.key(); i < (it + 1).key(); i++ ) | ||
|
||
QPainterPath path; | ||
QPointF origin = QPointF(x_base + it.key() * ppTick,0.0f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing spaces in parenthesis (sorry I somehow missed this one)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*( sorry I somehow missed this one )
1538466
to
af9ed17
Compare
@TheTravelingSpaceman @Umcaruje that shading won't ever (EVER) line up unless we either set a fixed gradient (yuck). Can we just abolish it? I see this is being done against the old theme, has the new theme gotten rid of the gradient or is it still there? |
👍 |
Actually it still does use one, but I agree this can be removed really. @RebeccaDeField thoughts? |
src/gui/editors/AutomationEditor.cpp
Outdated
drawLevelTick( p, it.key() + i, values[i], | ||
is_selected ); | ||
float nextValue; | ||
if ( m_pattern->valuesAfter( ( it + 1 ).key() ) != NULL ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have brackets for the if/else statement, and there should be no space between if
and the parenthesis: if(...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it looked neater without the brackets but I'll add them to make it consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're still missing {}
brackets here
path.lineTo( QPointF( xCoordOfTick( ( it + 1 ).key() ), yCoordOfLevel( nextValue ) ) ); | ||
path.lineTo( QPointF( xCoordOfTick( ( it + 1 ).key() ), yCoordOfLevel( 0 ) ) ); | ||
path.lineTo( QPointF( xCoordOfTick( it.key() ), yCoordOfLevel( 0 ) ) ); | ||
p.fillPath( path, graphColor() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The is_selected
variable was used when a particular automation point was selected, but this is disabled and broken atm, it would requre some CSS changes to be properly implemented, and we can save that for when that feature gets fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So can I delete the code referencing the is_selected variable and related code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good when it's commented out as now.
The gradient is just for a touch of depth and it can definitely be flattened. I do think it's important to keep some transparency so that the grid can show through for usability. I'm thinking we could give the whole automation graph the same transparency as the top stop. |
What's the top stop? And is it a problem that the Travis-CI failed it's tests? |
I believe @RebeccaDeField is recommending to use the top-most automation point as the gradient end point for the entire section so that they draw without segmentation. |
@TheTravelingSpaceman It is currently using a gradient with two stops (top and bottom). If we wanted to take away the gradient, we would only have one shade of transparency. I'm suggesting that we use the transparency of Sorry if that was confusing 😅 |
@RebeccaDeField So do we change that in the CSS or the c++ code? I can't seem to find the right place to limit it in the c++ code :/ |
@TheTravelingSpaceman I think it would be wiser to actually comment out the code rather than remove it, cause we want that feature back sometime. |
0031766
to
10de750
Compare
So? What's the next step? |
@TheTravelingSpaceman Sorry for the late reply, this somehow got buried in my inbox. You will need to remove the gradient in the style.css file if that is what you're asking. 😊 |
@Umcaruje Should be fine to merge now |
a57b823
to
7d0355e
Compare
@Umcaruje I've looked at the two problems you've indicated and can't find a proper way to fix it (That I understand and am confident that it won't break something elsewhere). I did "fix" the bottom pixel error in the final commit but if feels a bit hackish. Maybe the person who wrote the code originally should take a look (@jmuzz) The problems however has nothing to do with the things I've added and can therefore be fixed separately in another PR. I would like to fix it but unfortunately I'm starting school tomorrow. |
But this gap is there already in 1.0.3
Works, but maybe not if fixing the top margin error too.
https://github.com/LMMS/lmms/blob/master/include/AutomationEditor.h#L176 |
Huh, I never noticed that. Guess I never looked hard enough. Anyways @TheTravelingSpaceman the last commit doesn't fix it completely. I suggest you revert it, we merge this and open a seperate issue for the top margin and the pixel gap. |
This reverts commit ff80186.
Reverted as requested. Should be fine to merge now @Umcaruje |
@zonkmachine I thought that was what I was doing. Was under the impression that the command reverts to the state that the commit was at that point. So just making sure now... I need to execute the following code to have it right: The first line reverts the incorrect "revert" that I did. And the second is what I should have done initially |
Yes, this works. For the future. I usually do |
|
👍 |
Nice work @TheTravelingSpaceman! 😁 |
* Ailiasing in AutomationPatternView; ERROR: Doesn't draw unreferanced tracks * Draws one polygon instead of 'poly'-polygons * Changed QPoints to QPointF * Added int MidiTpT constant * Added ppTact for reduced computation * Added spaces in parentheses to be consistent * Variable name change and spacing * S P A C E S * Anti-Aliasing of Automation Editor * Commented out all referances to unused is_selected * Changed css to non-gradient graphs * Added Brackets * Removed no-pixel line at bottom of graph * Revert "Added Brackets" This reverts commit ff80186. * Revert "Revert "Added Brackets"" This reverts commit 4e127a7. * Revert "Removed no-pixel line at bottom of graph" This reverts commit 940c766.
Exactly the same as this pull request: #3385 but now from a different branch on my side. (Sorry still learning) It's referencing issue #2688