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

Side by Side Diff: skia/ext/skia_utils_ios.mm

Issue 1508893003: Use proper namespace in skia/ext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « skia/ext/skia_utils_ios.h ('k') | skia/ext/skia_utils_ios_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "skia/ext/skia_utils_ios.h" 5 #include "skia/ext/skia_utils_ios.h"
6 6
7 #import <ImageIO/ImageIO.h> 7 #import <ImageIO/ImageIO.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include "base/ios/ios_util.h" 10 #include "base/ios/ios_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/mac/scoped_cftyperef.h" 12 #include "base/mac/scoped_cftyperef.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "third_party/skia/include/utils/mac/SkCGUtils.h" 14 #include "third_party/skia/include/utils/mac/SkCGUtils.h"
15 15
16 namespace { 16 namespace {
17 17
18 const uint8 kICOHeaderMagic[4] = {0x00, 0x00, 0x01, 0x00}; 18 const uint8 kICOHeaderMagic[4] = {0x00, 0x00, 0x01, 0x00};
19 19
20 // Returns whether the data encodes an ico image. 20 // Returns whether the data encodes an ico image.
21 bool EncodesIcoImage(NSData* image_data) { 21 bool EncodesIcoImage(NSData* image_data) {
22 if (image_data.length < arraysize(kICOHeaderMagic)) 22 if (image_data.length < arraysize(kICOHeaderMagic))
23 return false; 23 return false;
24 return memcmp(kICOHeaderMagic, image_data.bytes, 24 return memcmp(kICOHeaderMagic, image_data.bytes,
25 arraysize(kICOHeaderMagic)) == 0; 25 arraysize(kICOHeaderMagic)) == 0;
26 } 26 }
27 27
28 } // namespace 28 } // namespace
29 29
30 namespace gfx { 30 namespace skia {
31 31
32 SkBitmap CGImageToSkBitmap(CGImageRef image, CGSize size, bool is_opaque) { 32 SkBitmap CGImageToSkBitmap(CGImageRef image, CGSize size, bool is_opaque) {
33 SkBitmap bitmap; 33 SkBitmap bitmap;
34 if (!image) 34 if (!image)
35 return bitmap; 35 return bitmap;
36 36
37 if (!bitmap.tryAllocN32Pixels(size.width, size.height, is_opaque)) 37 if (!bitmap.tryAllocN32Pixels(size.width, size.height, is_opaque))
38 return bitmap; 38 return bitmap;
39 39
40 void* data = bitmap.getPixels(); 40 void* data = bitmap.getPixels();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return frames; 123 return frames;
124 } 124 }
125 125
126 UIColor* UIColorFromSkColor(SkColor color) { 126 UIColor* UIColorFromSkColor(SkColor color) {
127 return [UIColor colorWithRed:SkColorGetR(color) / 255.0f 127 return [UIColor colorWithRed:SkColorGetR(color) / 255.0f
128 green:SkColorGetG(color) / 255.0f 128 green:SkColorGetG(color) / 255.0f
129 blue:SkColorGetB(color) / 255.0f 129 blue:SkColorGetB(color) / 255.0f
130 alpha:SkColorGetA(color) / 255.0f]; 130 alpha:SkColorGetA(color) / 255.0f];
131 } 131 }
132 132
133 } // namespace gfx 133 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/skia_utils_ios.h ('k') | skia/ext/skia_utils_ios_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698