aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CodecPartialTest.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins <scroggo@google.com>2017-04-20 15:06:53 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-20 15:07:23 +0000
commit434b6e81a5093bdd72b232de249386af3902248f (patch)
tree3f6fb1efd225d456d38bbefec5ffdcccccc06eed /tests/CodecPartialTest.cpp
parent28804f3571e8eaa6f3b9d68bb1e72d99c990978a (diff)
Revert "Make SkPngCodec only read as much of the stream as necessary"
This reverts commit 2c65d5161260f3d45a63dcd92229bd09c8a12d53. Reason for revert: Causing failures in Google3 (https://test.corp.google.com/ui#cl=153703311&flags=CAMQAg==&id=OCL:153703311:BASE:153703364:1492695824938:4db2240d&t=//chrome/skia/dm_wrapper:dm_wrapper) and differences in Gold. This change was not intended to change the output. Original change's description: > Make SkPngCodec only read as much of the stream as necessary > > Previously, SkPngCodec assumed that the stream only contained one > image, which ended at the end of the stream. It read the stream in > arbitrarily-sized chunks, and then passed that data to libpng for > processing. > > If a stream contains more than one image, this may result in reading > beyond the end of the image, making future reads read the wrong data. > > Now, SkPngCodec starts by reading 8 bytes at a time. After the > signature, 8 bytes is enough to know which chunk is next and how many > bytes are in the chunk. > > When decoding the size, we stop when we reach IDAT, and when decoding > the image, we stop when we reach IEND. > > This manual parsing is necessary to support APNG, which is planned in > the future. It also allows us to remove the SK_GOOGLE3_PNG_HACK, which > was a workaround for reading more than necessary at the beginning of > the image. > > Add a test that simulates the issue, by decoding a special stream that > reports an error if the codec attempts to read beyond the end. > > Temporarily disable the partial decoding tests for png. A larger change > will be necessary to get those working again, and no clients are > currently relying on incrementally decoding PNGs (i.e. decode part of > an image, then decode further with more data). > > Bug: skia:5368 > BUG:34073812 > > Change-Id: If832f7b20565411226fb5be3c305a4d16bf9269d > Reviewed-on: https://skia-review.googlesource.com/13900 > Commit-Queue: Leon Scroggins <scroggo@google.com> > Reviewed-by: Matt Sarett <msarett@google.com> > TBR=msarett@google.com,scroggo@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I2f82e9960dda7bf5c646774df84320dadb7b930e Reviewed-on: https://skia-review.googlesource.com/13971 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests/CodecPartialTest.cpp')
-rw-r--r--tests/CodecPartialTest.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/CodecPartialTest.cpp b/tests/CodecPartialTest.cpp
index c029922f71..20cd1d11f0 100644
--- a/tests/CodecPartialTest.cpp
+++ b/tests/CodecPartialTest.cpp
@@ -118,9 +118,6 @@ static void test_partial(skiatest::Reporter* r, const char* name, size_t minByte
}
DEF_TEST(Codec_partial, r) {
-#if 0
- // FIXME (scroggo): SkPngCodec needs to use SkStreamBuffer in order to
- // support incremental decoding.
test_partial(r, "plane.png");
test_partial(r, "plane_interlaced.png");
test_partial(r, "yellow_rose.png");
@@ -131,7 +128,7 @@ DEF_TEST(Codec_partial, r) {
test_partial(r, "arrow.png");
test_partial(r, "randPixels.png");
test_partial(r, "baby_tux.png");
-#endif
+
test_partial(r, "box.gif");
test_partial(r, "randPixels.gif", 215);
test_partial(r, "color_wheel.gif");