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

Unified Diff: src/codec/SkPngCodec.cpp

Issue 2424353003: Consider the start_coord in interlaced PNG (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698