Index: src/codec/SkPngCodec.cpp |
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp |
index 429317dcebf2ad6f54ae22ed113814ffcd798426..00eb448a4dd3f9dc5326bc96a31d6a2c3a724ac8 100644 |
--- a/src/codec/SkPngCodec.cpp |
+++ b/src/codec/SkPngCodec.cpp |
@@ -726,14 +726,16 @@ private: |
// FIXME: For resuming interlace, we may swizzle a row that hasn't changed. But it |
// may be too tricky/expensive to handle that correctly. |
- png_bytep srcRow = fInterlaceBuffer.get(); |
+ |
+ // Offset srcRow by get_start_coord rows. We do not need to account for fFirstRow, |
+ // since the first row in fInterlaceBuffer corresponds to fFirstRow. |
+ png_bytep srcRow = SkTAddOffset<png_byte>(fInterlaceBuffer.get(), |
+ fPng_rowbytes * get_start_coord(sampleY)); |
void* dst = fDst; |
- for (int rowNum = fFirstRow + get_start_coord(sampleY); rowsWrittenToOutput < rowsNeeded; |
scroggo_chromium
2016/10/18 14:32:19
Notice that I used get_start_coord to compute rowN
|
- rowNum += sampleY) { |
+ for (; rowsWrittenToOutput < rowsNeeded; rowsWrittenToOutput++) { |
this->applyXformRow(dst, srcRow); |
dst = SkTAddOffset<void>(dst, fRowBytes); |
srcRow = SkTAddOffset<png_byte>(srcRow, fPng_rowbytes * sampleY); |
- rowsWrittenToOutput++; |
} |
if (fInterlacedComplete) { |