Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1285)

Unified Diff: src/codec/SkCodec_libpng.cpp

Issue 947283002: Bmp Image Decoding (Closed) Base URL: https://skia.googlesource.com/skia.git@decode-leon-3
Patch Set: Original change plus fix Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkCodec_libbmp.cpp ('k') | src/codec/SkMaskSwizzler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
}
« no previous file with comments | « src/codec/SkCodec_libbmp.cpp ('k') | src/codec/SkMaskSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698