diff options
| author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-21 14:19:55 +0000 |
|---|---|---|
| committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-21 14:19:55 +0000 |
| commit | 6044cdfe614c15dce3064ef81d65b8a40f7d1437 (patch) | |
| tree | 21c427a75d8a820ef0ca4eb614d84d24b97a86f0 /chrome/browser/cocoa/gradient_button_cell.mm | |
| parent | 9d89101b3ee934e3a9d5e8823c734f60a4740294 (diff) | |
| download | chromium_src-6044cdfe614c15dce3064ef81d65b8a40f7d1437.zip chromium_src-6044cdfe614c15dce3064ef81d65b8a40f7d1437.tar.gz chromium_src-6044cdfe614c15dce3064ef81d65b8a40f7d1437.tar.bz2 | |
Unblackify the upgrade ball.
BUG=http://crbug.com/49370
TEST=as in bug
Review URL: http://codereview.chromium.org/3047005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/gradient_button_cell.mm')
| -rw-r--r-- | chrome/browser/cocoa/gradient_button_cell.mm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/gradient_button_cell.mm b/chrome/browser/cocoa/gradient_button_cell.mm index 4c3eaea..5fb8c29 100644 --- a/chrome/browser/cocoa/gradient_button_cell.mm +++ b/chrome/browser/cocoa/gradient_button_cell.mm @@ -128,6 +128,15 @@ static const NSTimeInterval kAnimationHideDuration = 0.4; shouldTheme_ = shouldTheme; } +- (NSImage*)overlayImage { + return overlayImage_.get(); +} + +- (void)setOverlayImage:(NSImage*)image { + overlayImage_.reset([image retain]); + [[self controlView] setNeedsDisplay:YES]; +} + - (NSBackgroundStyle)interiorBackgroundStyle { // Never lower the interior, since that just leads to a weird shadow which can // often interact badly with the theme. @@ -427,8 +436,8 @@ static const NSTimeInterval kAnimationHideDuration = 0.4; NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop); } } - CGContextEndTransparencyLayer(context); + [NSGraphicsContext restoreGraphicsState]; } else { // NSCell draws these uncentered for some reason, probably because of the @@ -436,6 +445,16 @@ static const NSTimeInterval kAnimationHideDuration = 0.4; [super drawInteriorWithFrame:NSOffsetRect(cellFrame, 0, 1) inView:controlView]; } + + if (overlayImage_) { + NSRect imageRect = NSZeroRect; + imageRect.size = [overlayImage_ size]; + [overlayImage_ drawInRect:[self imageRectForBounds:cellFrame] + fromRect:imageRect + operation:NSCompositeSourceOver + fraction:[self isEnabled] ? 1.0 : 0.5 + neverFlipped:YES]; + } } - (NSBezierPath*)clipPathForFrame:(NSRect)cellFrame |
