diff options
author | John Reck <jreck@google.com> | 2013-08-14 14:13:54 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2013-08-14 14:15:06 -0700 |
commit | 6c16fff219e8f733ea14ed7df9edda9c037d4b71 (patch) | |
tree | f27175b14be6cf54c232e6e1f93da3a149534506 /tools/aapt/Images.cpp | |
parent | 9bc25aa8a52a1aa2890d19d2c1a3eedf92b92c36 (diff) | |
download | frameworks_base-6c16fff219e8f733ea14ed7df9edda9c037d4b71.zip frameworks_base-6c16fff219e8f733ea14ed7df9edda9c037d4b71.tar.gz frameworks_base-6c16fff219e8f733ea14ed7df9edda9c037d4b71.tar.bz2 |
Fixes for libpng 1.6
png_set_filler() now fails if the color type doesn't support
a filler (such as RGB_ALPHA)
png_set_unknown_chunk location bug was fixed and now enforces
proper location setting
Change-Id: If3834e3744d9618c308cc442e66d85e9cffcea38
Diffstat (limited to 'tools/aapt/Images.cpp')
-rw-r--r-- | tools/aapt/Images.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp index a842553..b2cbf49 100644 --- a/tools/aapt/Images.cpp +++ b/tools/aapt/Images.cpp @@ -1075,18 +1075,19 @@ static void write_png(const char* imageName, unknowns[b_index].size = chunk_size; } + for (int i = 0; i < chunk_count; i++) { + unknowns[i].location = PNG_HAVE_PLTE; + } png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_ALWAYS, chunk_names, chunk_count); png_set_unknown_chunks(write_ptr, write_info, unknowns, chunk_count); - // XXX I can't get this to work without forcibly changing - // the location to what I want... which apparently is supposed - // to be a private API, but everything else I have tried results - // in the location being set to what I -last- wrote so I never - // get written. :p +#if PNG_LIBPNG_VER < 10600 + /* Deal with unknown chunk location bug in 1.5.x and earlier */ png_set_unknown_chunk_location(write_ptr, write_info, 0, PNG_HAVE_PLTE); if (imageInfo.haveLayoutBounds) { png_set_unknown_chunk_location(write_ptr, write_info, 1, PNG_HAVE_PLTE); } +#endif } @@ -1094,7 +1095,9 @@ static void write_png(const char* imageName, png_bytepp rows; if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_RGB_ALPHA) { - png_set_filler(write_ptr, 0, PNG_FILLER_AFTER); + if (color_type == PNG_COLOR_TYPE_RGB) { + png_set_filler(write_ptr, 0, PNG_FILLER_AFTER); + } rows = imageInfo.rows; } else { rows = outRows; |