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

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" 11 // TODO(darin): Remove once this #include has been upstreamed to ImageDiff.cpp.
12 #include "ui/gfx/size.h" 12 // ImageDiff.cpp expects that PATH_MAX has already been defined :-/
13 #include <limits.h>
13 14
14 namespace webkit_support { 15 namespace webkit_support {
15 16
16 // Decode a PNG into an RGBA pixel array. 17 // Decode a PNG into an RGBA pixel array.
17 inline bool DecodePNG(const unsigned char* input, size_t input_size, 18 bool DecodePNG(const unsigned char* input, size_t input_size,
18 std::vector<unsigned char>* output, 19 std::vector<unsigned char>* output,
19 int* width, int* height) { 20 int* width, int* height);
20 return gfx::PNGCodec::Decode(input, input_size, gfx::PNGCodec::FORMAT_RGBA,
21 output, width, height);
22 }
23 21
24 // Encode an RGBA pixel array into a PNG. 22 // Encode an RGBA pixel array into a PNG.
25 inline bool EncodeRGBAPNG(const unsigned char* input, 23 bool EncodeRGBAPNG(const unsigned char* input,
26 int width, 24 int width,
27 int height, 25 int height,
28 int row_byte_width, 26 int row_byte_width,
29 std::vector<unsigned char>* output) { 27 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 28
35 // Encode an BGRA pixel array into a PNG. 29 // Encode an BGRA pixel array into a PNG.
36 inline bool EncodeBGRAPNG(const unsigned char* input, 30 bool EncodeBGRAPNG(const unsigned char* input,
37 int width, 31 int width,
38 int height, 32 int height,
39 int row_byte_width, 33 int row_byte_width,
40 bool discard_transparency, 34 bool discard_transparency,
41 std::vector<unsigned char>* output) { 35 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 36
47 inline bool EncodeBGRAPNGWithChecksum(const unsigned char* input, 37 bool EncodeBGRAPNGWithChecksum(const unsigned char* input,
48 int width, 38 int width,
49 int height, 39 int height,
50 int row_byte_width, 40 int row_byte_width,
51 bool discard_transparency, 41 bool discard_transparency,
52 const std::string& checksum, 42 const std::string& checksum,
53 std::vector<unsigned char>* output) { 43 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 44
61 } // namespace webkit_support 45 } // namespace webkit_support
62 46
63 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ 47 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698