OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ | 5 #ifndef WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ |
6 #define WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ | 6 #define WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "gfx/codec/png_codec.h" | 10 #include "ui/gfx/codec/png_codec.h" |
11 | 11 |
12 namespace webkit_support { | 12 namespace webkit_support { |
13 | 13 |
14 // Decode a PNG into an RGBA pixel array. | 14 // Decode a PNG into an RGBA pixel array. |
15 inline bool DecodePNG(const unsigned char* input, size_t input_size, | 15 inline bool DecodePNG(const unsigned char* input, size_t input_size, |
16 std::vector<unsigned char>* output, | 16 std::vector<unsigned char>* output, |
17 int* width, int* height) { | 17 int* width, int* height) { |
18 return gfx::PNGCodec::Decode(input, input_size, gfx::PNGCodec::FORMAT_RGBA, | 18 return gfx::PNGCodec::Decode(input, input_size, gfx::PNGCodec::FORMAT_RGBA, |
19 output, width, height); | 19 output, width, height); |
20 } | 20 } |
(...skipping 11 matching lines...) Expand all Loading... |
32 int row_byte_width, bool discard_transparency, | 32 int row_byte_width, bool discard_transparency, |
33 std::vector<unsigned char>* output) { | 33 std::vector<unsigned char>* output) { |
34 return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA, width, | 34 return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA, width, |
35 height, row_byte_width, discard_transparency, | 35 height, row_byte_width, discard_transparency, |
36 output); | 36 output); |
37 } | 37 } |
38 | 38 |
39 } // namespace webkit_support | 39 } // namespace webkit_support |
40 | 40 |
41 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ | 41 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ |
OLD | NEW |