aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
diff options
context:
space:
mode:
authorGravatar emmaleer <emmaleer@google.com>2015-05-27 08:49:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-27 08:49:04 -0700
commit7dc9190b765d00467bed7076bacb568fb894e137 (patch)
tree7bcc62e29bea98f0da245c09e26ef089c88a763f /src/codec
parent9572a10c9a6a868bbb8f71d7806d0a45f183333f (diff)
fixing onSkipScanlines png error
There was a bug in onSkipScanlines where NULL was being passed instead of the SrcRow to png_read_rows. This caused SkipScanlines to appear to be skipping, as fCurrScanline was updated and SkipScanlines returned success, however png_read_rows was not actually reading anything, and no lines were skipped. Review URL: https://codereview.chromium.org/1159853003
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/SkCodec_libpng.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 9cd382092e..c2a032e84e 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;
}