diff options
author | konablend <[email protected]> | 2012-09-21 18:45:29 +0000 |
---|---|---|
committer | konablend <[email protected]> | 2012-09-21 18:45:29 +0000 |
commit | 9b3ab50a16042a2be298d15549cf30cbbc28f1c5 (patch) | |
tree | 1195f2c9ed9104393a5dd2fe69fb37b244d75bc0 | |
parent | 07c7f911312f4a72872507185a3088685d171ca4 (diff) |
- fix issue:
abort() called
*** Terminating app due to uncaught exception 'NSInvalidArgumentException'
reason: '*** -blueComponent not defined for the NSColor NSCustomColorSpace Generic RGB colorspace 0.5 0.5 0.5 1; need to first convert colorspace.'
- remove superfluous color conversions; according to NSGradient docs, any needed colorspace conversions of params are automatic
- use [NSColor colorWithAlphaComponent] to force alpha
- change [NSColor colorWithSRGBRed] to [NSColor colorWithDeviceRed] for 10.6 API compatibilty
- [cosmetic] rename parm withEndColor -> endColor
- [leak] release NSGradient
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4972 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/Controller.m | 5 | ||||
-rw-r--r-- | macosx/DockTextField.h | 2 | ||||
-rw-r--r-- | macosx/DockTextField.m | 15 |
3 files changed, 9 insertions, 13 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index f2b383fb0..324d9ae4a 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -107,11 +107,11 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* We can move the specific values out from here by subclassing NSDockTile and package everything in here */ /* If colors are to be chosen once and for all, we can also remove the instantiation with numerical values */ percentField = [[DockTextField alloc] initWithFrame:NSMakeRect(0.0f, 32.0f, [dockTile size].width, 30.0f)]; - [percentField changeGradientColors:[NSColor colorWithSRGBRed:0.4f green:0.6f blue:0.4f alpha:1.0f] withEndColor:[NSColor colorWithSRGBRed:0.2f green:0.4f blue:0.2f alpha:1.0f]]; + [percentField changeGradientColors:[NSColor colorWithDeviceRed:0.4f green:0.6f blue:0.4f alpha:1.0f] endColor:[NSColor colorWithDeviceRed:0.2f green:0.4f blue:0.2f alpha:1.0f]]; [iv addSubview:percentField]; timeField = [[DockTextField alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, [dockTile size].width, 30.0f)]; - [timeField changeGradientColors:[NSColor colorWithSRGBRed:0.6f green:0.4f blue:0.4f alpha:1.0f] withEndColor:[NSColor colorWithSRGBRed:0.4f green:0.2f blue:0.2f alpha:1.0f]]; + [timeField changeGradientColors:[NSColor colorWithDeviceRed:0.6f green:0.4f blue:0.4f alpha:1.0f] endColor:[NSColor colorWithDeviceRed:0.4f green:0.2f blue:0.2f alpha:1.0f]]; [iv addSubview:timeField]; [self updateDockIcon:-1.0 withETA:@""]; @@ -119,7 +119,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It return self; } - - (void) applicationDidFinishLaunching: (NSNotification *) notification { /* Init libhb with check for updates libhb style set to "0" so its ignored and lets sparkle take care of it */ diff --git a/macosx/DockTextField.h b/macosx/DockTextField.h index a269211c7..593855b6b 100644 --- a/macosx/DockTextField.h +++ b/macosx/DockTextField.h @@ -12,6 +12,6 @@ @property (nonatomic,retain) NSColor *startColor; @property (nonatomic,retain) NSColor *endColor; -- (void)changeGradientColors:(NSColor*)startColor withEndColor:(NSColor*)endColor; +- (void)changeGradientColors:(NSColor*)startColor endColor:(NSColor*)endColor; @end diff --git a/macosx/DockTextField.m b/macosx/DockTextField.m index 0b71d632f..408b7da0b 100644 --- a/macosx/DockTextField.m +++ b/macosx/DockTextField.m @@ -21,20 +21,16 @@ if (self) { [[self cell] setBezelStyle: NSTextFieldRoundedBezel]; _textToDisplay = @""; - - [self changeGradientColors:[NSColor grayColor] withEndColor:[NSColor blackColor]]; + [self changeGradientColors:[NSColor grayColor] endColor:[NSColor blackColor]]; } return self; } -- (void)changeGradientColors:(NSColor*)startColor withEndColor:(NSColor*)endColor +- (void)changeGradientColors:(NSColor*)startColor endColor:(NSColor*)endColor { - NSColor *startRGBColor = [startColor colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]]; - NSColor *endRGBColor = [endColor colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]]; - - self.startColor = [NSColor colorWithSRGBRed:startRGBColor.redComponent green:startRGBColor.greenComponent blue:startRGBColor.blueComponent alpha:DOCK_TEXTFIELD_ALPHA]; - self.endColor = [NSColor colorWithSRGBRed:endRGBColor.redComponent green:endRGBColor.greenComponent blue:endRGBColor.blueComponent alpha:DOCK_TEXTFIELD_ALPHA]; + self.startColor = [startColor colorWithAlphaComponent:DOCK_TEXTFIELD_ALPHA]; + self.endColor = [endColor colorWithAlphaComponent:DOCK_TEXTFIELD_ALPHA]; } - (void)drawRect:(NSRect)dirtyRect @@ -44,9 +40,10 @@ NSRect blackOutlineFrame = NSMakeRect(0.0, 0.0, [self bounds].size.width, [self bounds].size.height-1.0); double radius = self.bounds.size.height / 2; - + NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:self.startColor endingColor:self.endColor]; [gradient drawInBezierPath:[NSBezierPath bezierPathWithRoundedRect:blackOutlineFrame xRadius:radius yRadius:radius] angle:90]; + [gradient release]; NSMutableDictionary *drawStringAttributes = [[NSMutableDictionary alloc] init]; [drawStringAttributes setValue:[NSColor whiteColor] forKey:NSForegroundColorAttributeName]; |