Store ninepatch chunks in the png header in CodexTest
We are making a change in Android to store ninepatch chunks in the
png header. Thus, our ninepatch test should match the Android
framework's use.
https://googleplex-android-review.git.corp.google.com/#/c/832067/
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1553303003
Review URL: https://codereview.chromium.org/1553303003
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 3086a36..6916ba7 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -259,8 +259,9 @@
png_set_read_fn(png_ptr, static_cast<void*>(stream), sk_read_fn);
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
- // FIXME: Does this need to be installed so early?
- // hookup our chunkReader so we can see any user-chunks the caller may be interested in
+ // Hookup our chunkReader so we can see any user-chunks the caller may be interested in.
+ // This needs to be installed before we read the png header. Android may store ninepatch
+ // chunks in the header.
if (chunkReader) {
png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_ALWAYS, (png_byte*)"", 0);
png_set_read_user_chunk_fn(png_ptr, (png_voidp) chunkReader, sk_read_user_chunk);