OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
10 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 10 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 // Draws the tab background. | 318 // Draws the tab background. |
319 - (void)drawFill:(NSRect)dirtyRect { | 319 - (void)drawFill:(NSRect)dirtyRect { |
320 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 320 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
321 NSGraphicsContext* context = [NSGraphicsContext currentContext]; | 321 NSGraphicsContext* context = [NSGraphicsContext currentContext]; |
322 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]); | 322 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]); |
323 | 323 |
324 ThemeService* themeProvider = | 324 ThemeService* themeProvider = |
325 static_cast<ThemeService*>([[self window] themeProvider]); | 325 static_cast<ThemeService*>([[self window] themeProvider]); |
326 NSPoint phase = [[self window] | 326 NSPoint position = [[self window] |
327 themePatternPhaseForAlignment: THEME_PATTERN_ALIGN_WITH_TAB_STRIP]; | 327 themeImagePositionForAlignment: THEME_IMAGE_ALIGN_WITH_TAB_STRIP]; |
328 [context cr_setPatternPhase:phase forView:self]; | 328 [context cr_setPatternPhase:position forView:self]; |
329 | 329 |
330 CGImageRef mask([self tabClippingMask]); | 330 CGImageRef mask([self tabClippingMask]); |
331 CGRect maskBounds = CGRectMake(0, 0, maskCacheWidth_, kMaskHeight); | 331 CGRect maskBounds = CGRectMake(0, 0, maskCacheWidth_, kMaskHeight); |
332 CGContextClipToMask(cgContext, maskBounds, mask); | 332 CGContextClipToMask(cgContext, maskBounds, mask); |
333 | 333 |
334 bool selected = [self state]; | 334 bool selected = [self state]; |
335 if (selected) { | 335 if (selected) { |
336 [self drawFillForActiveTab:dirtyRect]; | 336 [self drawFillForActiveTab:dirtyRect]; |
337 return; | 337 return; |
338 } | 338 } |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 CGFloat middleWidth = tabWidth - leftWidth - rightWidth; | 705 CGFloat middleWidth = tabWidth - leftWidth - rightWidth; |
706 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight); | 706 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight); |
707 [[NSColor whiteColor] setFill]; | 707 [[NSColor whiteColor] setFill]; |
708 NSRectFill(middleRect); | 708 NSRectFill(middleRect); |
709 | 709 |
710 maskCache_.reset(CGBitmapContextCreateImage(maskContext)); | 710 maskCache_.reset(CGBitmapContextCreateImage(maskContext)); |
711 return maskCache_; | 711 return maskCache_; |
712 } | 712 } |
713 | 713 |
714 @end // @implementation TabView(Private) | 714 @end // @implementation TabView(Private) |
OLD | NEW |