Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1175)

Unified Diff: chrome/browser/cocoa/gradient_button_cell.mm

Issue 173445: Cache GTMTheme across windows to avoid re-creating it every time we create a ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/gradient_button_cell.mm
===================================================================
--- chrome/browser/cocoa/gradient_button_cell.mm (revision 24242)
+++ chrome/browser/cocoa/gradient_button_cell.mm (working copy)
@@ -7,6 +7,7 @@
#import "base/scoped_nsobject.h"
@interface GradientButtonCell (Private)
+- (void)sharedInit;
- (void)drawUnderlayImageWithFrame:(NSRect)cellFrame
inView:(NSView*)controlView;
@end
@@ -17,7 +18,7 @@
// For nib instantiations
- (id)initWithCoder:(NSCoder*)decoder {
if ((self = [super initWithCoder:decoder])) {
- shouldTheme_ = YES;
+ [self sharedInit];
}
return self;
}
@@ -25,11 +26,19 @@
// For programmatic instantiations
- (id)initTextCell:(NSString*)string {
if ((self = [super initTextCell:string])) {
- shouldTheme_ = YES;
+ [self sharedInit];
}
return self;
}
+- (void)sharedInit {
+ shouldTheme_ = YES;
Mark Mentovai 2009/08/26 01:25:49 Indent is weird.
pink (ping after 24hrs) 2009/08/26 14:55:56 Done.
+ NSColor* startColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.666];
+ NSColor* endColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.333];
+ gradient_.reset([[NSGradient alloc]
+ initWithColorsAndLocations:startColor, 0.33, endColor, 1.0, nil]);
+}
+
- (void)setShouldTheme:(BOOL)shouldTheme {
shouldTheme_ = shouldTheme;
}
@@ -140,13 +149,8 @@
[highlightPath stroke];
- NSColor* startColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.666];
- NSColor* endColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.333];
- scoped_nsobject<NSBezierPath> gradient([[NSGradient alloc]
- initWithColorsAndLocations:startColor, 0.33, endColor, 1.0, nil]);
+ [gradient_ drawInBezierPath:innerPath angle:90.0];
- [gradient drawInBezierPath:innerPath angle:90.0];
-
[NSGraphicsContext restoreGraphicsState];
}

Powered by Google App Engine
This is Rietveld 408576698