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

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: Moved bmp specific code out of the swizzler Created 5 years, 10 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
Index: src/codec/SkCodec_libpng.cpp
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 3d8d4b5634f72f14f3e9f90d945f956064d6f483..d9e5db816d10c76f319cbd0dbb893587c0d8c3e9 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -445,10 +445,10 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
// made in the factory.
png_read_update_info(fPng_ptr, fInfo_ptr);
+ const int bpp = SkSwizzler::BitsPerPixel(sc) / 8;
scroggo 2015/03/06 18:56:14 This makes me nervous that we've messed up if Bits
if (numberPasses > 1) {
const int width = requestedInfo.width();
const int height = requestedInfo.height();
- const int bpp = SkSwizzler::BytesPerPixel(sc);
const size_t rowBytes = width * bpp;
storage.reset(width * height * bpp);
@@ -470,7 +470,7 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
row += rowBytes;
}
} else {
- storage.reset(requestedInfo.width() * SkSwizzler::BytesPerPixel(sc));
+ storage.reset(requestedInfo.width() * bpp);
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);

Powered by Google App Engine
This is Rietveld 408576698