aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CodecExactReadTest.cpp
Commit message (Collapse)AuthorAge
* IWYU for some test files starting with 'C'.Gravatar Ben Wagner2018-03-13
| | | | | | | | | Change-Id: Iea274ae52da8b4b87ec55222c856f40a0d88c4e0 Reviewed-on: https://skia-review.googlesource.com/113746 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-on: https://skia-review.googlesource.com/113944 Reviewed-by: Ben Wagner <bungeman@google.com>
* Revert "IWYU for some test files starting with 'C'."Gravatar Ben Wagner2018-03-12
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1a462bd0fe6fb3cd8d7aa7ad1d8290e764ac79e4. Reason for revert: Broke android. Need to run android bot for these. Original change's description: > IWYU for some test files starting with 'C'. > > Change-Id: I9a9596f7a941cdd8f01e055965c70a4b24438499 > Reviewed-on: https://skia-review.googlesource.com/113746 > Reviewed-by: Herb Derby <herb@google.com> > Commit-Queue: Ben Wagner <bungeman@google.com> TBR=bungeman@google.com,herb@google.com Change-Id: Ic63c2fcc7457e442e9b29a9ccd429927e24e3b77 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/113841 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* IWYU for some test files starting with 'C'.Gravatar Ben Wagner2018-03-12
| | | | | | | Change-Id: I9a9596f7a941cdd8f01e055965c70a4b24438499 Reviewed-on: https://skia-review.googlesource.com/113746 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* resources: orgainize directory.Gravatar Hal Canary2017-12-08
| | | | | | | | | Should make it easier to ask just for images. Change-Id: If821743dc924c4bfbc6b2b2d29b14affde7b3afd Reviewed-on: https://skia-review.googlesource.com/82684 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
* use unique_ptr for codec factoriesGravatar Mike Reed2017-07-25
| | | | | | | | | | Will need guards for android (at least) Bug: skia: Change-Id: I2bb8e656997984489ef1f2e41cd3d301c4e7b947 Reviewed-on: https://skia-review.googlesource.com/26040 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
* Improve the Codec_end test and add fixesGravatar Leon Scroggins III2017-04-25
| | | | | | | | | | | | | | | | | | | Better imitate the original Android bug. Create a stream with multiple images in it, and verify that it successfully decodes after decoding once. This exposes a bug in SkPngCodec, which did not work for interlaced images. Test more formats that also happen to succeed: ICO, BMP, and WBMP This explicitly does *not* attempt to fix sampled or subset decodes, which already stopped early when decoding as an optimization. Change-Id: Ib0b8918f14ba3fb0fa31e9c71c8100dcbeeb465f Reviewed-on: https://skia-review.googlesource.com/14104 Reviewed-by: Matt Sarett <msarett@google.com>
* Reland "Make SkPngCodec only read as much of the stream as necessary"Gravatar Leon Scroggins III2017-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Originally uploaded as 13900.) 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). Include a workaround for older versions of libpng (e.g. 1.2 in Google3). In older versions, if the row callback is null when the IDAT header is processed, reading the image will fail. When we see the IDAT, we save the length and process a recreated IDAT header later, after the row callback has been set. Bug: skia:5368 Bug:b/34073812 Test: Existing tests, plus a new test in dm. Change-Id: I293a4ddc013b82669a8b735062228b26d0bce933 Reviewed-on: https://skia-review.googlesource.com/13984 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
* Revert "Make SkPngCodec only read as much of the stream as necessary"Gravatar Leon Scroggins2017-04-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Make SkPngCodec only read as much of the stream as necessaryGravatar Leon Scroggins III2017-04-20
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>