Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // TODO(darin): Remove once this #include has been upstreamed to ImageDiff.cpp. | 11 // TODO(darin): Remove once this #include has been upstreamed to ImageDiff.cpp. |
| 12 // ImageDiff.cpp expects that PATH_MAX has already been defined :-/ | 12 // ImageDiff.cpp expects that PATH_MAX has already been defined :-/ |
| 13 #include <limits.h> | 13 #include <limits.h> |
| 14 | 14 |
| 15 namespace webkit_support { | 15 namespace webkit_support { |
| 16 | 16 |
| 17 enum ColorFormat { | |
|
tony
2011/10/12 16:50:48
Can we move this to the .cc file and put it in an
HaoZheng
2011/10/13 03:16:02
Done.
| |
| 18 // 3 bytes per pixel (packed), in RGB order regardless of endianness. | |
| 19 // This is the native JPEG format. | |
| 20 FORMAT_RGB, | |
| 21 | |
| 22 // 4 bytes per pixel, in RGBA order in memory regardless of endianness. | |
| 23 FORMAT_RGBA, | |
| 24 | |
| 25 // 4 bytes per pixel, in BGRA order in memory regardless of endianness. | |
| 26 // This is the default Windows DIB order. | |
| 27 FORMAT_BGRA, | |
| 28 | |
| 29 // 4 bytes per pixel, in pre-multiplied kARGB_8888_Config format. For use | |
| 30 // with directly writing to a skia bitmap. | |
| 31 FORMAT_SkBitmap | |
| 32 }; | |
| 33 | |
| 34 // Represents a comment in the tEXt ancillary chunk of the png. | |
| 35 struct Comment { | |
|
tony
2011/10/12 16:50:48
This too.
HaoZheng
2011/10/13 03:16:02
Done.
| |
| 36 Comment(const std::string& k, const std::string& t); | |
| 37 ~Comment(); | |
| 38 | |
| 39 std::string key; | |
| 40 std::string text; | |
| 41 }; | |
| 42 | |
| 17 // Decode a PNG into an RGBA pixel array. | 43 // Decode a PNG into an RGBA pixel array. |
| 18 bool DecodePNG(const unsigned char* input, size_t input_size, | 44 bool DecodePNG(const unsigned char* input, size_t input_size, |
| 19 std::vector<unsigned char>* output, | 45 std::vector<unsigned char>* output, |
| 20 int* width, int* height); | 46 int* width, int* height); |
| 21 | 47 |
| 22 // Encode an RGBA pixel array into a PNG. | 48 // Encode an RGBA pixel array into a PNG. |
| 23 bool EncodeRGBAPNG(const unsigned char* input, | 49 bool EncodeRGBAPNG(const unsigned char* input, |
| 24 int width, | 50 int width, |
| 25 int height, | 51 int height, |
| 26 int row_byte_width, | 52 int row_byte_width, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 38 int width, | 64 int width, |
| 39 int height, | 65 int height, |
| 40 int row_byte_width, | 66 int row_byte_width, |
| 41 bool discard_transparency, | 67 bool discard_transparency, |
| 42 const std::string& checksum, | 68 const std::string& checksum, |
| 43 std::vector<unsigned char>* output); | 69 std::vector<unsigned char>* output); |
| 44 | 70 |
| 45 } // namespace webkit_support | 71 } // namespace webkit_support |
| 46 | 72 |
| 47 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ | 73 #endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_ |
| OLD | NEW |