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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_view.mm

Issue 19918002: Refactor [FramedBrowserWindow drawWindowThemeInDirtyRect:] to use themeImagePositionForAlignment: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 318
319 // Draws the tab background. 319 // Draws the tab background.
320 - (void)drawFill:(NSRect)dirtyRect { 320 - (void)drawFill:(NSRect)dirtyRect {
321 gfx::ScopedNSGraphicsContextSaveGState scopedGState; 321 gfx::ScopedNSGraphicsContextSaveGState scopedGState;
322 NSGraphicsContext* context = [NSGraphicsContext currentContext]; 322 NSGraphicsContext* context = [NSGraphicsContext currentContext];
323 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]); 323 CGContextRef cgContext = static_cast<CGContextRef>([context graphicsPort]);
324 324
325 ThemeService* themeProvider = 325 ThemeService* themeProvider =
326 static_cast<ThemeService*>([[self window] themeProvider]); 326 static_cast<ThemeService*>([[self window] themeProvider]);
327 NSPoint phase = [[self window] 327 NSPoint position = [[self window]
328 themePatternPhaseForAlignment: THEME_PATTERN_ALIGN_WITH_TAB_STRIP]; 328 themeImagePositionForAlignment: THEME_IMAGE_ALIGN_WITH_TAB_STRIP];
329 [context cr_setPatternPhase:phase forView:self]; 329 [context cr_setPatternPhase:position forView:self];
330 330
331 CGImageRef mask([self tabClippingMask]); 331 CGImageRef mask([self tabClippingMask]);
332 CGRect maskBounds = CGRectMake(0, 0, maskCacheWidth_, kMaskHeight); 332 CGRect maskBounds = CGRectMake(0, 0, maskCacheWidth_, kMaskHeight);
333 CGContextClipToMask(cgContext, maskBounds, mask); 333 CGContextClipToMask(cgContext, maskBounds, mask);
334 334
335 bool selected = [self state]; 335 bool selected = [self state];
336 if (selected) { 336 if (selected) {
337 [self drawFillForActiveTab:dirtyRect]; 337 [self drawFillForActiveTab:dirtyRect];
338 return; 338 return;
339 } 339 }
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 CGFloat middleWidth = tabWidth - leftWidth - rightWidth; 706 CGFloat middleWidth = tabWidth - leftWidth - rightWidth;
707 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight); 707 NSRect middleRect = NSMakeRect(leftWidth, 0, middleWidth, kFillHeight);
708 [[NSColor whiteColor] setFill]; 708 [[NSColor whiteColor] setFill];
709 NSRectFill(middleRect); 709 NSRectFill(middleRect);
710 710
711 maskCache_.reset(CGBitmapContextCreateImage(maskContext)); 711 maskCache_.reset(CGBitmapContextCreateImage(maskContext));
712 return maskCache_; 712 return maskCache_;
713 } 713 }
714 714
715 @end // @implementation TabView(Private) 715 @end // @implementation TabView(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698