mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
MidiKeyboardComponent: Avoid triggering assertions when painting
This commit is contained in:
parent
65b649225d
commit
fc6bfaf79e
1 changed files with 12 additions and 2 deletions
|
|
@ -360,10 +360,20 @@ void KeyboardComponentBase::paint (Graphics& g)
|
|||
for (int octaveBase = 0; octaveBase < 128; octaveBase += 12)
|
||||
{
|
||||
for (auto noteNum : whiteNotes)
|
||||
drawWhiteKey (octaveBase + noteNum, g, getRectangleForKey (octaveBase + noteNum));
|
||||
{
|
||||
const auto key = octaveBase + noteNum;
|
||||
|
||||
if (rangeStart <= key && key <= rangeEnd)
|
||||
drawWhiteKey (key, g, getRectangleForKey (key));
|
||||
}
|
||||
|
||||
for (auto noteNum : blackNotes)
|
||||
drawBlackKey (octaveBase + noteNum, g, getRectangleForKey (octaveBase + noteNum));
|
||||
{
|
||||
const auto key = octaveBase + noteNum;
|
||||
|
||||
if (rangeStart <= key && key <= rangeEnd)
|
||||
drawBlackKey (key, g, getRectangleForKey (key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue