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

Unified Diff: src/codec/SkBmpStandardCodec.cpp

Issue 1691083002: Implement onSkipScanlines() for bmp and wbmp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/codec/SkBmpStandardCodec.h ('k') | src/codec/SkWbmpCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkBmpStandardCodec.cpp
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 66a8c9a12a12c4d1af73c3ebd7d83856a55b9ac8..47b10701d332156a63ece8f08f852f3d09dc443f 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -25,8 +25,7 @@ SkBmpStandardCodec::SkBmpStandardCodec(const SkImageInfo& info, SkStream* stream
, fBytesPerColor(bytesPerColor)
, fOffset(offset)
, fSwizzler(nullptr)
- , fSrcRowBytes(SkAlign4(compute_row_bytes(this->getInfo().width(), this->bitsPerPixel())))
- , fSrcBuffer(new uint8_t [fSrcRowBytes])
+ , fSrcBuffer(new uint8_t [this->srcRowBytes()])
, fIsOpaque(isOpaque)
, fInIco(inIco)
, fAndMaskRowBytes(fInIco ? SkAlign4(compute_row_bytes(this->getInfo().width(), 1)) : 0)
@@ -225,7 +224,7 @@ int SkBmpStandardCodec::decodeRows(const SkImageInfo& dstInfo, void* dst, size_t
const int height = dstInfo.height();
for (int y = 0; y < height; y++) {
// Read a row of the input
- if (this->stream()->read(fSrcBuffer.get(), fSrcRowBytes) != fSrcRowBytes) {
+ if (this->stream()->read(fSrcBuffer.get(), this->srcRowBytes()) != this->srcRowBytes()) {
SkCodecPrintf("Warning: incomplete input stream.\n");
return y;
}
@@ -262,7 +261,7 @@ int SkBmpStandardCodec::decodeRows(const SkImageInfo& dstInfo, void* dst, size_t
// Calculate how many bytes we must skip to reach the AND mask.
const int remainingScanlines = this->getInfo().height() - startScanline - height;
- const size_t bytesToSkip = remainingScanlines * fSrcRowBytes +
+ const size_t bytesToSkip = remainingScanlines * this->srcRowBytes() +
startScanline * fAndMaskRowBytes;
const size_t subStreamStartPosition = currPosition + bytesToSkip;
if (subStreamStartPosition >= length) {
« no previous file with comments | « src/codec/SkBmpStandardCodec.h ('k') | src/codec/SkWbmpCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698