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

Side by Side Diff: webkit/support/webkit_support_gfx.h

Issue 7328011: Introduce ui.dll / libui.so for the component build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ui/gfx/codec/png_codec.h"
12 #include "ui/gfx/size.h"
13
14 namespace webkit_support { 11 namespace webkit_support {
15 12
16 // Decode a PNG into an RGBA pixel array. 13 // Decode a PNG into an RGBA pixel array.
17 inline bool DecodePNG(const unsigned char* input, size_t input_size, 14 bool DecodePNG(const unsigned char* input, size_t input_size,
18 std::vector<unsigned char>* output, 15 std::vector<unsigned char>* output,
19 int* width, int* height) { 16 int* width, int* height);
20 return gfx::PNGCodec::Decode(input, input_size, gfx::PNGCodec::FORMAT_RGBA,
21 output, width, height);
22 }
23 17
24 // Encode an RGBA pixel array into a PNG. 18 // Encode an RGBA pixel array into a PNG.
25 inline bool EncodeRGBAPNG(const unsigned char* input, 19 bool EncodeRGBAPNG(const unsigned char* input,
26 int width, 20 int width,
27 int height, 21 int height,
28 int row_byte_width, 22 int row_byte_width,
29 std::vector<unsigned char>* output) { 23 std::vector<unsigned char>* output);
30 return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_RGBA,
31 gfx::Size(width, height), row_byte_width, false,
32 std::vector<gfx::PNGCodec::Comment>(), output);
33 }
34 24
35 // Encode an BGRA pixel array into a PNG. 25 // Encode an BGRA pixel array into a PNG.
36 inline bool EncodeBGRAPNG(const unsigned char* input, 26 bool EncodeBGRAPNG(const unsigned char* input,
37 int width, 27 int width,
38 int height, 28 int height,
39 int row_byte_width, 29 int row_byte_width,
40 bool discard_transparency, 30 bool discard_transparency,
41 std::vector<unsigned char>* output) { 31 std::vector<unsigned char>* output);
42 return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA,
43 gfx::Size(width, height), row_byte_width, discard_transparency,
44 std::vector<gfx::PNGCodec::Comment>(), output);
45 }
46 32
47 inline bool EncodeBGRAPNGWithChecksum(const unsigned char* input, 33 bool EncodeBGRAPNGWithChecksum(const unsigned char* input,
48 int width, 34 int width,
49 int height, 35 int height,
50 int row_byte_width, 36 int row_byte_width,
51 bool discard_transparency, 37 bool discard_transparency,
52 const std::string& checksum, 38 const std::string& checksum,
53 std::vector<unsigned char>* output) { 39 std::vector<unsigned char>* output);
54 std::vector<gfx::PNGCodec::Comment> comments;
55 comments.push_back(gfx::PNGCodec::Comment("checksum", checksum));
56 return gfx::PNGCodec::Encode(input, gfx::PNGCodec::FORMAT_BGRA,
57 gfx::Size(width, height), row_byte_width, discard_transparency,
58 comments, output);
59 }
60 40
61 } // namespace webkit_support 41 } // namespace webkit_support
62 42
63 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ 43 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
OLDNEW
« webkit/support/webkit_support.gypi ('K') | « webkit/support/webkit_support.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698