OLD | NEW |
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 #include <stddef.h> |
| 9 #include <stdint.h> |
8 #import <UIKit/UIKit.h> | 10 #import <UIKit/UIKit.h> |
9 | 11 |
10 #include "base/ios/ios_util.h" | 12 #include "base/ios/ios_util.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/mac/scoped_cftyperef.h" | 14 #include "base/mac/scoped_cftyperef.h" |
13 #include "base/macros.h" | 15 #include "base/macros.h" |
14 #include "third_party/skia/include/utils/mac/SkCGUtils.h" | 16 #include "third_party/skia/include/utils/mac/SkCGUtils.h" |
15 | 17 |
16 namespace { | 18 namespace { |
17 | 19 |
18 const uint8 kICOHeaderMagic[4] = {0x00, 0x00, 0x01, 0x00}; | 20 const uint8_t kICOHeaderMagic[4] = {0x00, 0x00, 0x01, 0x00}; |
19 | 21 |
20 // Returns whether the data encodes an ico image. | 22 // Returns whether the data encodes an ico image. |
21 bool EncodesIcoImage(NSData* image_data) { | 23 bool EncodesIcoImage(NSData* image_data) { |
22 if (image_data.length < arraysize(kICOHeaderMagic)) | 24 if (image_data.length < arraysize(kICOHeaderMagic)) |
23 return false; | 25 return false; |
24 return memcmp(kICOHeaderMagic, image_data.bytes, | 26 return memcmp(kICOHeaderMagic, image_data.bytes, |
25 arraysize(kICOHeaderMagic)) == 0; | 27 arraysize(kICOHeaderMagic)) == 0; |
26 } | 28 } |
27 | 29 |
28 } // namespace | 30 } // namespace |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 126 } |
125 | 127 |
126 UIColor* UIColorFromSkColor(SkColor color) { | 128 UIColor* UIColorFromSkColor(SkColor color) { |
127 return [UIColor colorWithRed:SkColorGetR(color) / 255.0f | 129 return [UIColor colorWithRed:SkColorGetR(color) / 255.0f |
128 green:SkColorGetG(color) / 255.0f | 130 green:SkColorGetG(color) / 255.0f |
129 blue:SkColorGetB(color) / 255.0f | 131 blue:SkColorGetB(color) / 255.0f |
130 alpha:SkColorGetA(color) / 255.0f]; | 132 alpha:SkColorGetA(color) / 255.0f]; |
131 } | 133 } |
132 | 134 |
133 } // namespace skia | 135 } // namespace skia |
OLD | NEW |