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

Side by Side Diff: ui/base/cocoa/nscolor_additions.mm

Issue 2189483002: ui/base/cocoa: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/base/cocoa/nscolor_additions.h" 5 #import "ui/base/cocoa/nscolor_additions.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #import "base/mac/sdk_forward_declarations.h" 8 #import "base/mac/sdk_forward_declarations.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 10
11 @implementation NSColor (ChromeAdditions) 11 @implementation NSColor (ChromeAdditions)
12 12
13 - (CGColorRef)cr_CGColor { 13 - (CGColorRef)cr_CGColor {
14 // Redirect to -[NSColor CGColor] if available because it caches. 14 // Redirect to -[NSColor CGColor] if available because it caches.
15 static BOOL redirect = 15 static BOOL redirect =
16 [NSColor instancesRespondToSelector:@selector(CGColor)]; 16 [NSColor instancesRespondToSelector:@selector(CGColor)];
17 if (redirect) 17 if (redirect)
18 return [self CGColor]; 18 return [self CGColor];
19 19
20 const NSInteger numberOfComponents = [self numberOfComponents]; 20 const NSInteger numberOfComponents = [self numberOfComponents];
21 std::vector<CGFloat> components(numberOfComponents, 0.0); 21 std::vector<CGFloat> components(numberOfComponents, 0.0);
22 [self getComponents:components.data()]; 22 [self getComponents:components.data()];
23 auto color = CGColorCreate([[self colorSpace] CGColorSpace], 23 auto* color =
24 components.data()); 24 CGColorCreate([[self colorSpace] CGColorSpace], components.data());
25 base::mac::CFTypeRefToNSObjectAutorelease(color); 25 base::mac::CFTypeRefToNSObjectAutorelease(color);
26 return color; 26 return color;
27 } 27 }
28 28
29 @end 29 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698