Chromium Code Reviews| Index: src/codec/SkPngCodec.cpp |
| diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp |
| index 2c13b12c7e75ffa00a3e04da067def657fa35141..853334d71b635d728a775e87e604ffa9eba2bcbf 100644 |
| --- a/src/codec/SkPngCodec.cpp |
| +++ b/src/codec/SkPngCodec.cpp |
| @@ -764,6 +764,18 @@ static bool read_header(SkStream* stream, SkPngChunkReader* chunkReader, SkCodec |
| } |
| } |
| + if (PNG_COLOR_TYPE_GRAY == encodedColorType) { |
| + png_textp text; |
| + if (png_get_text(png_ptr, info_ptr, &text, nullptr)) { |
| + if (0 == strcmp("SkColorType", text->key) && 0 == strcmp("Alpha8", text->text)) { |
|
msarett
2016/08/30 14:30:38
Ideally, we store these strings somewhere that is
|
| + // Recommend a decode to Alpha8 if our custom encoder has marked |
| + // the image as Alpha8. |
| + imageInfo = imageInfo.makeColorType(kAlpha_8_SkColorType) |
| + .makeAlphaType(kPremul_SkAlphaType); |
| + } |
| + } |
| + } |
| + |
| if (1 == numberPasses) { |
| *outCodec = new SkPngNormalCodec(encodedInfo, imageInfo, stream, |
| chunkReader, png_ptr, info_ptr, bitDepth); |