Skip to content

Commit

Permalink
fix gradient paint performance issue affecting PianoRoll canvas drawi…
Browse files Browse the repository at this point in the history
…ng on Linux [fixes #527]
  • Loading branch information
kunstmusik committed Sep 28, 2020
1 parent 7b1bb17 commit d079798
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions ChangeLog
Expand Up @@ -75,8 +75,8 @@ UPDATED
* Restored using Rhino JS interpreter as Nashorn was removed from Java 15

* Issue #532: Made zoom in/out buttons use a timer to repeatedly zoom when
button is down and stop zooming when mouse is up (Score Timeline, PianoRoll)
button is down and stop zooming when mouse is up (Score Timeline, PianoRoll)


FIX

Expand All @@ -90,6 +90,9 @@ FIX

* Issue #523: Comments tab for instruments did not scroll correctly

* Issue #527: Fixed performance issue with drawing of PianoRoll canvas on Linux
due to GradientPaint


> Notes for 2.8.0 <
[release 2020.06.03]
Expand Down
Expand Up @@ -307,10 +307,10 @@ public void cut() {
public void copy() {
var buffer = NoteCopyBuffer.getInstance();
buffer.clear();

buffer.setSourcePianoRoll(p);
var copiedNotes = buffer.getCopiedNotes();

for (var note : selectedNotes) {
copiedNotes.add(new PianoNote(note));
}
Expand Down Expand Up @@ -390,14 +390,14 @@ public void paintComponent(Graphics g) {
h = octaves * octaveHeight;
}

Color lightColor = new Color(38, 51, 76).darker().darker();
Color darkColor = lightColor.darker();

for (int i = 0; i < octaves; i++) {
int lineY = h - (i * octaveHeight);

Color lightColor = new Color(38, 51, 76).darker().darker();
Color darkColor = lightColor.darker();

GradientPaint backgroundPaint = new GradientPaint(0, lineY,
darkColor, 1, lineY - octaveHeight, lightColor);
darkColor, 0, lineY - octaveHeight, lightColor);
g2d.setPaint(backgroundPaint);
g2d.fillRect(0, lineY - octaveHeight, w, octaveHeight);

Expand Down

0 comments on commit d079798

Please sign in to comment.