Index: src/codec/SkCodec_libpng.cpp |
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp |
index 8e7ee33a9554bce341cf8681b2db86d334bfae1b..f42af38fea707787f0fc760dba74d5486acf0572 100644 |
--- a/src/codec/SkCodec_libpng.cpp |
+++ b/src/codec/SkCodec_libpng.cpp |
@@ -6,6 +6,7 @@ |
*/ |
#include "SkCodec_libpng.h" |
+#include "SkCodecPriv.h" |
#include "SkColorPriv.h" |
#include "SkColorTable.h" |
#include "SkBitmap.h" |
@@ -346,10 +347,6 @@ SkPngCodec::~SkPngCodec() { |
// Getting the pixels |
/////////////////////////////////////////////////////////////////////////////// |
-static bool premul_and_unpremul(SkAlphaType A, SkAlphaType B) { |
- return kPremul_SkAlphaType == A && kUnpremul_SkAlphaType == B; |
-} |
- |
static bool conversion_possible(const SkImageInfo& A, const SkImageInfo& B) { |
// TODO: Support other conversions |
if (A.colorType() != B.colorType()) { |
@@ -466,7 +463,7 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void* |
// Now swizzle it. |
uint8_t* row = base; |
for (int y = 0; y < height; y++) { |
- reallyHasAlpha |= swizzler->next(row); |
+ reallyHasAlpha |= !SkSwizzler::IsOpaque(swizzler->next(row)); |
row += rowBytes; |
} |
} else { |
@@ -474,7 +471,7 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void* |
uint8_t* srcRow = static_cast<uint8_t*>(storage.get()); |
for (int y = 0; y < requestedInfo.height(); y++) { |
png_read_rows(fPng_ptr, &srcRow, png_bytepp_NULL, 1); |
- reallyHasAlpha |= swizzler->next(srcRow); |
+ reallyHasAlpha |= !SkSwizzler::IsOpaque(swizzler->next(srcRow)); |
} |
} |