Chromium Code Reviews| Index: ui/gfx/codec/png_codec.h |
| diff --git a/ui/gfx/codec/png_codec.h b/ui/gfx/codec/png_codec.h |
| index 335b58affb051041b480d876cff5f13e37674489..ca060105ee4e8b462766613be21eff47436403f4 100644 |
| --- a/ui/gfx/codec/png_codec.h |
| +++ b/ui/gfx/codec/png_codec.h |
| @@ -27,6 +27,8 @@ class Size; |
| // things, partially downloaded data. |
| class CODEC_EXPORT PNGCodec { |
| public: |
| + static constexpr int DEFAULT_ZLIB_COMPRESSION = 6; |
| + |
| enum ColorFormat { |
| // 4 bytes per pixel, in RGBA order in memory regardless of endianness. |
| FORMAT_RGBA, |
| @@ -35,10 +37,10 @@ class CODEC_EXPORT PNGCodec { |
| // This is the default Windows DIB order. |
| FORMAT_BGRA, |
| - // SkBitmap format. For Encode() kARGB_8888_Config (4 bytes per pixel) and |
| - // kA8_Config (1 byte per pixel) formats are supported. kA8_Config gets |
| - // encoded into a grayscale PNG treating alpha as the color intensity. |
| - // For Decode() kARGB_8888_Config is always used. |
| + // SkBitmap format. For Encode() kBGRA_8888_SkColorType (4 bytes per pixel) |
|
scroggo_chromium
2017/07/11 19:33:09
Actually, I think this should probably be kN32_SkC
liyuqian
2017/07/11 19:59:25
Done.
|
| + // and kAlpha_8_SkColorType (1 byte per pixel) formats are supported. |
| + // kAlpha_8_SkColorType gets encoded into a grayscale PNG treating alpha as |
| + // the color intensity. For Decode() kBGRA_8888_SkColorType is always used. |
| FORMAT_SkBitmap |
| }; |
| @@ -77,7 +79,7 @@ class CODEC_EXPORT PNGCodec { |
| std::vector<unsigned char>* output); |
| // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed |
| - // to be kARGB_8888_Config, 32 bits per pixel. The params |
| + // to be kBGRA_8888_SkColorType, 32 bits per pixel. The params |
|
scroggo_chromium
2017/07/11 19:33:09
kN32
liyuqian
2017/07/11 19:59:25
Done.
|
| // |discard_transparency| and |output| are passed directly to Encode; refer to |
| // Encode for more information. |
| static bool EncodeBGRASkBitmap(const SkBitmap& input, |
| @@ -91,10 +93,10 @@ class CODEC_EXPORT PNGCodec { |
| bool discard_transparency, |
| std::vector<unsigned char>* output); |
| - // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed |
| - // to be kA8_Config, 8 bits per pixel. The bitmap is encoded as a grayscale |
| - // PNG with alpha used for color intensity. The |output| param is passed |
| - // directly to Encode; refer to Encode for more information. |
| + // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed to |
| + // be kAlpha_8_SkColorType, 8 bits per pixel. The bitmap is encoded as a |
| + // grayscale PNG with alpha used for color intensity. The |output| param is |
| + // passed directly to Encode; refer to Encode for more information. |
| static bool EncodeA8SkBitmap(const SkBitmap& input, |
| std::vector<unsigned char>* output); |