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

Side by Side Diff: ios/chrome/browser/ui/image_util.mm

Issue 2569213002: [ObjC ARC] Reland of Converts ios/chrome/browser/ui:ui to ARC. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <UIKit/UIKit.h> 5 #import <UIKit/UIKit.h>
6 6
7 #import "ios/chrome/browser/ui/image_util.h" 7 #import "ios/chrome/browser/ui/image_util.h"
8 8
9 #include "ui/gfx/color_analysis.h" 9 #include "ui/gfx/color_analysis.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support."
14 #endif
15
12 UIColor* DominantColorForImage(const gfx::Image& image, CGFloat opacity) { 16 UIColor* DominantColorForImage(const gfx::Image& image, CGFloat opacity) {
13 SkColor color = color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap()); 17 SkColor color = color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap());
14 UIColor* result = [UIColor colorWithRed:SkColorGetR(color) / 255.0 18 UIColor* result = [UIColor colorWithRed:SkColorGetR(color) / 255.0
15 green:SkColorGetG(color) / 255.0 19 green:SkColorGetG(color) / 255.0
16 blue:SkColorGetB(color) / 255.0 20 blue:SkColorGetB(color) / 255.0
17 alpha:opacity]; 21 alpha:opacity];
18 return result; 22 return result;
19 } 23 }
20 24
21 UIImage* StretchableImageFromUIImage(UIImage* image, 25 UIImage* StretchableImageFromUIImage(UIImage* image,
(...skipping 17 matching lines...) Expand all
39 43
40 UIImage* StretchableImageNamed(NSString* name, 44 UIImage* StretchableImageNamed(NSString* name,
41 NSInteger left_cap_width, 45 NSInteger left_cap_width,
42 NSInteger top_cap_height) { 46 NSInteger top_cap_height) {
43 UIImage* image = [UIImage imageNamed:name]; 47 UIImage* image = [UIImage imageNamed:name];
44 if (!image) 48 if (!image)
45 return nil; 49 return nil;
46 50
47 return StretchableImageFromUIImage(image, left_cap_width, top_cap_height); 51 return StretchableImageFromUIImage(image, left_cap_width, top_cap_height);
48 } 52 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/file_locations.mm ('k') | ios/chrome/browser/ui/native_content_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698