X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/4ede0106c6259161090d2d868d79218df942669e..03b8705191a7570ac7460b3393a4e8f1f49c908c:/MainController.m diff --git a/MainController.m b/MainController.m index 0f86024..eadc1b6 100755 --- a/MainController.m +++ b/MainController.m @@ -10,6 +10,30 @@ #import "StatusWindowController.h" #import "StatusItemHack.h" +@interface NSImage (WeeAdditions) +- (NSImage *)imageScaledSmoothlyToSize:(NSSize)scaledSize; +@end + +@implementation NSImage (WeeAdditions) + +- (NSImage *)imageScaledSmoothlyToSize:(NSSize)scaledSize +{ + NSImage *newImage; + NSImageRep *rep = [self bestRepresentationForDevice:nil]; + + newImage = [[NSImage alloc] initWithSize:scaledSize]; + [newImage lockFocus]; + { + [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; + [[NSGraphicsContext currentContext] setShouldAntialias:YES]; + [rep drawInRect:NSMakeRect(3, 3, scaledSize.width - 6, scaledSize.height - 6)]; + } + [newImage unlockFocus]; + return [newImage autorelease]; +} + +@end + @interface MainController(Private) - (ITMTRemote *)loadRemote; - (void)timerUpdate; @@ -790,6 +814,7 @@ static MainController *sharedController; if ( [df boolForKey:@"showAlbumArtwork"] ) { NS_DURING art = [[self currentRemote] currentSongAlbumArt]; + art = [[[[NSImage alloc] initWithData:[art TIFFRepresentation]] autorelease] imageScaledSmoothlyToSize:NSMakeSize(110,110)]; NS_HANDLER [self networkError:localException]; NS_ENDHANDLER @@ -798,7 +823,6 @@ static MainController *sharedController; } else { title = NSLocalizedString(@"noSongPlaying", @"No song is playing."); } - [statusWindowController showSongInfoWindowWithSource:source title:title album:album