Index: chrome/browser/cocoa/extensions/browser_action_button.mm |
diff --git a/chrome/browser/cocoa/extensions/browser_action_button.mm b/chrome/browser/cocoa/extensions/browser_action_button.mm |
index 946f87229b8b3ad4efe070ad2fd2da66029961d2..a5a2aceb5cfe4350892628c5bd4f9931a37d6af4 100644 |
--- a/chrome/browser/cocoa/extensions/browser_action_button.mm |
+++ b/chrome/browser/cocoa/extensions/browser_action_button.mm |
@@ -283,22 +283,9 @@ class ExtensionImageTrackerBridge : public NotificationObserver, |
- (NSImage*)compositedImage { |
NSRect bounds = NSMakeRect(0, 0, kBrowserActionWidth, kBrowserActionHeight); |
- NSBitmapImageRep* bitmap = [[NSBitmapImageRep alloc] |
- initWithBitmapDataPlanes:NULL |
- pixelsWide:NSWidth(bounds) |
- pixelsHigh:NSHeight(bounds) |
- bitsPerSample:8 |
- samplesPerPixel:4 |
- hasAlpha:YES |
- isPlanar:NO |
- colorSpaceName:NSCalibratedRGBColorSpace |
- bitmapFormat:0 |
- bytesPerRow:0 |
- bitsPerPixel:0]; |
+ NSImage* image = [[[NSImage alloc] initWithSize:bounds.size] autorelease]; |
+ [image lockFocus]; |
- [NSGraphicsContext saveGraphicsState]; |
- [NSGraphicsContext setCurrentContext: |
- [NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]]; |
[[NSColor clearColor] set]; |
NSRectFill(bounds); |
[[self cell] setIconShadow]; |
@@ -319,11 +306,8 @@ class ExtensionImageTrackerBridge : public NotificationObserver, |
bounds.origin.x -= kShadowOffset; |
[[self cell] drawBadgeWithinFrame:bounds]; |
- [NSGraphicsContext restoreGraphicsState]; |
- NSImage* compositeImage = |
- [[[NSImage alloc] initWithSize:[bitmap size]] autorelease]; |
- [compositeImage addRepresentation:bitmap]; |
- return compositeImage; |
+ [image unlockFocus]; |
+ return image; |
} |
@end |