OLD | NEW |
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 #include "skia/public/type_converters.h" | 5 #include "skia/public/type_converters.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
7 #include <string.h> | 9 #include <string.h> |
8 | 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
11 | 13 |
12 namespace mojo { | 14 namespace mojo { |
13 | 15 |
14 namespace { | 16 namespace { |
15 | 17 |
16 SkColorType MojoColorTypeToSk(skia::ColorType type) { | 18 SkColorType MojoColorTypeToSk(skia::ColorType type) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 result->height = info.height(); | 132 result->height = info.height(); |
131 size_t size = bitmap.getSize(); | 133 size_t size = bitmap.getSize(); |
132 size_t row_bytes = bitmap.rowBytes(); | 134 size_t row_bytes = bitmap.rowBytes(); |
133 result->pixel_data = mojo::Array<uint8_t>::New(size); | 135 result->pixel_data = mojo::Array<uint8_t>::New(size); |
134 if (!bitmap.readPixels(info, &result->pixel_data[0], row_bytes, 0, 0)) | 136 if (!bitmap.readPixels(info, &result->pixel_data[0], row_bytes, 0, 0)) |
135 return nullptr; | 137 return nullptr; |
136 return result; | 138 return result; |
137 } | 139 } |
138 | 140 |
139 } // namespace mojo | 141 } // namespace mojo |
OLD | NEW |