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

Unified Diff: src/codec/SkCodec_libpng.cpp

Issue 1159853003: fixing onSkipScanlines png error (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixing onSkipScanlines ong error Created 5 years, 7 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/SkCodec_libpng.cpp
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 9cd382092e25da6ff77cd902ab1ae85c32a8ba31..c2a032e84ea8d98017998bdf5e6f9e12bf059685 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -624,8 +624,12 @@ public:
SkCodecPrintf("setjmp long jump!\n");
return SkImageGenerator::kInvalidInput;
}
-
- png_read_rows(fCodec->fPng_ptr, png_bytepp_NULL, png_bytepp_NULL, count);
+ //there is a potential tradeoff of memory vs speed created by putting this in a loop.
+ //calling png_read_rows in a loop is insignificantly slower than calling it once with count
+ //as png_read_rows has it's own loop which calls png_read_row count times.
+ for (int i = 0; i < count; i++) {
+ png_read_rows(fCodec->fPng_ptr, &fSrcRow, png_bytepp_NULL, 1);
+ }
return SkImageGenerator::kSuccess;
}
« 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