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

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

Issue 2567203002: Revert of [ObjC ARC] 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
16 UIColor* DominantColorForImage(const gfx::Image& image, CGFloat opacity) { 12 UIColor* DominantColorForImage(const gfx::Image& image, CGFloat opacity) {
17 SkColor color = color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap()); 13 SkColor color = color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap());
18 UIColor* result = [UIColor colorWithRed:SkColorGetR(color) / 255.0 14 UIColor* result = [UIColor colorWithRed:SkColorGetR(color) / 255.0
19 green:SkColorGetG(color) / 255.0 15 green:SkColorGetG(color) / 255.0
20 blue:SkColorGetB(color) / 255.0 16 blue:SkColorGetB(color) / 255.0
21 alpha:opacity]; 17 alpha:opacity];
22 return result; 18 return result;
23 } 19 }
24 20
25 UIImage* StretchableImageFromUIImage(UIImage* image, 21 UIImage* StretchableImageFromUIImage(UIImage* image,
(...skipping 17 matching lines...) Expand all
43 39
44 UIImage* StretchableImageNamed(NSString* name, 40 UIImage* StretchableImageNamed(NSString* name,
45 NSInteger left_cap_width, 41 NSInteger left_cap_width,
46 NSInteger top_cap_height) { 42 NSInteger top_cap_height) {
47 UIImage* image = [UIImage imageNamed:name]; 43 UIImage* image = [UIImage imageNamed:name];
48 if (!image) 44 if (!image)
49 return nil; 45 return nil;
50 46
51 return StretchableImageFromUIImage(image, left_cap_width, top_cap_height); 47 return StretchableImageFromUIImage(image, left_cap_width, top_cap_height);
52 } 48 }
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