| 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 UI_GFX_CODEC_PNG_CODEC_H_ | 5 #ifndef UI_GFX_CODEC_PNG_CODEC_H_ |
| 6 #define UI_GFX_CODEC_PNG_CODEC_H_ | 6 #define UI_GFX_CODEC_PNG_CODEC_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // Interface for encoding and decoding PNG data. This is a wrapper around | 22 // Interface for encoding and decoding PNG data. This is a wrapper around |
| 23 // libpng, which has an inconvenient interface for callers. This is currently | 23 // libpng, which has an inconvenient interface for callers. This is currently |
| 24 // designed for use in tests only (where we control the files), so the handling | 24 // designed for use in tests only (where we control the files), so the handling |
| 25 // isn't as robust as would be required for a browser (see Decode() for more). | 25 // isn't as robust as would be required for a browser (see Decode() for more). |
| 26 // WebKit has its own more complicated PNG decoder which handles, among other | 26 // WebKit has its own more complicated PNG decoder which handles, among other |
| 27 // things, partially downloaded data. | 27 // things, partially downloaded data. |
| 28 class CODEC_EXPORT PNGCodec { | 28 class CODEC_EXPORT PNGCodec { |
| 29 public: | 29 public: |
| 30 enum ColorFormat { | 30 enum ColorFormat { |
| 31 // 3 bytes per pixel (packed), in RGB order regardless of endianness. |
| 32 // This is the native JPEG format. |
| 33 FORMAT_RGB, |
| 34 |
| 31 // 4 bytes per pixel, in RGBA order in memory regardless of endianness. | 35 // 4 bytes per pixel, in RGBA order in memory regardless of endianness. |
| 32 FORMAT_RGBA, | 36 FORMAT_RGBA, |
| 33 | 37 |
| 34 // 4 bytes per pixel, in BGRA order in memory regardless of endianness. | 38 // 4 bytes per pixel, in BGRA order in memory regardless of endianness. |
| 35 // This is the default Windows DIB order. | 39 // This is the default Windows DIB order. |
| 36 FORMAT_BGRA, | 40 FORMAT_BGRA, |
| 37 | 41 |
| 38 // SkBitmap format. For Encode() kARGB_8888_Config (4 bytes per pixel) and | 42 // SkBitmap format. For Encode() kARGB_8888_Config (4 bytes per pixel) and |
| 39 // kA8_Config (1 byte per pixel) formats are supported. kA8_Config gets | 43 // kA8_Config (1 byte per pixel) formats are supported. kA8_Config gets |
| 40 // encoded into a grayscale PNG treating alpha as the color intensity. | 44 // encoded into a grayscale PNG treating alpha as the color intensity. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 static bool Decode(const unsigned char* input, size_t input_size, | 125 static bool Decode(const unsigned char* input, size_t input_size, |
| 122 SkBitmap* bitmap); | 126 SkBitmap* bitmap); |
| 123 | 127 |
| 124 private: | 128 private: |
| 125 DISALLOW_COPY_AND_ASSIGN(PNGCodec); | 129 DISALLOW_COPY_AND_ASSIGN(PNGCodec); |
| 126 }; | 130 }; |
| 127 | 131 |
| 128 } // namespace gfx | 132 } // namespace gfx |
| 129 | 133 |
| 130 #endif // UI_GFX_CODEC_PNG_CODEC_H_ | 134 #endif // UI_GFX_CODEC_PNG_CODEC_H_ |
| OLD | NEW |