diff options
author | 2015-08-06 15:34:42 -0700 | |
---|---|---|
committer | 2015-08-06 15:34:42 -0700 | |
commit | 4ab9d5f1bc6d05c49dc765c3de5ade816f4c968e (patch) | |
tree | ecab1b0e6d12a892197f81a89b3bd1df3e0e7a58 /src/codec/SkCodec_libpng.cpp | |
parent | 74992b579422a5e31fa07705d1f9206e0d919706 (diff) |
Split SkBmpCodec into three separate classes
Will regress behavior on gold on test32bfv4.bmp, where we
will no longer fix transparent decodes.
TODO: Start fixing transparent decodes again, or decide
that we don't want to fix them and remove isTransparent
from SkSwizzler. I think this may become more clear when I
start implementing the scanline decoder.
BUG=skia:
Review URL: https://codereview.chromium.org/1258863008
Diffstat (limited to 'src/codec/SkCodec_libpng.cpp')
-rw-r--r-- | src/codec/SkCodec_libpng.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp index 7c6a74c13a..f23990095b 100644 --- a/src/codec/SkCodec_libpng.cpp +++ b/src/codec/SkCodec_libpng.cpp @@ -397,24 +397,11 @@ static bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) return false; } - // Check for supported alpha types - if (src.alphaType() != dst.alphaType()) { - if (kOpaque_SkAlphaType == src.alphaType()) { - // If the source is opaque, we must decode to opaque - return false; - } - - // The source is not opaque - switch (dst.alphaType()) { - case kPremul_SkAlphaType: - case kUnpremul_SkAlphaType: - // The source is not opaque, so either of these is okay - break; - default: - // We cannot decode a non-opaque image to opaque (or unknown) - return false; - } + // Ensure the alpha type is valid + if (!valid_alpha(dst.alphaType(), src.alphaType())) { + return false; } + // Check for supported color types switch (dst.colorType()) { case kN32_SkColorType: |