Skip to content

Commit

Permalink
Merge pull request #11 from bradhowes/fix-gradient
Browse files Browse the repository at this point in the history
Use NSGradient over old CTGradient that crashes
  • Loading branch information
flit authored Nov 22, 2020
2 parents 0c41e45 + 679f5b6 commit 03551a5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Source/MidiKeyView.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#import "MidiKeyView.h"
#import "AppController.h"
#import "CTGradient.h"
#import "Preferences.h"

//! Maximum number of keys to show.
Expand Down Expand Up @@ -420,10 +419,9 @@ - (void)drawKeyForNote:(int)note

[insetPath setClip];

CTGradient * gradient = [CTGradient
gradientWithBeginningColor:keyFillTopColor
endingColor:keyFillBottomColor];
[gradient fillRect:[insetPath bounds] angle:330.0];
NSGradient *gradient = [[NSGradient alloc] initWithStartingColor: keyFillTopColor endingColor:keyFillBottomColor];
[gradient drawInRect: [insetPath bounds] angle: 330.0];
[gradient release];

[NSGraphicsContext restoreGraphicsState];

Expand Down Expand Up @@ -497,8 +495,9 @@ - (void)highlightMidiKey:(int)note

[keyPath setClip];

CTGradient * gradient = [CTGradient gradientWithBeginningColor:darkerHighlightColor endingColor:lighterHighlightColor];
[gradient fillRect:[keyPath bounds] angle:330.0];
NSGradient *gradient = [[NSGradient alloc] initWithStartingColor: darkerHighlightColor endingColor:lighterHighlightColor];
[gradient drawInRect: [keyPath bounds] angle: 330.0];
[gradient release];

[NSGraphicsContext restoreGraphicsState];

Expand Down

0 comments on commit 03551a5

Please sign in to comment.