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

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

Issue 260009: Several background pattern fixes on the Mac.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 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/background_gradient_view.mm
===================================================================
--- chrome/browser/cocoa/background_gradient_view.mm (revision 28537)
+++ chrome/browser/cocoa/background_gradient_view.mm (working copy)
@@ -27,44 +27,31 @@
[self setNeedsDisplay:YES];
}
-// The offset of this pattern to make it line up with the top of the window.
-- (NSPoint)patternPhase {
- NSPoint phase = NSZeroPoint;
- phase.y += NSHeight([[self window] frame]) - kToolbarTopOffset;
- return phase;
-}
-
-- (void)drawRect:(NSRect)rect {
+- (void)drawBackground {
BOOL isKey = [[self window] isKeyWindow];
-
- GTMTheme *theme = [self gtm_theme];
-
- NSImage *backgroundImage = [theme backgroundImageForStyle:GTMThemeStyleToolBar
- state:GTMThemeStateActiveWindow];
+ GTMTheme* theme = [self gtm_theme];
+ NSImage* backgroundImage =
+ [theme backgroundImageForStyle:GTMThemeStyleToolBar
+ state:GTMThemeStateActiveWindow];
if (backgroundImage) {
- NSPoint phase = [self patternPhase];
- [[NSGraphicsContext currentContext] setPatternPhase:phase];
-
- NSColor *color = [NSColor colorWithPatternImage:backgroundImage];
+ NSColor* color = [NSColor colorWithPatternImage:backgroundImage];
[color set];
NSRectFill([self bounds]);
} else {
CGFloat winHeight = NSHeight([[self window] frame]);
- NSGradient *gradient = [theme gradientForStyle:GTMThemeStyleToolBar
+ NSGradient* gradient = [theme gradientForStyle:GTMThemeStyleToolBar
state:isKey];
NSPoint startPoint =
[self convertPoint:NSMakePoint(0, winHeight - kToolbarTopOffset)
fromView:nil];
NSPoint endPoint =
- [self convertPoint:NSMakePoint(0, winHeight -
- kToolbarTopOffset -
- kToolbarMaxHeight)
- fromView:nil];
+ NSMakePoint(0, winHeight - kToolbarTopOffset - kToolbarMaxHeight);
+ endPoint = [self convertPoint:endPoint fromView:nil];
[gradient drawFromPoint:startPoint
toPoint:endPoint
- options:NSGradientDrawsBeforeStartingLocation |
- NSGradientDrawsAfterEndingLocation];
+ options:(NSGradientDrawsBeforeStartingLocation |
+ NSGradientDrawsAfterEndingLocation)];
}
if (showsDivider_) {
« no previous file with comments | « chrome/browser/cocoa/background_gradient_view.h ('k') | chrome/browser/cocoa/background_gradient_view_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698