Bug 1021713 - Update in-tree libpng to version 1.6.13. r=jmuizelaar
authorGlenn Randers-Pehrson <glennrp+bmo@gmail.com>
Fri, 22 Aug 2014 07:11:00 -0400
changeset 216297 d9c0f0fa42dceef2c1135fa47e9fe44af51197a1
parent 216296 0783f33c02707b9a6636a515384b6c57562c9fb5
child 216298 b1223e628e8f6e64f3b045e14dd28602db7a301b
push id6741
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:57:58 +0000
treeherdermozilla-aurora@aed50d3edf33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar
bugs1021713
milestone34.0a1
Bug 1021713 - Update in-tree libpng to version 1.6.13. r=jmuizelaar
configure.in
image/decoders/nsPNGDecoder.cpp
media/libpng/MOZCHANGES
media/libpng/apng.patch
media/libpng/moz.build
media/libpng/mozpngconf.h
media/libpng/png.c
media/libpng/png.h
media/libpng/pngconf.h
media/libpng/pngerror.c
media/libpng/pngget.c
media/libpng/pnglibconf.h
media/libpng/pngpread.c
media/libpng/pngpriv.h
media/libpng/pngread.c
media/libpng/pngrtran.c
media/libpng/pngrutil.c
media/libpng/pngset.c
media/libpng/pngtrans.c
media/libpng/pngwrite.c
media/libpng/pngwutil.c
--- a/configure.in
+++ b/configure.in
@@ -46,17 +46,17 @@ dnl ====================================
 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
 
 dnl Set the version number of the libs included with mozilla
 dnl ========================================================
 MOZJPEG=62
-MOZPNG=10610
+MOZPNG=10613
 NSPR_VERSION=4
 NSPR_MINVER=4.10.3
 NSS_VERSION=3
 
 dnl Set the minimum version of toolkit libs used by mozilla
 dnl ========================================================
 GLIB_VERSION=1.2.0
 PERL_VERSION=5.006
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -267,18 +267,24 @@ nsPNGDecoder::InitInternal()
 #ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
 #ifndef PR_LOGGING
   /* Disallow palette-index checking, for speed; we would ignore the warning
    * anyhow unless we have defined PR_LOGGING.  This feature was added at
    * libpng version 1.5.10 and is disabled in the embedded libpng but enabled
    * by default in the system libpng.  This call also disables it in the
    * system libpng, for decoding speed.  Bug #745202.
    */
-    png_set_check_for_invalid_index(mPNG, 0);
+  png_set_check_for_invalid_index(mPNG, 0);
+#endif
 #endif
+
+#if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_sRGB_PROFILE_CHECKS) && \
+            PNG_sRGB_PROFILE_CHECKS >= 0
+  /* Skip checking of sRGB ICC profiles */
+  png_set_option(mPNG, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);
 #endif
 
   /* use this as libpng "progressive pointer" (retrieve in callbacks) */
   png_set_progressive_read_fn(mPNG, static_cast<png_voidp>(this),
                               nsPNGDecoder::info_callback,
                               nsPNGDecoder::row_callback,
                               nsPNGDecoder::end_callback);
 
--- a/media/libpng/MOZCHANGES
+++ b/media/libpng/MOZCHANGES
@@ -1,11 +1,14 @@
 
 Changes made to pristine libpng source by mozilla.org developers.
 
+2014/08/21  -- Synced with libpng-1.6.13 (bug #1021713).
+               Renamed mozpngconf.h to pnglibconf.h.
+
 2014/03/21  -- Synced with libpng-1.6.10 (bug #980488) and disabled
                PNG_WARNINGS and PNG_ERROR_TEXT in non-debug builds.
                Limit image dimensions to 32767 (bug #251381, #591822,
                and #967656).
 
 2014/03/04  -- Enabled PNG_WARNINGS and other stuff in mozpngconf.h
                as part of enabling Freetype2 with PNG (bug #969814).
 
--- a/media/libpng/apng.patch
+++ b/media/libpng/apng.patch
@@ -102,17 +102,17 @@ Index: pngread.c
 +
  /* Optional call to update the users info_ptr structure */
  void PNGAPI
  png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
 Index: pngget.c
 ===================================================================
 --- pngget.c
 +++ pngget.c
-@@ -1174,4 +1174,166 @@
+@@ -1195,4 +1195,166 @@
  #  endif
  #endif
  
 +#ifdef PNG_APNG_SUPPORTED
 +png_uint_32 PNGAPI
 +png_get_acTL(png_structp png_ptr, png_infop info_ptr,
 +             png_uint_32 *num_frames, png_uint_32 *num_plays)
 +{
@@ -273,28 +273,28 @@ Index: pngget.c
 +    return 0;
 +}
 +#endif /* PNG_APNG_SUPPORTED */
  #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
 Index: png.h
 ===================================================================
 --- png.h
 +++ png.h
-@@ -457,6 +457,10 @@
+@@ -467,6 +467,10 @@
  #   include "pnglibconf.h"
  #endif
  
 +#define PNG_APNG_SUPPORTED
 +#define PNG_READ_APNG_SUPPORTED
 +#define PNG_WRITE_APNG_SUPPORTED
 +
  #ifndef PNG_VERSION_INFO_ONLY
     /* Machine specific configuration. */
  #  include "pngconf.h"
-@@ -547,6 +551,17 @@
+@@ -557,6 +561,17 @@
   * See pngconf.h for base types that vary by machine/system
   */
  
 +#ifdef PNG_APNG_SUPPORTED
 +/* dispose_op flags from inside fcTL */
 +#define PNG_DISPOSE_OP_NONE        0x00
 +#define PNG_DISPOSE_OP_BACKGROUND  0x01
 +#define PNG_DISPOSE_OP_PREVIOUS    0x02
@@ -302,40 +302,40 @@ Index: png.h
 +/* blend_op flags from inside fcTL */
 +#define PNG_BLEND_OP_SOURCE        0x00
 +#define PNG_BLEND_OP_OVER          0x01
 +#endif /* PNG_APNG_SUPPORTED */
 +
  /* This triggers a compiler error in png.c, if png.c and png.h
   * do not agree upon the version number.
   */
-@@ -867,6 +882,10 @@
+@@ -877,6 +892,10 @@
  #define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */
  #define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */
  #define PNG_INFO_IDAT 0x8000   /* ESR, 1.0.6 */
 +#ifdef PNG_APNG_SUPPORTED
 +#define PNG_INFO_acTL 0x10000
 +#define PNG_INFO_fcTL 0x20000
 +#endif
  
  /* This is used for the transformation routines, as some of them
   * change these values for the row.  It also should enable using
-@@ -904,6 +923,10 @@
+@@ -914,6 +933,10 @@
  #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
  typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
 +#ifdef PNG_APNG_SUPPORTED
 +typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp,
 +    png_uint_32));
 +#endif
  
  /* The following callback receives png_uint_32 row_number, int pass for the
   * png_bytep data of the row.  When transforming an interlaced image the
-@@ -3241,6 +3264,75 @@
-  *  END OF HARDWARE OPTIONS
+@@ -3250,6 +3273,75 @@
+  *  END OF HARDWARE AND SOFTWARE OPTIONS
   ******************************************************************************/
  
 +#ifdef PNG_APNG_SUPPORTED
 +PNG_EXPORT(245, png_uint_32, png_get_acTL, (png_structp png_ptr,
 +   png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
 +
 +PNG_EXPORT(246, png_uint_32, png_set_acTL, (png_structp png_ptr,
 +   png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
@@ -400,61 +400,61 @@ Index: png.h
 +PNG_EXPORT(264, void, png_write_frame_tail, (png_structp png_ptr,
 +   png_infop info_ptr));
 +#endif /* PNG_WRITE_APNG_SUPPORTED */
 +#endif /* PNG_APNG_SUPPORTED */
 +
  /* Maintainer: Put new public prototypes here ^, in libpng.3, and project
   * defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt
   */
-@@ -3250,7 +3342,11 @@
+@@ -3259,7 +3351,11 @@
   * scripts/symbols.def as well.
   */
  #ifdef PNG_EXPORT_LAST_ORDINAL
 +#ifdef PNG_APNG_SUPPORTED
 +  PNG_EXPORT_LAST_ORDINAL(264);
 +#else
    PNG_EXPORT_LAST_ORDINAL(244);
 +#endif /* PNG_APNG_SUPPORTED */
  #endif
  
  #ifdef __cplusplus
 Index: pngpriv.h
 ===================================================================
 --- pngpriv.h
 +++ pngpriv.h
-@@ -551,6 +551,10 @@
+@@ -555,6 +555,10 @@
  #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
                     /*             0x4000 (unused) */
  #define PNG_IS_READ_STRUCT        0x8000 /* Else is a write struct */
 +#ifdef PNG_APNG_SUPPORTED
 +#define PNG_HAVE_acTL            0x10000
 +#define PNG_HAVE_fcTL            0x20000
 +#endif
  
  /* Flags for the transformations the PNG library does on the image data */
  #define PNG_BGR                 0x0001
-@@ -772,6 +776,16 @@
+@@ -776,6 +780,16 @@
  #define png_tRNS PNG_U32(116,  82,  78,  83)
  #define png_zTXt PNG_U32(122,  84,  88, 116)
  
 +#ifdef PNG_APNG_SUPPORTED
 +#define png_acTL PNG_U32( 97,  99,  84,  76)
 +#define png_fcTL PNG_U32(102,  99,  84,  76)
 +#define png_fdAT PNG_U32(102, 100,  65,  84)
 +
 +/* For png_struct.apng_flags: */
 +#define PNG_FIRST_FRAME_HIDDEN       0x0001
 +#define PNG_APNG_APP                 0x0002
 +#endif
 +
  /* The following will work on (signed char*) strings, whereas the get_uint_32
   * macro will fail on top-bit-set values because of the sign extension.
   */
-@@ -1452,6 +1466,49 @@
+@@ -1456,6 +1470,49 @@
  
  #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  
 +#ifdef PNG_APNG_SUPPORTED
 +PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
 +   png_uint_32 width, png_uint_32 height,
 +   png_uint_32 x_offset, png_uint_32 y_offset,
 +   png_uint_16 delay_num, png_uint_16 delay_den,
@@ -576,17 +576,17 @@ Index: pngwrite.c
 +#ifdef PNG_WRITE_APNG_SUPPORTED
 +   if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
 +      png_error(png_ptr, "Not enough frames written");
 +#endif
 +
  #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
     if (png_ptr->num_palette_max > png_ptr->num_palette)
        png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
-@@ -2433,4 +2442,42 @@
+@@ -2434,4 +2443,42 @@
  }
  #endif /* PNG_STDIO_SUPPORTED */
  #endif /* SIMPLIFIED_WRITE */
 +
 +#ifdef PNG_WRITE_APNG_SUPPORTED
 +void PNGAPI
 +png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
 +    png_bytepp row_pointers, png_uint_32 width, png_uint_32 height,
@@ -867,17 +867,17 @@ Index: pngpread.c
 +     png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
 +     return;
 +   }
 +#endif
 +
     /* This routine must process all the data it has been given
      * before returning, calling the row callback as required to
      * handle the uncompressed results.
-@@ -1281,6 +1471,18 @@
+@@ -1275,6 +1465,18 @@
     png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
  }
  
 +#ifdef PNG_READ_APNG_SUPPORTED
 +void PNGAPI
 +png_set_progressive_frame_fn(png_structp png_ptr,
 +   png_progressive_frame_ptr frame_info_fn,
 +   png_progressive_frame_ptr frame_end_fn)
@@ -1303,17 +1303,17 @@ Index: pngrutil.c
           png_ptr->mode |= PNG_AFTER_IDAT;
           png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
 +#ifdef PNG_READ_APNG_SUPPORTED
 +         png_ptr->num_frames_read++;
 +#endif
  
           if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
              png_chunk_benign_error(png_ptr, "Extra compressed data");
-@@ -4474,4 +4688,80 @@
+@@ -4466,4 +4680,80 @@
  
     png_ptr->flags |= PNG_FLAG_ROW_INIT;
  }
 +
 +#ifdef PNG_READ_APNG_SUPPORTED
 +/* This function is to be called after the main IDAT set has been read and
 + * before a new IDAT is read. It resets some parts of png_ptr
 + * to make them usable by the read functions again */
@@ -1397,17 +1397,17 @@ Index: pngwutil.c
     /* Write the chunk */
     png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
  
 +#ifdef PNG_WRITE_APNG_SUPPORTED
 +   png_ptr->first_frame_width = width;
 +   png_ptr->first_frame_height = height;
 +#endif
 +
-    if (!(png_ptr->do_filter))
+    if ((png_ptr->do_filter) == PNG_NO_FILTERS)
     {
        if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
 @@ -1076,7 +1081,15 @@
                 optimize_cmf(data, png_image_size(png_ptr));
  #        endif
  
 +#        ifdef PNG_WRITE_APNG_SUPPORTED
 +         if (png_ptr->num_frames_written == 0)
@@ -1432,17 +1432,17 @@ Index: pngwutil.c
 +#        ifdef PNG_WRITE_APNG_SUPPORTED
 +         else
 +            png_write_fdAT(png_ptr, data, size);
 +#        endif /* PNG_WRITE_APNG_SUPPORTED */
 +
           png_ptr->zstream.avail_out = 0;
           png_ptr->zstream.next_out = NULL;
           png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
-@@ -1934,6 +1955,82 @@
+@@ -1936,6 +1957,82 @@
  }
  #endif
  
 +#ifdef PNG_WRITE_APNG_SUPPORTED
 +void /* PRIVATE */
 +png_write_acTL(png_structp png_ptr,
 +    png_uint_32 num_frames, png_uint_32 num_plays)
 +{
@@ -1515,17 +1515,17 @@ Index: pngwutil.c
 +
 +    png_ptr->next_seq_num++;
 +}
 +#endif /* PNG_WRITE_APNG_SUPPORTED */
 +
  /* Initializes the row writing capability of libpng */
  void /* PRIVATE */
  png_write_start_row(png_structrp png_ptr)
-@@ -3021,4 +3118,39 @@
+@@ -3023,4 +3120,39 @@
     }
  #endif
  }
 +
 +#ifdef PNG_WRITE_APNG_SUPPORTED
 +void /* PRIVATE */
 +png_write_reset(png_structp png_ptr)
 +{
--- a/media/libpng/moz.build
+++ b/media/libpng/moz.build
@@ -1,18 +1,18 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 EXPORTS += [
-    'mozpngconf.h',
     'png.h',
-    'pngconf.h'
+    'pngconf.h',
+    'pnglibconf.h'
 ]
 
 UNIFIED_SOURCES += [
     'png.c',
     'pngerror.c',
     'pngget.c',
     'pngmem.c',
     'pngpread.c',
deleted file mode 100644
--- a/media/libpng/mozpngconf.h
+++ /dev/null
@@ -1,683 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZPNGCONF_H
-#define MOZPNGCONF_H
-#define PNGLCONF_H /* So we don't try to use libpng's pnglibconf.h */
-
-/* limit image dimensions (bug #251381, #591822, and #967656) */
-#ifndef MOZ_PNG_MAX_DIMENSION
-# define MOZ_PNG_MAX_DIMENSION 32767
-#endif
-
-#define PNG_API_RULE 0
-#define PNG_COST_SHIFT 3
-#define PNG_GAMMA_THRESHOLD_FIXED 5000
-#define PNG_MAX_GAMMA_8 11
-#define PNG_USER_CHUNK_CACHE_MAX 128
-#define PNG_USER_CHUNK_MALLOC_MAX 4000000L
-#define PNG_USER_HEIGHT_MAX MOZ_PNG_MAX_DIMENSION
-#define PNG_USER_WIDTH_MAX MOZ_PNG_MAX_DIMENSION
-#define PNG_WEIGHT_SHIFT 8
-#define PNG_ZBUF_SIZE 8192
-#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
-#define PNG_INFLATE_BUF_SIZE 1024
-#define PNG_Z_DEFAULT_COMPRESSION (-1)
-#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
-#define PNG_Z_DEFAULT_STRATEGY 1
-
-#ifdef _MSC_VER
-/* The PNG_PEDANTIC_WARNINGS (attributes) fail to build with some MSC
- * compilers; we'll play it safe and disable them for all MSC compilers.
- */
-#define PNG_NO_PEDANTIC_WARNINGS
-#endif
-
-#undef PNG_ARM_NEON_OPT /* This may have been defined in pngpriv.h */
-#ifdef __ARM_NEON__
-#  ifdef MOZ_PNG_HAVE_ARM_NEON
-#    ifdef MOZ_PNG_HAVE_ARM_NEON_CHECK
-#      define PNG_ARM_NEON_CHECK_SUPPORTED
-#      define PNG_ARM_NEON_OPT 1
-#    else
-#      define PNG_ARM_NEON_OPT 2
-#    endif
-#    define PNG_ALIGNED_MEMORY_SUPPORTED
-     /* Accept the PNG_ARM_NEON_IMPLEMENTATION setting from pngpriv.h. */
-#  else
-#    define PNG_ARM_NEON_OPT 0
-#  endif
-#else
-#  define PNG_ARM_NEON_OPT 0
-#endif
-
-#define PNG_READ_SUPPORTED
-#define PNG_PROGRESSIVE_READ_SUPPORTED
-#define PNG_READ_APNG_SUPPORTED
-#define PNG_READ_cHRM_SUPPORTED
-#define PNG_READ_gAMA_SUPPORTED
-#define PNG_READ_iCCP_SUPPORTED
-#define PNG_READ_sRGB_SUPPORTED
-#define PNG_READ_tRNS_SUPPORTED
-#define PNG_READ_16BIT_SUPPORTED
-#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
-#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
-#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
-#define PNG_READ_EXPAND_SUPPORTED
-#define PNG_READ_GAMMA_SUPPORTED
-#define PNG_READ_GRAY_TO_RGB_SUPPORTED
-#define PNG_READ_INTERLACING_SUPPORTED
-#define PNG_READ_SCALE_16_TO_8_SUPPORTED
-#define PNG_READ_TRANSFORMS_SUPPORTED
-
-/* necessary for freetype color bitmap support (Android & B2G)
-   and boot animation code (Gonk) */
-#if defined(ANDROID) || defined(FT_CONFIG_OPTION_USE_PNG)
-#define PNG_READ_PACK_SUPPORTED
-#define PNG_READ_FILLER_SUPPORTED
-#define PNG_READ_STRIP_16_TO_8_SUPPORTED
-#define PNG_READ_USER_TRANSFORM_SUPPORTED
-#define PNG_SEQUENTIAL_READ_SUPPORTED
-#endif
-
-/* necessary for boot animation code (Gonk) */
-#ifdef MOZ_WIDGET_GONK
-#define PNG_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-#define PNG_EASY_ACCESS_SUPPORTED
-#define PNG_READ_BGR_SUPPORTED
-#define PNG_READ_GRAY_TO_RGB_SUPPORTED
-#define PNG_READ_STRIP_ALPHA_SUPPORTED
-#endif
-
-#define PNG_WRITE_SUPPORTED
-#define PNG_WRITE_APNG_SUPPORTED
-#define PNG_WRITE_tRNS_SUPPORTED
-#define PNG_WRITE_16BIT_SUPPORTED
-#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
-#define PNG_WRITE_FLUSH_SUPPORTED
-#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
-#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
-
-#define PNG_APNG_SUPPORTED
-#define PNG_ALLOW_BENIGN_ERRORS
-#define PNG_BENIGN_ERRORS_SUPPORTED
-#define PNG_BENIGN_READ_ERRORS_SUPPORTED
-#define PNG_cHRM_SUPPORTED
-#define PNG_COLORSPACE_SUPPORTED
-#define PNG_gAMA_SUPPORTED
-#define PNG_GAMMA_SUPPORTED
-#define PNG_iCCP_SUPPORTED
-#define PNG_sRGB_SUPPORTED
-#define PNG_tRNS_SUPPORTED
-#define PNG_16BIT_SUPPORTED
-#define PNG_CHECK_cHRM_SUPPORTED
-#define PNG_FLOATING_ARITHMETIC_SUPPORTED
-#define PNG_FLOATING_POINT_SUPPORTED
-#define PNG_POINTER_INDEXING_SUPPORTED
-#define PNG_SETJMP_SUPPORTED
-#define PNG_STDIO_SUPPORTED
-#define PNG_TEXT_SUPPORTED
-
-#ifdef PR_LOGGING
-#define PNG_ERROR_TEXT_SUPPORTED
-#define PNG_WARNINGS_SUPPORTED
-#endif
-
-/* Mangle names of exported libpng functions so different libpng versions
-   can coexist. It is recommended that if you do this, you give your
-   library a different name such as "mozlibpng" instead of "libpng". */
-
-/* The following has been present since libpng-0.88, has never changed, and
-   is unaffected by conditional compilation macros.  It will not be mangled
-   and it is the only choice for use in configure scripts for detecting the
-   presence of any libpng version since 0.88.
-
-   png_get_io_ptr
-*/
-
-/* Mozilla: mangle it anyway. */
-#define png_get_io_ptr                  MOZ_PNG_get_io_ptr
-
-/* The following weren't present in libpng-0.88 but have never changed since
-   they were first introduced and are not affected by any conditional compile
-   choices and therefore don't need to be mangled.  We'll mangle them anyway. */
-#define png_sig_cmp                     MOZ_PNG_sig_cmp
-#define png_access_version_number       MOZ_PNG_access_vn
-
-/* These have never changed since they were first introduced but they
-   make direct reference to members of png_ptr that might have been moved,
-   so they will be mangled. */
-
-#define png_set_sig_bytes               MOZ_PNG_set_sig_b
-#define png_reset_zstream               MOZ_PNG_reset_zs
-
-/* The following may have changed, or can be affected by conditional compilation
-   choices, and will be mangled. */
-#define png_64bit_product               MOZ_PNG_64bit_product
-#define png_build_gamma_table           MOZ_PNG_build_gamma_tab
-#define png_build_grayscale_palette     MOZ_PNG_build_g_p
-#define png_calculate_crc               MOZ_PNG_calc_crc
-#define png_calloc                      MOZ_PNG_calloc
-#define png_check_cHRM_fixed            MOZ_PNG_ck_cHRM_fixed
-#define png_check_chunk_name            MOZ_PNG_ck_chunk_name
-#define png_check_IHDR                  MOZ_PNG_ck_IHDR
-#define png_check_keyword               MOZ_PNG_ck_keyword
-#define png_combine_row                 MOZ_PNG_combine_row
-#define png_convert_from_struct_tm      MOZ_PNG_cv_from_struct_tm
-#define png_convert_from_time_t         MOZ_PNG_cv_from_time_t
-#define png_convert_to_rfc1123          MOZ_PNG_cv_to_rfc1123
-#define png_correct_palette             MOZ_PNG_correct_palette
-#define png_crc_error                   MOZ_PNG_crc_error
-#define png_crc_finish                  MOZ_PNG_crc_finish
-#define png_crc_read                    MOZ_PNG_crc_read
-#define png_create_info_struct          MOZ_PNG_cr_info_str
-#define png_create_read_struct          MOZ_PNG_cr_read_str
-#define png_create_read_struct_2        MOZ_PNG_cr_read_str_2
-#define png_create_struct               MOZ_PNG_create_st
-#define png_create_struct_2             MOZ_PNG_create_s2
-#define png_create_write_struct         MOZ_PNG_cr_write_str
-#define png_create_write_struct_2       MOZ_PNG_cr_write_str_2
-#define png_data_freer                  MOZ_PNG_data_freer
-#define png_decompress_chunk            MOZ_PNG_decomp_chunk
-#define png_default_error               MOZ_PNG_def_error
-#define png_default_flush               MOZ_PNG_def_flush
-#define png_default_read_data           MOZ_PNG_def_read_data
-#define png_default_warning             MOZ_PNG_def_warning
-#define png_default_write_data          MOZ_PNG_default_write_data
-#define png_destroy_info_struct         MOZ_PNG_dest_info_str
-#define png_destroy_read_struct         MOZ_PNG_dest_read_str
-#define png_destroy_struct              MOZ_PNG_dest_str
-#define png_destroy_struct_2            MOZ_PNG_dest_str_2
-#define png_destroy_write_struct        MOZ_PNG_dest_write_str
-#define png_digit                       MOZ_PNG_digit
-#define png_do_bgr                      MOZ_PNG_do_bgr
-#define png_do_chop                     MOZ_PNG_do_chop
-#define png_do_expand                   MOZ_PNG_do_expand
-#define png_do_expand_palette           MOZ_PNG_do_expand_plte
-#define png_do_gamma                    MOZ_PNG_do_gamma
-#define png_do_gray_to_rgb              MOZ_PNG_do_g_to_rgb
-#define png_do_invert                   MOZ_PNG_do_invert
-#define png_do_packswap                 MOZ_PNG_do_packswap
-#define png_do_read_filler              MOZ_PNG_do_read_fill
-#define png_do_read_interlace           MOZ_PNG_do_read_int
-#define png_do_read_intrapixel          MOZ_PNG_do_read_intra
-#define png_do_read_invert_alpha        MOZ_PNG_do_read_inv_alph
-#define png_do_read_swap_alpha          MOZ_PNG_do_read_swap_alph
-#define png_do_read_transformations     MOZ_PNG_do_read_trans
-#define png_do_rgb_to_gray              MOZ_PNG_do_rgb_to_g
-#define png_do_shift                    MOZ_PNG_do_shift
-#define png_do_swap                     MOZ_PNG_do_swap
-#define png_do_unpack                   MOZ_PNG_do_unpack
-#define png_do_unshift                  MOZ_PNG_do_unshift
-#define png_do_write_interlace          MOZ_PNG_do_write_interlace
-#define png_do_write_intrapixel         MOZ_PNG_do_write_intrapixel
-#define png_do_write_invert_alpha       MOZ_PNG_do_write_invert_alpha
-#define png_do_write_swap_alpha         MOZ_PNG_do_write_swap_alpha
-#define png_do_write_transformations    MOZ_PNG_do_write_trans
-#define png_err                         MOZ_PNG_err
-#define png_far_to_near                 MOZ_PNG_far_to_near
-#define png_fixed                       MOZ_PNG_fixed
-#define png_flush                       MOZ_PNG_flush
-#define png_format_buffer               MOZ_PNG_format_buf
-#define png_free                        MOZ_PNG_free
-#define png_free_data                   MOZ_PNG_free_data
-#define png_free_default                MOZ_PNG_free_def
-#define png_get_bit_depth               MOZ_PNG_get_bit_depth
-#define png_get_bKGD                    MOZ_PNG_get_bKGD
-#define png_get_channels                MOZ_PNG_get_channels
-#define png_get_cHRM                    MOZ_PNG_get_cHRM
-#define png_get_cHRM_fixed              MOZ_PNG_get_cHRM_fixed
-#define png_get_color_type              MOZ_PNG_get_color_type
-#define png_get_compression_buffer_size MOZ_PNG_get_comp_buf_siz
-#define png_get_compression_type        MOZ_PNG_get_comp_type
-#define png_get_copyright               MOZ_PNG_get_copyright
-#define png_get_error_ptr               MOZ_PNG_get_error_ptr
-#define png_get_filter_type             MOZ_PNG_get_filter_type
-#define png_get_gAMA                    MOZ_PNG_get_gAMA
-#define png_get_gAMA_fixed              MOZ_PNG_get_gAMA_fixed
-#define png_get_header_ver              MOZ_PNG_get_hdr_ver
-#define png_get_header_version          MOZ_PNG_get_hdr_vn
-#define png_get_hIST                    MOZ_PNG_get_hIST
-#define png_get_iCCP                    MOZ_PNG_get_iCCP
-#define png_get_IHDR                    MOZ_PNG_get_IHDR
-#define png_get_image_height            MOZ_PNG_get_image_h
-#define png_get_image_width             MOZ_PNG_get_image_w
-#define png_get_interlace_type          MOZ_PNG_get_interlace_type
-#define png_get_libpng_ver              MOZ_PNG_get_libpng_ver
-#define png_get_mem_ptr                 MOZ_PNG_get_mem_ptr
-#define png_get_oFFs                    MOZ_PNG_get_oFFs
-#define png_get_pCAL                    MOZ_PNG_get_pCAL
-#define png_get_pHYs                    MOZ_PNG_get_pHYs
-#define png_get_pHYs_dpi                MOZ_PNG_get_pHYs_dpi
-#define png_get_pixel_aspect_ratio      MOZ_PNG_get_pixel_aspect_ratio
-#define png_get_pixels_per_inch         MOZ_PNG_get_pixels_per_inch
-#define png_get_pixels_per_meter        MOZ_PNG_get_pixels_p_m
-#define png_get_PLTE                    MOZ_PNG_get_PLTE
-#define png_get_progressive_ptr         MOZ_PNG_get_progressive_ptr
-#define png_get_rgb_to_gray_status      MOZ_PNG_get_rgb_to_gray_status
-#define png_get_rowbytes                MOZ_PNG_get_rowbytes
-#define png_get_rows                    MOZ_PNG_get_rows
-#define png_get_sBIT                    MOZ_PNG_get_sBIT
-#define png_get_sCAL                    MOZ_PNG_get_sCAL
-#define png_get_sCAL_s                  MOZ_PNG_get_sCAL_s
-#define png_get_signature               MOZ_PNG_get_signature
-#define png_get_sPLT                    MOZ_PNG_get_sPLT
-#define png_get_sRGB                    MOZ_PNG_get_sRGB
-#define png_get_text                    MOZ_PNG_get_text
-#define png_get_tIME                    MOZ_PNG_get_tIME
-#define png_get_tRNS                    MOZ_PNG_get_tRNS
-#define png_get_unknown_chunks          MOZ_PNG_get_unk_chunks
-#define png_get_user_chunk_ptr          MOZ_PNG_get_user_chunk_ptr
-#define png_get_user_height_max         MOZ_PNG_get_user_height_max
-#define png_get_user_transform_ptr      MOZ_PNG_get_user_transform_ptr
-#define png_get_user_width_max          MOZ_PNG_get_user_width_max
-#define png_get_valid                   MOZ_PNG_get_valid
-#define png_get_x_offset_inches         MOZ_PNG_get_x_offset_inches
-#define png_get_x_offset_microns        MOZ_PNG_get_x_offs_microns
-#define png_get_x_offset_pixels         MOZ_PNG_get_x_offs_pixels
-#define png_get_x_pixels_per_inch       MOZ_PNG_get_x_pixels_per_inch
-#define png_get_x_pixels_per_meter      MOZ_PNG_get_x_pix_per_meter
-#define png_get_y_offset_inches         MOZ_PNG_get_y_offset_inches
-#define png_get_y_offset_microns        MOZ_PNG_get_y_offs_microns
-#define png_get_y_offset_pixels         MOZ_PNG_get_y_offs_pixels
-#define png_get_y_pixels_per_inch       MOZ_PNG_get_y_pixels_per_inch
-#define png_get_y_pixels_per_meter      MOZ_PNG_get_y_pix_per_meter
-#define png_handle_as_unknown           MOZ_PNG_handle_as_unknown
-#define png_handle_bKGD                 MOZ_PNG_handle_bKGD
-#define png_handle_cHRM                 MOZ_PNG_handle_cHRM
-#define png_handle_gAMA                 MOZ_PNG_handle_gAMA
-#define png_handle_hIST                 MOZ_PNG_handle_hIST
-#define png_handle_iCCP                 MOZ_PNG_handle_iCCP
-#define png_handle_IEND                 MOZ_PNG_handle_IEND
-#define png_handle_IHDR                 MOZ_PNG_handle_IHDR
-#define png_handle_iTXt                 MOZ_PNG_handle_iTXt
-#define png_handle_oFFs                 MOZ_PNG_handle_oFFs
-#define png_handle_pCAL                 MOZ_PNG_handle_pCAL
-#define png_handle_pHYs                 MOZ_PNG_handle_pHYs
-#define png_handle_PLTE                 MOZ_PNG_handle_PLTE
-#define png_handle_sBIT                 MOZ_PNG_handle_sBIT
-#define png_handle_sCAL                 MOZ_PNG_handle_sCAL
-#define png_handle_sPLT                 MOZ_PNG_handle_sPLT
-#define png_handle_sRGB                 MOZ_PNG_handle_sRGB
-#define png_handle_tEXt                 MOZ_PNG_handle_tEXt
-#define png_handle_tIME                 MOZ_PNG_handle_tIME
-#define png_handle_tRNS                 MOZ_PNG_handle_tRNS
-#define png_handle_unknown              MOZ_PNG_handle_unknown
-#define png_handle_zTXt                 MOZ_PNG_handle_zTXt
-#define png_inflate                     MOZ_PNG_inflate
-#define png_info_destroy                MOZ_PNG_info_dest
-#define png_info_init_3                 MOZ_PNG_info_init_3
-#define png_init_io                     MOZ_PNG_init_io
-#define png_init_read_transformations   MOZ_PNG_init_read_transf
-#define png_malloc                      MOZ_PNG_malloc
-#define png_malloc_default              MOZ_PNG_malloc_default
-#define png_malloc_warn                 MOZ_PNG_malloc_warn
-#define png_permit_mng_features         MOZ_PNG_permit_mng_features
-#define png_process_data                MOZ_PNG_process_data
-#define png_process_IDAT_data           MOZ_PNG_proc_IDAT_data
-#define png_process_some_data           MOZ_PNG_proc_some_data
-#define png_progressive_combine_row     MOZ_PNG_progressive_combine_row
-#define png_push_check_crc              MOZ_PNG_push_check_crc
-#define png_push_crc_finish             MOZ_PNG_push_crc_finish
-#define png_push_crc_skip               MOZ_PNG_push_crc_skip
-#define png_push_fill_buffer            MOZ_PNG_push_fill_buffer
-#define png_push_handle_iTXt            MOZ_PNG_push_handle_iTXt
-#define png_push_handle_tEXt            MOZ_PNG_push_handle_tEXt
-#define png_push_handle_unknown         MOZ_PNG_push_handle_unk
-#define png_push_handle_zTXt            MOZ_PNG_push_handle_ztXt
-#define png_push_have_end               MOZ_PNG_push_have_end
-#define png_push_have_info              MOZ_PNG_push_have_info
-#define png_push_have_row               MOZ_PNG_push_have_row
-#define png_push_process_row            MOZ_PNG_push_proc_row
-#define png_push_read_chunk             MOZ_PNG_push_read_chunk
-#define png_push_read_end               MOZ_PNG_push_read_end
-#define png_push_read_IDAT              MOZ_PNG_push_read_IDAT
-#define png_push_read_iTXt              MOZ_PNG_push_read_iTXt
-#define png_push_read_sig               MOZ_PNG_push_read_sig
-#define png_push_read_tEXt              MOZ_PNG_push_read_tEXt
-#define png_push_read_zTXt              MOZ_PNG_push_read_zTXt
-#define png_push_restore_buffer         MOZ_PNG_push_rest_buf
-#define png_push_save_buffer            MOZ_PNG_push_save_buf
-#define png_read_chunk_header           MOZ_PNG_read_chunk_header
-#define png_read_data                   MOZ_PNG_read_data
-#define png_read_destroy                MOZ_PNG_read_dest
-#define png_read_end                    MOZ_PNG_read_end
-#define png_read_filter_row             MOZ_PNG_read_filt_row
-#define png_read_finish_row             MOZ_PNG_read_finish_row
-#define png_read_image                  MOZ_PNG_read_image
-#define png_read_info                   MOZ_PNG_read_info
-#define png_read_png                    MOZ_PNG_read_png
-#define png_read_push_finish_row        MOZ_PNG_read_push_finish_row
-#define png_read_row                    MOZ_PNG_read_row
-#define png_read_rows                   MOZ_PNG_read_rows
-#define png_read_start_row              MOZ_PNG_read_start_row
-#define png_read_transform_info         MOZ_PNG_read_transform_info
-#define png_read_update_info            MOZ_PNG_read_update_info
-#define png_reset_crc                   MOZ_PNG_reset_crc
-#define png_save_int_32                 MOZ_PNG_save_int_32
-#define png_save_uint_16                MOZ_PNG_save_uint_16
-#define png_save_uint_32                MOZ_PNG_save_uint_32
-#define png_set_add_alpha               MOZ_PNG_set_add_alpha
-#define png_set_background              MOZ_PNG_set_background
-#define png_set_benign_errors           MOZ_PNG_set_benign_errors
-#define png_set_bgr                     MOZ_PNG_set_bgr
-#define png_set_bKGD                    MOZ_PNG_set_bKGD
-#define png_set_cHRM                    MOZ_PNG_set_cHRM
-#define png_set_cHRM_fixed              MOZ_PNG_set_cHRM_fixed
-#define png_set_compression_buffer_size MOZ_PNG_set_comp_buf_siz
-#define png_set_compression_level       MOZ_PNG_set_comp_level
-#define png_set_compression_mem_level   MOZ_PNG_set_comp_mem_lev
-#define png_set_compression_method      MOZ_PNG_set_comp_method
-#define png_set_compression_strategy    MOZ_PNG_set_comp_strategy
-#define png_set_compression_window_bits MOZ_PNG_set_comp_win_bits
-#define png_set_crc_action              MOZ_PNG_set_crc_action
-#define png_set_error_fn                MOZ_PNG_set_error_fn
-#define png_set_expand                  MOZ_PNG_set_expand
-#define png_set_expand_gray_1_2_4_to_8  MOZ_PNG_set_x_g_124_to_8
-#define png_set_filler                  MOZ_PNG_set_filler
-#define png_set_filter                  MOZ_PNG_set_filter
-#define png_set_filter_heuristics       MOZ_PNG_set_filter_heur
-#define png_set_flush                   MOZ_PNG_set_flush
-#define png_set_gAMA                    MOZ_PNG_set_gAMA
-#define png_set_gAMA_fixed              MOZ_PNG_set_gAMA_fixed
-#define png_set_gamma                   MOZ_PNG_set_gamma
-#define png_set_gray_to_rgb             MOZ_PNG_set_gray_to_rgb
-#define png_set_hIST                    MOZ_PNG_set_hIST
-#define png_set_iCCP                    MOZ_PNG_set_iCCP
-#define png_set_IHDR                    MOZ_PNG_set_IHDR
-#define png_set_interlace_handling      MOZ_PNG_set_interlace_handling
-#define png_set_invalid                 MOZ_PNG_set_invalid
-#define png_set_invert_alpha            MOZ_PNG_set_invert_alpha
-#define png_set_invert_mono             MOZ_PNG_set_invert_mono
-#define png_set_keep_unknown_chunks     MOZ_PNG_set_keep_unknown_chunks
-#define png_set_mem_fn                  MOZ_PNG_set_mem_fn
-#define png_set_oFFs                    MOZ_PNG_set_oFFs
-#define png_set_packing                 MOZ_PNG_set_packing
-#define png_set_packswap                MOZ_PNG_set_packswap
-#define png_set_palette_to_rgb          MOZ_PNG_set_palette_to_rgb
-#define png_set_pCAL                    MOZ_PNG_set_pCAL
-#define png_set_pHYs                    MOZ_PNG_set_pHYs
-#define png_set_PLTE                    MOZ_PNG_set_PLTE
-#define png_set_progressive_read_fn     MOZ_PNG_set_progressive_read_fn
-#define png_set_read_fn                 MOZ_PNG_set_read_fn
-#define png_set_read_status_fn          MOZ_PNG_set_read_status_fn
-#define png_set_read_user_chunk_fn      MOZ_PNG_set_read_user_chunk_fn
-#define png_set_read_user_transform_fn  MOZ_PNG_set_read_user_trans_fn
-#define png_set_rgb_to_gray             MOZ_PNG_set_rgb_to_gray
-#define png_set_rgb_to_gray_fixed       MOZ_PNG_set_rgb_to_gray_fixed
-#define png_set_rows                    MOZ_PNG_set_rows
-#define png_set_sBIT                    MOZ_PNG_set_sBIT
-#define png_set_sCAL                    MOZ_PNG_set_sCAL
-#define png_set_sCAL_s                  MOZ_PNG_set_sCAL_s
-#define png_set_shift                   MOZ_PNG_set_shift
-#define png_set_sPLT                    MOZ_PNG_set_sPLT
-#define png_set_sRGB                    MOZ_PNG_set_sRGB
-#define png_set_sRGB_gAMA_and_cHRM      MOZ_PNG_set_sRGB_gAMA_and_cHRM
-#define png_set_strip_16                MOZ_PNG_set_strip_16
-#define png_set_strip_alpha             MOZ_PNG_set_strip_alpha
-#define png_set_strip_error_numbers     MOZ_PNG_set_strip_err_nums
-#define png_set_swap                    MOZ_PNG_set_swap
-#define png_set_swap_alpha              MOZ_PNG_set_swap_alpha
-#define png_set_text                    MOZ_PNG_set_text
-#define png_set_text_2                  MOZ_PNG_set_text_2
-#define png_set_tIME                    MOZ_PNG_set_tIME
-#define png_set_tRNS                    MOZ_PNG_set_tRNS
-#define png_set_tRNS_to_alpha           MOZ_PNG_set_tRNS_to_alpha
-#define png_set_unknown_chunk_location  MOZ_PNG_set_unknown_chunk_loc
-#define png_set_unknown_chunks          MOZ_PNG_set_unknown_chunks
-#define png_set_user_limits             MOZ_PNG_set_user_limits
-#define png_set_user_transform_info     MOZ_PNG_set_user_transform_info
-#define png_set_write_fn                MOZ_PNG_set_write_fn
-#define png_set_write_status_fn         MOZ_PNG_set_write_status_fn
-#define png_set_write_user_transform_fn MOZ_PNG_set_write_user_trans_fn
-#define png_start_read_image            MOZ_PNG_start_read_image
-#define png_text_compress               MOZ_PNG_text_compress
-#define png_write_bKGD                  MOZ_PNG_write_bKGD
-#define png_write_cHRM                  MOZ_PNG_write_cHRM
-#define png_write_cHRM_fixed            MOZ_PNG_write_cHRM_fixed
-#define png_write_chunk                 MOZ_PNG_write_chunk
-#define png_write_chunk_data            MOZ_PNG_write_chunk_data
-#define png_write_chunk_end             MOZ_PNG_write_chunk_end
-#define png_write_chunk_start           MOZ_PNG_write_chunk_start
-#define png_write_compressed_data_out   MOZ_PNG_write_compressed_data_out
-#define png_write_data                  MOZ_PNG_write_data
-#define png_write_destroy               MOZ_PNG_write_destroy
-#define png_write_end                   MOZ_PNG_write_end
-#define png_write_filtered_row          MOZ_PNG_write_filtered_row
-#define png_write_find_filter           MOZ_PNG_write_find_filter
-#define png_write_finish_row            MOZ_PNG_write_finish_row
-#define png_write_flush                 MOZ_PNG_write_flush
-#define png_write_gAMA                  MOZ_PNG_write_gAMA
-#define png_write_gAMA_fixed            MOZ_PNG_write_gAMA_fixed
-#define png_write_hIST                  MOZ_PNG_write_hIST
-#define png_write_iCCP                  MOZ_PNG_write_iCCP
-#define png_write_IDAT                  MOZ_PNG_write_IDAT
-#define png_write_IEND                  MOZ_PNG_write_IEND
-#define png_write_IHDR                  MOZ_PNG_write_IHDR
-#define png_write_image                 MOZ_PNG_write_image
-#define png_write_info                  MOZ_PNG_write_info
-#define png_write_info_before_PLTE      MOZ_PNG_write_info_before_PLTE
-#define png_write_iTXt                  MOZ_PNG_write_iTXt
-#define png_write_oFFs                  MOZ_PNG_write_oFFs
-#define png_write_pCAL                  MOZ_PNG_write_pCAL
-#define png_write_pHYs                  MOZ_PNG_write_pHYs
-#define png_write_PLTE                  MOZ_PNG_write_PLTE
-#define png_write_png                   MOZ_PNG_write_png
-#define png_write_row                   MOZ_PNG_write_row
-#define png_write_rows                  MOZ_PNG_write_rows
-#define png_write_sBIT                  MOZ_PNG_write_sBIT
-#define png_write_sCAL_s                MOZ_PNG_write_sCAL_s
-#define png_write_sig                   MOZ_PNG_write_sig
-#define png_write_sPLT                  MOZ_PNG_write_sPLT
-#define png_write_sRGB                  MOZ_PNG_write_sRGB
-#define png_write_start_row             MOZ_PNG_write_trans
-#define png_write_tEXt                  MOZ_PNG_write_tEXt
-#define png_write_tIME                  MOZ_PNG_write_tIME
-#define png_write_tRNS                  MOZ_PNG_write_tRNS
-#define png_write_zTXt                  MOZ_PNG_write_zTXt
-#define png_zalloc                      MOZ_PNG_zalloc
-#define png_zfree                       MOZ_PNG_zfree
-#define onebppswaptable                 MOZ_onebppswaptable
-#define twobppswaptable                 MOZ_twobppswaptable
-#define fourbppswaptable                MOZ_fourbppswaptable
-
-/* APNG additions */
-#define png_ensure_fcTL_is_valid        MOZ_APNG_ensure_fcTL_is_valid
-#define png_ensure_sequence_number      MOZ_APNG_ensure_seqno
-#define png_get_acTL                    MOZ_APNG_get_acTL
-#define png_get_first_frame_is_hidden   MOZ_APNG_get_first_frame_is_hidden
-#define png_get_next_frame_blend_op     MOZ_APNG_get_next_frame_blend_op
-#define png_get_next_frame_delay_den    MOZ_APNG_get_next_frame_delay_den
-#define png_get_next_frame_delay_num    MOZ_APNG_get_next_frame_delay_num
-#define png_get_next_frame_dispose_op   MOZ_APNG_get_next_frame_dispose_op
-#define png_get_next_frame_fcTL         MOZ_APNG_get_next_frame_fcTL
-#define png_get_next_frame_height       MOZ_APNG_get_next_frame_height
-#define png_get_next_frame_width        MOZ_APNG_get_next_frame_width
-#define png_get_next_frame_x_offset     MOZ_APNG_get_next_frame_x_offset
-#define png_get_next_frame_y_offset     MOZ_APNG_get_next_frame_y_offset
-#define png_get_num_frames              MOZ_APNG_set_num_frames
-#define png_get_num_plays               MOZ_APNG_set_num_plays
-#define png_handle_acTL                 MOZ_APNG_handle_acTL
-#define png_handle_fcTL                 MOZ_APNG_handle_fcTL
-#define png_handle_fdAT                 MOZ_APNG_handle_fdAT
-#define png_have_info                   MOZ_APNG_have_info
-#define png_progressive_read_reset      MOZ_APNG_prog_read_reset
-#define png_read_frame_head             MOZ_APNG_read_frame_head
-#define png_read_reinit                 MOZ_APNG_read_reinit
-#define png_read_reset                  MOZ_APNG_read_reset
-#define png_set_acTL                    MOZ_APNG_set_acTL
-#define png_set_first_frame_is_hidden   MOZ_APNG_set_first_frame_is_hidden
-#define png_set_next_frame_fcTL         MOZ_APNG_set_next_frame_fcTL
-#define png_set_progressive_frame_fn    MOZ_APNG_set_prog_frame_fn
-#define png_write_acTL                  MOZ_APNG_write_acTL
-#define png_write_fcTL                  MOZ_APNG_write_fcTL
-#define png_write_fdAT                  MOZ_APNG_write_fdAT
-#define png_write_frame_head            MOZ_APNG_write_frame_head
-#define png_write_frame_tail            MOZ_APNG_write_frame_tail
-#define png_write_reinit                MOZ_APNG_write_reinit
-#define png_write_reset                 MOZ_APNG_write_reset
-
-/* libpng-1.4.x additions */
-#define png_do_quantize                 MOZ_PNG_do_quantize
-#define png_get_chunk_cache_max         MOZ_PNG_get_chunk_cache_max
-#define png_get_chunk_malloc_max        MOZ_PNG_get_chunk_malloc_max
-#define png_get_io_chunk_name           MOZ_PNG_get_io_chunk_name
-#define png_get_io_state                MOZ_PNG_get_io_state
-#define png_longjmp                     MOZ_PNG_longjmp
-#define png_read_sig                    MOZ_PNG_read_sig
-#define png_set_chunk_cache_max         MOZ_PNG_set_chunk_cache_max
-#define png_set_chunk_malloc_max        MOZ_PNG_set_chunk_malloc_max
-#define png_set_longjmp_fn              MOZ_PNG_set_longjmp_fn
-#define png_set_quantize                MOZ_PNG_set_quantize
-
-/* libpng-1.5.x additions */
-#define png_32bit_exp                             MOZ_PNG_32bit_exp
-#define png_8bit_l2                               MOZ_PNG_8bit_l2
-#define png_ascii_from_fixed                      MOZ_PNG_ascii_from_fixed
-#define png_ascii_from_fp                         MOZ_PNG_ascii_from_fp
-#define png_build_16bit_table                     MOZ_PNG_build_16bit_table
-#define png_build_16to8_table                     MOZ_PNG_build_16to8_table
-#define png_build_8bit_table                      MOZ_PNG_build_8bit_table
-#define png_check_fp_number                       MOZ_PNG_check_fp_number
-#define png_check_fp_string                       MOZ_PNG_check_fp_string
-#define png_chunk_unknown_handling                MOZ_PNG_chunk_unk_handling
-#define png_destroy_gamma_table                   MOZ_PNG_destroy_gamma_table
-#define png_do_compose                            MOZ_PNG_do_compose
-#define png_do_encode_alpha                       MOZ_PNG_do_encode_alpha
-#define png_do_expand_16                          MOZ_PNG_do_expand_16
-#define png_do_scale_16_to_8                      MOZ_PNG_do_scale_16_to_8
-#define png_do_strip_channel                      MOZ_PNG_do_strip_channel
-#define png_exp                                   MOZ_PNG_exp
-#define png_exp16bit                              MOZ_PNG_exp16bit
-#define png_exp8bit                               MOZ_PNG_exp8bit
-#define png_fixed_inches_from_microns             MOZ_PNG_fixed_inch_from_micr
-#define png_format_number                         MOZ_PNG_format_number
-#define png_gamma_16bit_correct                   MOZ_PNG_gamma_16bit_correct
-#define png_gamma_8bit_correct                    MOZ_PNG_gamma_8bit_correct
-#define png_gamma_correct                         MOZ_PNG_gamma_correct
-#define png_gamma_significant                     MOZ_PNG_gamma_significant
-#define png_gamma_threshold                       MOZ_PNG_gamma_threshold
-#define png_get_cHRM_XYZ                          MOZ_PNG_get_cHRM_XYZ
-#define png_get_cHRM_XYZ_fixed                    MOZ_PNG_get_cHRM_XYZ_fixed
-#define png_get_current_pass_number               MOZ_PNG_get_cur_pass_number
-#define png_get_current_row_number                MOZ_PNG_get_cur_row_number
-#define png_get_fixed_point                       MOZ_PNG_get_fixed_point
-#define png_get_io_chunk_type                     MOZ_PNG_get_io_chunk_type
-#define png_get_pixel_aspect_ratio_fixed          MOZ_PNG_get_pixel_aspect_fx
-#define png_get_sCAL_fixed                        MOZ_PNG_get_sCAL_fixed
-#define png_get_x_offset_inches_fixed             MOZ_PNG_get_x_offs_inches_fx
-#define png_get_y_offset_inches_fixed             MOZ_PNG_get_y_offs_inches_fx
-#define png_have_hwcap                            MOZ_PNG_have_hwcap
-#define png_init_filter_functions                 MOZ_PNG_init_filt_func
-#define png_init_filter_functions_neon            MOZ_PNG_init_filt_func_neon
-#define png_init_filter_heuristics                MOZ_PNG_init_filt_heur
-#define png_init_palette_transformations          MOZ_PNG_init_palette_transf
-#define png_init_rgb_transformations              MOZ_PNG_init_rgb_transf
-#define png_log16bit                              MOZ_PNG_log16bit
-#define png_log8bit                               MOZ_PNG_log8bit
-#define png_muldiv                                MOZ_PNG_muldiv
-#define png_muldiv_warn                           MOZ_PNG_muldiv_warn
-#define png_pow10                                 MOZ_PNG_pow10
-#define png_process_data_pause                    MOZ_PNG_process_data_pause
-#define png_process_data_skip                     MOZ_PNG_process_data_skip
-#define png_product2                              MOZ_PNG_product2
-#define png_read_filter_row_avg                   MOZ_PNG_read_filt_row_a
-#define png_read_filter_row_avg3_neon             MOZ_PNG_read_filt_row_a3_neon
-#define png_read_filter_row_avg4_neon             MOZ_PNG_read_filt_row_a4_neon
-#define png_read_filter_row_paeth_1byte_pixel     MOZ_PNG_read_filt_row_p_1b_px
-#define png_read_filter_row_paeth_multibyte_pixel MOZ_PNG_read_filt_row_p_mb_px
-#define png_read_filter_row_paeth3_neon           MOZ_PNG_read_filt_row_p3_neon
-#define png_read_filter_row_paeth4_neon           MOZ_PNG_read_filt_row_p4_neon
-#define png_read_filter_row_sub                   MOZ_PNG_read_filt_row_s
-#define png_read_filter_row_sub3_neon             MOZ_PNG_read_filt_row_s3_neon
-#define png_read_filter_row_sub4_neon             MOZ_PNG_read_filt_row_s4_neon
-#define png_read_filter_row_up                    MOZ_PNG_read_filt_row_up
-#define png_read_filter_row_up_neon               MOZ_PNG_read_filt_row_up_neon
-#define png_reciprocal                            MOZ_PNG_reciprocal
-#define png_reciprocal2                           MOZ_PNG_reciprocal2
-#define png_reset_filter_heuristics               MOZ_PNG_reset_filt_heur
-#define png_safecat                               MOZ_PNG_safecat
-#define png_set_alpha_mode                        MOZ_PNG_set_alpha_mode
-#define png_set_alpha_mode_fixed                  MOZ_PNG_set_alpha_mode_fx
-#define png_set_background_fixed                  MOZ_PNG_set_background_fx
-#define png_set_cHRM_XYZ                          MOZ_PNG_set_cHRM_XYZ
-#define png_set_cHRM_XYZ_fixed                    MOZ_PNG_set_cHRM_XYZ_fixed
-#define png_set_expand_16                         MOZ_PNG_set_expand_16
-#define png_set_filter_heuristics_fixed           MOZ_PNG_set_filter_heur_fx
-#define png_set_gamma_fixed                       MOZ_PNG_set_gamma_fixed
-#define png_set_sCAL_fixed                        MOZ_PNG_set_sCAL_fixed
-#define png_set_scale_16                          MOZ_PNG_set_scale_16
-#define png_set_text_compression_level            MOZ_PNG_set_text_c_level
-#define png_set_text_compression_mem_level        MOZ_PNG_set_text_c_mem_level
-#define png_set_text_compression_method           MOZ_PNG_set_text_c_method
-#define png_set_text_compression_strategy         MOZ_PNG_set_text_c_strategy
-#define png_set_text_compression_window_bits      MOZ_PNG_set_text_c_wnd_bits
-#define png_user_version_check                    MOZ_PNG_user_version_check
-#define png_write_chunk_header                    MOZ_PNG_write_chunk_header
-#define png_write_complete_chunk                  MOZ_PNG_write_complete_chunk
-#define png_xy_from_XYZ                           MOZ_PNG_xy_from_XYZ
-#define png_XYZ_from_xy                           MOZ_PNG_XYZ_from_xy
-#define png_XYZ_from_xy_checked                   MOZ_PNG_XYZ_from_xy_checked
-#define png_zlib_claim                            MOZ_PNG_zlib_claim
-#define png_zlib_release                          MOZ_PNG_zlib_release
-#define convert_gamma_value                       MOZ_convert_gamma_value
-#define ppi_from_ppm                              MOZ_ppi_from_ppm
-#define translate_gamma_flags                     MOZ_translate_gamma_flags
-
-/* libpng-1.6.x additions */
-#define png_app_error                             MOZ_PNG_app_err
-#define png_app_warning                           MOZ_PNG_app_warn
-#ifndef png_benign_error
-#  define png_benign_error                        MOZ_PNG_benign_err
-#endif
-#ifndef png_chunk_benign_error
-#  define png_chunk_benign_error                  MOZ_PNG_chunk_benign_err
-#endif
-#define png_chunk_report                          MOZ_PNG_chunk_report
-#define png_colorspace_set_ICC                    MOZ_PNG_cs_set_ICC
-#define png_colorspace_set_chromaticities         MOZ_PNG_cs_set_chromats
-#define png_colorspace_set_endpoints              MOZ_PNG_cs_set_endpts
-#define png_colorspace_set_gamma                  MOZ_PNG_cs_set_gamma
-#define png_colorspace_set_sRGB                   MOZ_PNG_cs_set_sRGB
-#define png_colorspace_sync                       MOZ_PNG_cs_sync
-#define png_colorspace_sync_info                  MOZ_PNG_cs_sync_info
-#define png_compress_IDAT                         MOZ_PNG_compress_IDAT
-#define png_create_png_struct                     MOZ_PNG_create_png_struct
-#define png_destroy_png_struct                    MOZ_PNG_destroy_png_struct
-#define png_free_buffer_list                      MOZ_PNG_free_buffer_list
-#define png_free_jmpbuf                           MOZ_PNG_free_jmpbuf
-#define png_get_uint_31                           MOZ_PNG_get_uint_31
-#define png_icc_check_header                      MOZ_PNG_icc_check_header
-#define png_icc_check_length                      MOZ_PNG_icc_check_length
-#define png_icc_check_tag_table                   MOZ_PNG_icc_check_tags
-#define png_icc_set_sRGB                          MOZ_PNG_icc_set_sRGB
-#define png_malloc_array                          MOZ_PNG_malloc_array
-#define png_malloc_base                           MOZ_PNG_malloc_base
-#define png_realloc_array                         MOZ_PNG_realloc_array
-#define png_zstream_error                         MOZ_PNG_zstream_error
-
-#if defined(PR_LOGGING)
-#ifndef png_warning
-#  define png_warning                     MOZ_PNG_warning
-#endif
-#ifndef png_chunk_error
-#  define png_chunk_error                 MOZ_PNG_chunk_err
-#endif
-#ifndef png_chunk_warning
-#  define png_chunk_warning               MOZ_PNG_chunk_warn
-#endif
-#define png_fixed_error                 MOZ_PNG_fixed_err
-#define png_formatted_warning           MOZ_PNG_formatted_warning
-#define png_warning_parameter           MOZ_PNG_warn_param
-#define png_warning_parameter_signed    MOZ_PNG_warn_param_signed
-#define png_warning_parameter_unsigned  MOZ_PNG_warn_param_unsigned
-#endif
-
-#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
-#define png_set_packing  MOZ_PNG_set_packing
-#endif
-
-#endif /* MOZPNGCONF_H */
--- a/media/libpng/png.c
+++ b/media/libpng/png.c
@@ -1,25 +1,25 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Last changed in libpng 1.6.12 [June 12, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
 
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_10 Your_png_h_is_not_version_1_6_10;
+typedef png_libpng_version_1_6_13 Your_png_h_is_not_version_1_6_13;
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
  * stream we can set num_bytes = 8 so that libpng will not attempt to read
  * or write any of the magic bytes before it starts on the IHDR.
  */
 
 #ifdef PNG_READ_SUPPORTED
@@ -160,17 +160,17 @@ png_calculate_crc(png_structrp png_ptr, 
 }
 
 /* Check a user supplied version number, called from both read and write
  * functions that create a png_struct.
  */
 int
 png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
 {
-   if (user_png_ver)
+   if (user_png_ver != NULL)
    {
       int i = 0;
 
       do
       {
          if (user_png_ver[i] != png_libpng_ver[i])
             png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
       } while (png_libpng_ver[i++]);
@@ -768,23 +768,23 @@ png_const_charp PNGAPI
 png_get_copyright(png_const_structrp png_ptr)
 {
    PNG_UNUSED(png_ptr)  /* Silence compiler warning about unused png_ptr */
 #ifdef PNG_STRING_COPYRIGHT
    return PNG_STRING_COPYRIGHT
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-     "libpng version 1.6.10 - March 6, 2014" PNG_STRING_NEWLINE \
+     "libpng version 1.6.13 - August 21, 2014" PNG_STRING_NEWLINE \
      "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
      "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
      "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
      PNG_STRING_NEWLINE;
 #  else
-      return "libpng version 1.6.10 - March 6, 2014\
+      return "libpng version 1.6.13 - August 21, 2014\
       Copyright (c) 1998-2014 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
 #  endif
 #endif
 }
 
 /* The following return the library version as a short string in the
@@ -1553,20 +1553,20 @@ png_colorspace_endpoints_match(const png
 static int
 png_colorspace_check_xy(png_XYZ *XYZ, const png_xy *xy)
 {
    int result;
    png_xy xy_test;
 
    /* As a side-effect this routine also returns the XYZ endpoints. */
    result = png_XYZ_from_xy(XYZ, xy);
-   if (result) return result;
+   if (result != 0) return result;
 
    result = png_xy_from_XYZ(&xy_test, XYZ);
-   if (result) return result;
+   if (result != 0) return result;
 
    if (png_colorspace_endpoints_match(xy, &xy_test,
       5/*actually, the math is pretty accurate*/))
       return 0;
 
    /* Too much slip */
    return 1;
 }
@@ -1576,20 +1576,20 @@ png_colorspace_check_xy(png_XYZ *XYZ, co
  */
 static int
 png_colorspace_check_XYZ(png_xy *xy, png_XYZ *XYZ)
 {
    int result;
    png_XYZ XYZtemp;
 
    result = png_XYZ_normalize(XYZ);
-   if (result) return result;
+   if (result != 0) return result;
 
    result = png_xy_from_XYZ(xy, XYZ);
-   if (result) return result;
+   if (result != 0) return result;
 
    XYZtemp = *XYZ;
    return png_colorspace_check_xy(&XYZtemp, xy);
 }
 
 /* Used to check for an endpoint match against sRGB */
 static const png_xy sRGB_xy = /* From ITU-R BT.709-3 */
 {
@@ -1620,17 +1620,17 @@ png_colorspace_set_xy_and_XYZ(png_const_
       if (!png_colorspace_endpoints_match(xy, &colorspace->end_points_xy, 100))
       {
          colorspace->flags |= PNG_COLORSPACE_INVALID;
          png_benign_error(png_ptr, "inconsistent chromaticities");
          return 0; /* failed */
       }
 
       /* Only overwrite with preferred values */
-      if (!preferred)
+      if (preferred == 0)
          return 1; /* ok, but no change */
    }
 
    colorspace->end_points_xy = *xy;
    colorspace->end_points_XYZ = *XYZ;
    colorspace->flags |= PNG_COLORSPACE_HAVE_ENDPOINTS;
 
    /* The end points are normally quoted to two decimal digits, so allow +/-0.01
@@ -1901,20 +1901,16 @@ static const png_byte D50_nCIEXYZ[12] =
 int /* PRIVATE */
 png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
    png_const_charp name, png_uint_32 profile_length)
 {
    if (profile_length < 132)
       return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
          "too short");
 
-   if (profile_length & 3)
-      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
-         "invalid length");
-
    return 1;
 }
 
 int /* PRIVATE */
 png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
    png_const_charp name, png_uint_32 profile_length,
    png_const_bytep profile/* first 132 bytes only */, int color_type)
 {
@@ -1925,16 +1921,21 @@ png_icc_check_header(png_const_structrp 
     * long profile_length from the caller must be correct.  The caller can fix
     * this up on read or write by just passing in the profile header length.
     */
    temp = png_get_uint_32(profile);
    if (temp != profile_length)
       return png_icc_profile_error(png_ptr, colorspace, name, temp,
          "length does not match profile");
 
+   temp = (png_uint_32) (*(profile+8));
+   if (temp > 3 && (profile_length & 3))
+      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
+         "invalid length");
+
    temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
    if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
       profile_length < 132+12*temp) /* truncated tag table */
       return png_icc_profile_error(png_ptr, colorspace, name, temp,
          "tag count too large");
 
    /* The 'intent' must be valid or we can't store it, ICC limits the intent to
     * 16 bits.
@@ -2039,28 +2040,28 @@ png_icc_check_header(png_const_structrp 
          break;
 
       case 0x61627374: /* 'abst' */
          /* May not be embedded in an image */
          return png_icc_profile_error(png_ptr, colorspace, name, temp,
             "invalid embedded Abstract ICC profile");
 
       case 0x6C696E6B: /* 'link' */
-         /* DeviceLink profiles cannnot be interpreted in a non-device specific
+         /* DeviceLink profiles cannot be interpreted in a non-device specific
           * fashion, if an app uses the AToB0Tag in the profile the results are
           * undefined unless the result is sent to the intended device,
           * therefore a DeviceLink profile should not be found embedded in a
           * PNG.
           */
          return png_icc_profile_error(png_ptr, colorspace, name, temp,
             "unexpected DeviceLink ICC profile class");
 
       case 0x6E6D636C: /* 'nmcl' */
          /* A NamedColor profile is also device specific, however it doesn't
-          * contain an AToB0 tag that is open to misintrepretation.  Almost
+          * contain an AToB0 tag that is open to misinterpretation.  Almost
           * certainly it will fail the tests below.
           */
          (void)png_icc_profile_error(png_ptr, NULL, name, temp,
             "unexpected NamedColor ICC profile class");
          break;
 
       default:
          /* To allow for future enhancements to the profile accept unrecognized
@@ -2131,17 +2132,17 @@ png_icc_check_tag_table(png_const_struct
       if (tag_start > profile_length || tag_length > profile_length - tag_start)
          return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
             "ICC profile tag outside profile");
    }
 
    return 1; /* success, maybe with warnings */
 }
 
-#ifdef PNG_sRGB_SUPPORTED
+#if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
 /* Information about the known ICC sRGB profiles */
 static const struct
 {
    png_uint_32 adler, crc, length;
    png_uint_32 md5[4];
    png_byte    have_md5;
    png_byte    is_broken;
    png_uint_16 intent;
@@ -2205,23 +2206,29 @@ png_compare_ICC_profile_with_sRGB(png_co
 {
    /* The quick check is to verify just the MD5 signature and trust the
     * rest of the data.  Because the profile has already been verified for
     * correctness this is safe.  png_colorspace_set_sRGB will check the 'intent'
     * field too, so if the profile has been edited with an intent not defined
     * by sRGB (but maybe defined by a later ICC specification) the read of
     * the profile will fail at that point.
     */
+
    png_uint_32 length = 0;
    png_uint_32 intent = 0x10000; /* invalid */
 #if PNG_sRGB_PROFILE_CHECKS > 1
    uLong crc = 0; /* the value for 0 length data */
 #endif
    unsigned int i;
 
+   /* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */
+   if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) ==
+               PNG_OPTION_ON)
+      return 0;
+
    for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i)
    {
       if (png_get_uint_32(profile+84) == png_sRGB_checks[i].md5[0] &&
          png_get_uint_32(profile+88) == png_sRGB_checks[i].md5[1] &&
          png_get_uint_32(profile+92) == png_sRGB_checks[i].md5[2] &&
          png_get_uint_32(profile+96) == png_sRGB_checks[i].md5[3])
       {
          /* This may be one of the old HP profiles without an MD5, in that
@@ -2281,52 +2288,54 @@ png_compare_ICC_profile_with_sRGB(png_co
                   }
 
                   /* Warn that this being done; this isn't even an error since
                    * the profile is perfectly valid, but it would be nice if
                    * people used the up-to-date ones.
                    */
                   else if (!png_sRGB_checks[i].have_md5)
                   {
-                     png_chunk_report(png_ptr,
-                        "out-of-date sRGB profile with no signature",
+                     png_chunk_report(png_ptr, "out-of-date sRGB profile with"
+                        " no signature",
                         PNG_CHUNK_WARNING);
                   }
 
                   return 1+png_sRGB_checks[i].is_broken;
                }
             }
-         }
 
 # if PNG_sRGB_PROFILE_CHECKS > 0
          /* The signature matched, but the profile had been changed in some
           * way.  This probably indicates a data error or uninformed hacking.
           * Fall through to "no match".
           */
-         png_chunk_report(png_ptr,
-             "Not recognizing known sRGB profile that has been edited", 
+         png_chunk_report(png_ptr, "Not recognizing known sRGB profile that"
+             " has been edited", 
              PNG_CHUNK_WARNING);
          break;
 # endif
+         }
       }
    }
 
    return 0; /* no match */
 }
 #endif
 
 #ifdef PNG_sRGB_SUPPORTED
 void /* PRIVATE */
 png_icc_set_sRGB(png_const_structrp png_ptr,
    png_colorspacerp colorspace, png_const_bytep profile, uLong adler)
 {
    /* Is this profile one of the known ICC sRGB profiles?  If it is, just set
     * the sRGB information.
     */
+#if PNG_sRGB_PROFILE_CHECKS >= 0
    if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler))
+#endif
       (void)png_colorspace_set_sRGB(png_ptr, colorspace,
          (int)/*already checked*/png_get_uint_32(profile+64));
 }
 #endif /* PNG_READ_sRGB_SUPPORTED */
 
 int /* PRIVATE */
 png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
    png_const_charp name, png_uint_32 profile_length, png_const_bytep profile,
@@ -2430,55 +2439,56 @@ png_check_IHDR(png_const_structrp png_pt
    int error = 0;
 
    /* Check for width and height valid values */
    if (width == 0)
    {
       png_warning(png_ptr, "Image width is zero in IHDR");
       error = 1;
    }
+   else if (width > PNG_UINT_31_MAX)
+   {
+      png_warning(png_ptr, "Invalid image width in IHDR");
+      error = 1;
+   }
+   else
+   {
+#     ifdef PNG_SET_USER_LIMITS_SUPPORTED
+      if (width > png_ptr->user_width_max)
+#     else
+      if (width > PNG_USER_WIDTH_MAX)
+#     endif
+      {
+         png_warning(png_ptr, "Image width exceeds user limit in IHDR");
+         error = 1;
+      }
+   }
 
    if (height == 0)
    {
       png_warning(png_ptr, "Image height is zero in IHDR");
       error = 1;
    }
-
-#  ifdef PNG_SET_USER_LIMITS_SUPPORTED
-   if (width > png_ptr->user_width_max)
-
-#  else
-   if (width > PNG_USER_WIDTH_MAX)
-#  endif
-   {
-      png_warning(png_ptr, "Image width exceeds user limit in IHDR");
-      error = 1;
-   }
-
-#  ifdef PNG_SET_USER_LIMITS_SUPPORTED
-   if (height > png_ptr->user_height_max)
-#  else
-   if (height > PNG_USER_HEIGHT_MAX)
-#  endif
-   {
-      png_warning(png_ptr, "Image height exceeds user limit in IHDR");
-      error = 1;
-   }
-
-   if (width > PNG_UINT_31_MAX)
-   {
-      png_warning(png_ptr, "Invalid image width in IHDR");
-      error = 1;
-   }
-
-   if (height > PNG_UINT_31_MAX)
+   else if (height > PNG_UINT_31_MAX)
    {
       png_warning(png_ptr, "Invalid image height in IHDR");
       error = 1;
    }
+   else
+   {
+#     ifdef PNG_SET_USER_LIMITS_SUPPORTED
+      if (height > png_ptr->user_height_max)
+#     else
+      if (height > PNG_USER_HEIGHT_MAX)
+#     endif
+      {
+         png_warning(png_ptr, "Image height exceeds user limit in IHDR");
+         error = 1;
+      }
+   }
 
    /* Check other values */
    if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
        bit_depth != 8 && bit_depth != 16)
    {
       png_warning(png_ptr, "Invalid bit depth in IHDR");
       error = 1;
    }
@@ -2733,17 +2743,17 @@ png_pow10(int power)
       do
       {
          if (power & 1) d *= mult;
          mult *= mult;
          power >>= 1;
       }
       while (power > 0);
 
-      if (recip) d = 1/d;
+      if (recip != 0) d = 1/d;
    }
    /* else power is 0 and d is 1 */
 
    return d;
 }
 
 /* Function to format a floating point value in ASCII with a given
  * precision.
@@ -3256,17 +3266,17 @@ png_muldiv(png_fixed_point_p res, png_fi
                   if (s32 == d32 && s00 >= d00)
                      s32 = 0, s00 -= d00, result += 1<<bitshift;
             }
 
             /* Handle the rounding. */
             if (s00 >= (D >> 1))
                ++result;
 
-            if (negative)
+            if (negative != 0)
                result = -result;
 
             /* Check for overflow. */
             if ((negative && result <= 0) || (!negative && result >= 0))
             {
                *res = result;
                return 1;
             }
@@ -3783,33 +3793,33 @@ png_build_16bit_table(png_structrp png_p
          for (j = 0; j < 256; j++)
          {
             png_uint_32 ig = (j << (8-shift)) + i;
 #           ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
                /* Inline the 'max' scaling operation: */
                double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5);
                sub_table[j] = (png_uint_16)d;
 #           else
-               if (shift)
+               if (shift != 0)
                   ig = (ig * 65535U + max_by_2)/max;
 
                sub_table[j] = png_gamma_16bit_correct(ig, gamma_val);
 #           endif
          }
       }
       else
       {
          /* We must still build a table, but do it the fast way. */
          unsigned int j;
 
          for (j = 0; j < 256; j++)
          {
             png_uint_32 ig = (j << (8-shift)) + i;
 
-            if (shift)
+            if (shift != 0)
                ig = (ig * 65535U + max_by_2)/max;
 
             sub_table[j] = (png_uint_16)ig;
          }
       }
    }
 }
 
@@ -4087,17 +4097,17 @@ png_build_gamma_table(png_structrp png_p
             png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
      }
 #endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
   }
 #endif /* 16BIT */
 }
 #endif /* READ_GAMMA */
 
-/* HARDWARE OPTION SUPPORT */
+/* HARDWARE OR SOFTWARE OPTION SUPPORT */
 #ifdef PNG_SET_OPTION_SUPPORTED
 int PNGAPI
 png_set_option(png_structrp png_ptr, int option, int onoff)
 {
    if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
       (option & 1) == 0)
    {
       int mask = 3 << option;
--- a/media/libpng/png.h
+++ b/media/libpng/png.h
@@ -1,22 +1,22 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.6.10 - March 6, 2014
+ * libpng version 1.6.13 - August 21, 2014
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license (See LICENSE, below)
  *
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014: Glenn
+ *   libpng versions 0.97, January 1998, through 1.6.13 - August 21, 2014: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
  *
  *   Due to various miscommunications, unforeseen code incompatibilities
  *   and occasional factors outside the authors' control, version numbering
  *   on the library has not always been consistent and straightforward.
  *   The following table summarizes matters since version 0.89c, which was
@@ -188,18 +188,26 @@
  *    1.6.7                   16    10607  16.so.16.7[.0]
  *    1.6.8beta01-02          16    10608  16.so.16.8[.0]
  *    1.6.8rc01-02            16    10608  16.so.16.8[.0]
  *    1.6.8                   16    10608  16.so.16.8[.0]
  *    1.6.9beta01-04          16    10609  16.so.16.9[.0]
  *    1.6.9rc01-02            16    10609  16.so.16.9[.0]
  *    1.6.9                   16    10609  16.so.16.9[.0]
  *    1.6.10beta01-03         16    10610  16.so.16.10[.0]
- *    1.6.10betarc01-04       16    10610  16.so.16.10[.0]
- *    1.6.10beta              16    10610  16.so.16.10[.0]
+ *    1.6.10rc01-03           16    10610  16.so.16.10[.0]
+ *    1.6.10                  16    10610  16.so.16.10[.0]
+ *    1.6.11beta01-06         16    10611  16.so.16.11[.0]
+ *    1.6.11rc01-02           16    10611  16.so.16.11[.0]
+ *    1.6.11                  16    10611  16.so.16.11[.0]
+ *    1.6.12rc01-03           16    10612  16.so.16.12[.0]
+ *    1.6.12                  16    10612  16.so.16.12[.0]
+ *    1.6.13beta01-04         16    10613  16.so.16.13[.0]
+ *    1.6.13rc01-02           16    10613  16.so.16.13[.0]
+ *    1.6.13                  16    10613  16.so.16.13[.0]
  *
  *   Henceforth the source version will match the shared-library major
  *   and minor numbers; the shared-library major version number will be
  *   used for changes in backward compatibility, as it is intended.  The
  *   PNG_LIBPNG_VER macro, which is not used within libpng but is available
  *   for applications, is an unsigned integer of the form xyyzz corresponding
  *   to the source version x.y.z (leading zeros in y and z).  Beta versions
  *   were given the previous public release number plus a letter, until
@@ -221,18 +229,18 @@
 /*
  * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
  *
  * If you modify libpng you may insert additional notices immediately following
  * this sentence.
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are
- * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
+ * libpng versions 1.2.6, August 15, 2004, through 1.6.13, August 21, 2014, are
+ * Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.2.5
  * with the following individual added to the list of Contributing Authors:
  *
  *    Cosmin Truta
  *
  * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
  * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.0.6
@@ -333,23 +341,23 @@
  *
  * Thanks to Frank J. T. Wojcik for helping with the documentation.
  */
 
 /*
  * Y2K compliance in libpng:
  * =========================
  *
- *    March 6, 2014
+ *    August 21, 2014
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.6.10 are Y2K compliant.  It is my belief that
+ *    upward through 1.6.13 are Y2K compliant.  It is my belief that
  *    earlier versions were also Y2K compliant.
  *
  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
  *    that will hold years up to 65535.  The other, which is deprecated,
  *    holds the date in text format, and will hold years up to 9999.
  *
  *    The integer is
  *        "png_uint_16 year" in png_time_struct.
@@ -392,34 +400,36 @@
  */
 
 #ifndef PNG_H
 #define PNG_H
 
 /* This is not the place to learn how to use libpng. The file libpng-manual.txt
  * describes how to use libpng, and the file example.c summarizes it
  * with some code on which to build.  This file is useful for looking
- * at the actual function definitions and structure components.
+ * at the actual function definitions and structure components.  If that
+ * file has been stripped from your copy of libpng, you can find it at
+ * <http://www.libpng.org/pub/png/libpng-manual.txt>
  *
  * If you just need to read a PNG file and don't want to read the documentation
  * skip to the end of this file and read the section entitled 'simplified API'.
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.10"
+#define PNG_LIBPNG_VER_STRING "1.6.13"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.6.10 - March 6, 2014\n"
+     " libpng version 1.6.13 - August 21, 2014\n"
 
 #define PNG_LIBPNG_VER_SONUM   16
 #define PNG_LIBPNG_VER_DLLNUM  16
 
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 10
+#define PNG_LIBPNG_VER_RELEASE 13
 
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
  */
 
 #define PNG_LIBPNG_VER_BUILD  0
 
 /* Release Status */
@@ -440,29 +450,34 @@
 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  */
-#define PNG_LIBPNG_VER 10610 /* 1.6.10 */
+#define PNG_LIBPNG_VER 10613 /* 1.6.13 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
  */
+#ifndef PNGLCONF_H
+    /* If pnglibconf.h is missing, you can
+     * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
+     */
+#   include "pnglibconf.h"
+#endif
 
 #define PNG_APNG_SUPPORTED
 #define PNG_READ_APNG_SUPPORTED
 #define PNG_WRITE_APNG_SUPPORTED
 
 #ifndef PNG_VERSION_INFO_ONLY
    /* Machine specific configuration. */
-#  include "mozpngconf.h"
 #  include "pngconf.h"
 #endif
 
 /*
  * Added at libpng-1.2.8
  *
  * Ref MSDN: Private as priority over Special
  * VS_FF_PRIVATEBUILD File *was not* built using standard release
@@ -555,17 +570,17 @@ extern "C" {
 /* blend_op flags from inside fcTL */
 #define PNG_BLEND_OP_SOURCE        0x00
 #define PNG_BLEND_OP_OVER          0x01
 #endif /* PNG_APNG_SUPPORTED */
 
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_6_10;
+typedef char* png_libpng_version_1_6_13;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
  * png_struct is the cache of information used while reading or writing a single
  * PNG file.  One of these is always required, although the simplified API
  * (below) hides the creation and destruction of it.
  */
 typedef struct png_struct_def png_struct;
@@ -1862,25 +1877,23 @@ PNG_EXPORT(219, png_size_t, png_process_
 /* A function which may be called *only* outside (after) a call to
  * png_process_data.  It returns the number of bytes of data to skip in the
  * input.  Normally it will return 0, but if it returns a non-zero value the
  * application must skip than number of bytes of input data and pass the
  * following data to the next call to png_process_data.
  */
 PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
 
-#ifdef PNG_READ_INTERLACING_SUPPORTED
 /* Function that combines rows.  'new_row' is a flag that should come from
  * the callback and be non-NULL if anything needs to be done; the library
  * stores its own version of the new data internally and ignores the passed
  * in value.
  */
 PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
     png_bytep old_row, png_const_bytep new_row));
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 
 PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
     png_alloc_size_t size), PNG_ALLOCATED);
 /* Added at libpng version 1.4.0 */
 PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr,
     png_alloc_size_t size), PNG_ALLOCATED);
 
@@ -3238,30 +3251,31 @@ PNG_EXPORT(243, int, png_get_palette_max
  *           PNG images.  'Software' options allow such optimizations to be
  *           selected at run time.
  */
 #ifdef PNG_SET_OPTION_SUPPORTED
 #ifdef PNG_ARM_NEON_API_SUPPORTED
 #  define PNG_ARM_NEON   0 /* HARDWARE: ARM Neon SIMD instructions supported */
 #endif
 #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
-#define PNG_OPTION_NEXT  4 /* Next option - numbers must be even */
+#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
+#define PNG_OPTION_NEXT  6 /* Next option - numbers must be even */
 
 /* Return values: NOTE: there are four values and 'off' is *not* zero */
 #define PNG_OPTION_UNSET   0 /* Unset - defaults to off */
 #define PNG_OPTION_INVALID 1 /* Option number out of range */
 #define PNG_OPTION_OFF     2
 #define PNG_OPTION_ON      3
 
 PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
    int onoff));
 #endif
 
 /*******************************************************************************
- *  END OF HARDWARE OPTIONS
+ *  END OF HARDWARE AND SOFTWARE OPTIONS
  ******************************************************************************/
 
 #ifdef PNG_APNG_SUPPORTED
 PNG_EXPORT(245, png_uint_32, png_get_acTL, (png_structp png_ptr,
    png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
 
 PNG_EXPORT(246, png_uint_32, png_set_acTL, (png_structp png_ptr,
    png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
--- a/media/libpng/pngconf.h
+++ b/media/libpng/pngconf.h
@@ -1,14 +1,14 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.6.10 - March 6, 2014
+ * libpng version 1.6.13 - August 21, 2014
  *
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
  */
@@ -356,17 +356,17 @@
 
 #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
   /* Support for compiler specific function attributes.  These are used
    * so that where compiler support is available, incorrect use of API
    * functions in png.h will generate compiler warnings.  Added at libpng
    * version 1.2.41.  Disabling these removes the warnings but may also produce
    * less efficient code.
    */
-#  if defined(__clang__)
+#  if defined(__clang__) && defined(__has_attribute)
      /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
 #    if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
 #      define PNG_USE_RESULT __attribute__((__warn_unused_result__))
 #    endif
 #    if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
 #      define PNG_NORETURN __attribute__((__noreturn__))
 #    endif
 #    if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
--- a/media/libpng/pngerror.c
+++ b/media/libpng/pngerror.c
@@ -1,12 +1,12 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Last changed in libpng 1.6.13 [August 21, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
@@ -190,17 +190,17 @@ png_format_number(png_const_charp start,
 
       /* Float a fixed number here: */
       if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
       {
          /* End of the fraction, but maybe nothing was output?  In that case
           * drop the decimal point.  If the number is a true zero handle that
           * here.
           */
-         if (output)
+         if (output != 0)
             *--end = '.';
          else if (number == 0) /* and !output */
             *--end = '0';
       }
    }
 
    return end;
 }
@@ -410,31 +410,31 @@ png_app_error(png_const_structrp png_ptr
      png_error(png_ptr, error_message);
 
 #  ifndef PNG_ERROR_TEXT_SUPPORTED
       PNG_UNUSED(error_message)
 #  endif
 }
 #endif /* BENIGN_ERRORS */
 
+#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */
+#if defined(PNG_WARNINGS_SUPPORTED) || \
+   (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
 /* These utilities are used internally to build an error message that relates
  * to the current chunk.  The chunk name comes from png_ptr->chunk_name,
- * this is used to prefix the message.  The message is limited in length
- * to 63 bytes, the name characters are output as hex digits wrapped in []
+ * which is used to prefix the message.  The message is limited in length
+ * to 63 bytes. The name characters are output as hex digits wrapped in []
  * if the character is invalid.
  */
 #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
 static PNG_CONST char png_digit[16] = {
    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
    'A', 'B', 'C', 'D', 'E', 'F'
 };
 
-#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */
-#if defined(PNG_WARNINGS_SUPPORTED) || \
-   (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
 static void /* PRIVATE */
 png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
     error_message)
 {
    png_uint_32 chunk_name = png_ptr->chunk_name;
    int iout = 0, ishift = 24;
 
    while (ishift >= 0)
@@ -754,16 +754,19 @@ png_default_error,(png_const_structrp pn
 }
 
 PNG_FUNCTION(void,PNGAPI
 png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
 {
 #ifdef PNG_SETJMP_SUPPORTED
    if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
       png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(val)
 #endif
 
    /* If control reaches this point, png_longjmp() must not return. The only
     * choice is to terminate the whole process (or maybe the thread); to do
     * this the ANSI-C abort() function is used unless a different method is 
     * implemented by overriding the default configuration setting for
     * PNG_ABORT().
     */
@@ -934,25 +937,25 @@ png_safe_execute(png_imagep image_in, in
    volatile int result;
    volatile png_voidp saved_error_buf;
    jmp_buf safe_jmpbuf;
 
    /* Safely execute function(arg) with png_error returning to this function. */
    saved_error_buf = image->opaque->error_buf;
    result = setjmp(safe_jmpbuf) == 0;
 
-   if (result)
+   if (result != 0)
    {
 
       image->opaque->error_buf = safe_jmpbuf;
       result = function(arg);
    }
 
    image->opaque->error_buf = saved_error_buf;
 
    /* And do the cleanup prior to any failure return. */
-   if (!result)
+   if (result == 0)
       png_image_free(image);
 
    return result;
 }
 #endif /* SIMPLIFIED READ/WRITE */
 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
--- a/media/libpng/pngget.c
+++ b/media/libpng/pngget.c
@@ -1,13 +1,13 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * Last changed in libpng 1.6.1 [March 28, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.11 [June 5, 2014]
+ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
  */
@@ -119,16 +119,19 @@ png_get_x_pixels_per_meter(png_const_str
    if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
       {
          png_debug1(1, "in %s retrieval function",
              "png_get_x_pixels_per_meter");
 
          if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
             return (info_ptr->x_pixels_per_unit);
       }
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(info_ptr)
 #endif
 
    return (0);
 }
 
 png_uint_32 PNGAPI
 png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
     info_ptr)
@@ -137,16 +140,19 @@ png_get_y_pixels_per_meter(png_const_str
    if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
    {
       png_debug1(1, "in %s retrieval function",
           "png_get_y_pixels_per_meter");
 
       if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
          return (info_ptr->y_pixels_per_unit);
    }
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(info_ptr)
 #endif
 
    return (0);
 }
 
 png_uint_32 PNGAPI
 png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
@@ -154,16 +160,19 @@ png_get_pixels_per_meter(png_const_struc
    if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
    {
       png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
 
       if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
           info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
          return (info_ptr->x_pixels_per_unit);
    }
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(info_ptr)
 #endif
 
    return (0);
 }
 
 #ifdef PNG_FLOATING_POINT_SUPPORTED
 float PNGAPI
 png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
@@ -224,64 +233,76 @@ png_get_x_offset_microns(png_const_struc
 #ifdef PNG_oFFs_SUPPORTED
    if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
    {
       png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
 
       if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
          return (info_ptr->x_offset);
    }
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(info_ptr)
 #endif
 
    return (0);
 }
 
 png_int_32 PNGAPI
 png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_oFFs_SUPPORTED
    if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
    {
       png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
 
       if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
          return (info_ptr->y_offset);
    }
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(info_ptr)
 #endif
 
    return (0);
 }
 
 png_int_32 PNGAPI
 png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_oFFs_SUPPORTED
    if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
    {
       png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
 
       if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
          return (info_ptr->x_offset);
    }
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(info_ptr)
 #endif
 
    return (0);
 }
 
 png_int_32 PNGAPI
 png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
 {
 #ifdef PNG_oFFs_SUPPORTED
    if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
    {
       png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
 
       if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
          return (info_ptr->y_offset);
    }
+#else
+   PNG_UNUSED(png_ptr)
+   PNG_UNUSED(info_ptr)
 #endif
 
    return (0);
 }
 
 #ifdef PNG_INCH_CONVERSIONS_SUPPORTED
 static png_uint_32
 ppi_from_ppm(png_uint_32 ppm)
new file mode 100644
--- /dev/null
+++ b/media/libpng/pnglibconf.h
@@ -0,0 +1,690 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef PNGLCONF_H
+#define PNGLCONF_H
+
+/* limit image dimensions (bug #251381, #591822, and #967656) */
+#ifndef MOZ_PNG_MAX_DIMENSION
+# define MOZ_PNG_MAX_DIMENSION 32767
+#endif
+
+#define PNG_API_RULE 0
+#define PNG_COST_SHIFT 3
+#define PNG_GAMMA_THRESHOLD_FIXED 5000
+#define PNG_MAX_GAMMA_8 11
+#define PNG_USER_CHUNK_CACHE_MAX 128
+#define PNG_USER_CHUNK_MALLOC_MAX 4000000L
+#define PNG_USER_HEIGHT_MAX MOZ_PNG_MAX_DIMENSION
+#define PNG_USER_WIDTH_MAX MOZ_PNG_MAX_DIMENSION
+#define PNG_WEIGHT_SHIFT 8
+#define PNG_ZBUF_SIZE 8192
+#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
+#define PNG_INFLATE_BUF_SIZE 1024
+#define PNG_Z_DEFAULT_COMPRESSION (-1)
+#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
+#define PNG_Z_DEFAULT_STRATEGY 1
+#define PNG_sRGB_PROFILE_CHECKS -1
+
+/* This can be deleted when libpng-1.6.14 lands. */
+#define PNG_SET_OPTION_SUPPORTED
+
+#ifdef _MSC_VER
+/* The PNG_PEDANTIC_WARNINGS (attributes) fail to build with some MSC
+ * compilers; we'll play it safe and disable them for all MSC compilers.
+ */
+#define PNG_NO_PEDANTIC_WARNINGS
+#endif
+
+#undef PNG_ARM_NEON_OPT /* This may have been defined in pngpriv.h */
+#ifdef __ARM_NEON__
+#  ifdef MOZ_PNG_HAVE_ARM_NEON
+#    ifdef MOZ_PNG_HAVE_ARM_NEON_CHECK
+#      define PNG_ARM_NEON_CHECK_SUPPORTED
+#      define PNG_ARM_NEON_OPT 1
+#    else
+#      define PNG_ARM_NEON_OPT 2
+#    endif
+#    define PNG_ALIGNED_MEMORY_SUPPORTED
+     /* Accept the PNG_ARM_NEON_IMPLEMENTATION setting from pngpriv.h. */
+#  else
+#    define PNG_ARM_NEON_OPT 0
+#  endif
+#else
+#  define PNG_ARM_NEON_OPT 0
+#endif
+
+#define PNG_READ_SUPPORTED
+#define PNG_PROGRESSIVE_READ_SUPPORTED
+#define PNG_READ_APNG_SUPPORTED
+#define PNG_READ_cHRM_SUPPORTED
+#define PNG_READ_gAMA_SUPPORTED
+#define PNG_READ_iCCP_SUPPORTED
+#define PNG_READ_sRGB_SUPPORTED
+#define PNG_READ_tRNS_SUPPORTED
+#define PNG_READ_16BIT_SUPPORTED
+#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
+#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
+#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
+#define PNG_READ_EXPAND_SUPPORTED
+#define PNG_READ_GAMMA_SUPPORTED
+#define PNG_READ_GRAY_TO_RGB_SUPPORTED
+#define PNG_READ_INTERLACING_SUPPORTED
+#define PNG_READ_SCALE_16_TO_8_SUPPORTED
+#define PNG_READ_TRANSFORMS_SUPPORTED
+
+/* necessary for freetype color bitmap support (Android & B2G)
+   and boot animation code (Gonk) */
+#if defined(ANDROID) || defined(FT_CONFIG_OPTION_USE_PNG)
+#define PNG_READ_PACK_SUPPORTED
+#define PNG_READ_FILLER_SUPPORTED
+#define PNG_READ_STRIP_16_TO_8_SUPPORTED
+#define PNG_READ_USER_TRANSFORM_SUPPORTED
+#define PNG_SEQUENTIAL_READ_SUPPORTED
+#endif
+
+/* necessary for boot animation code (Gonk) */
+#ifdef MOZ_WIDGET_GONK
+#define PNG_UNKNOWN_CHUNKS_SUPPORTED
+#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
+#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+#define PNG_EASY_ACCESS_SUPPORTED
+#define PNG_READ_BGR_SUPPORTED
+#define PNG_READ_GRAY_TO_RGB_SUPPORTED
+#define PNG_READ_STRIP_ALPHA_SUPPORTED
+#endif
+
+#define PNG_WRITE_SUPPORTED
+#define PNG_WRITE_APNG_SUPPORTED
+#define PNG_WRITE_tRNS_SUPPORTED
+#define PNG_WRITE_16BIT_SUPPORTED
+#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
+#define PNG_WRITE_FLUSH_SUPPORTED
+#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
+#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
+
+#define PNG_APNG_SUPPORTED
+#define PNG_ALLOW_BENIGN_ERRORS
+#define PNG_BENIGN_ERRORS_SUPPORTED
+#define PNG_BENIGN_READ_ERRORS_SUPPORTED
+#define PNG_cHRM_SUPPORTED
+#define PNG_COLORSPACE_SUPPORTED
+#define PNG_gAMA_SUPPORTED
+#define PNG_GAMMA_SUPPORTED
+#define PNG_iCCP_SUPPORTED
+#define PNG_sRGB_SUPPORTED
+#define PNG_tRNS_SUPPORTED
+#define PNG_16BIT_SUPPORTED
+#define PNG_CHECK_cHRM_SUPPORTED
+#define PNG_FLOATING_ARITHMETIC_SUPPORTED
+#define PNG_FLOATING_POINT_SUPPORTED
+#define PNG_POINTER_INDEXING_SUPPORTED
+#define PNG_SETJMP_SUPPORTED
+#define PNG_STDIO_SUPPORTED
+#define PNG_TEXT_SUPPORTED
+
+#ifdef PR_LOGGING
+#define PNG_ERROR_TEXT_SUPPORTED
+#define PNG_WARNINGS_SUPPORTED
+#endif
+
+/* Mangle names of exported libpng functions so different libpng versions
+   can coexist. It is recommended that if you do this, you give your
+   library a different name such as "mozlibpng" instead of "libpng". */
+
+/* The following has been present since libpng-0.88, has never changed, and
+   is unaffected by conditional compilation macros.  It will not be mangled
+   and it is the only choice for use in configure scripts for detecting the
+   presence of any libpng version since 0.88.
+
+   png_get_io_ptr
+*/
+
+/* Mozilla: mangle it anyway. */
+#define png_get_io_ptr                  MOZ_PNG_get_io_ptr
+
+/* The following weren't present in libpng-0.88 but have never changed since
+   they were first introduced and are not affected by any conditional compile
+   choices and therefore don't need to be mangled.  We'll mangle them anyway. */
+#define png_sig_cmp                     MOZ_PNG_sig_cmp
+#define png_access_version_number       MOZ_PNG_access_vn
+
+/* These have never changed since they were first introduced but they
+   make direct reference to members of png_ptr that might have been moved,
+   so they will be mangled. */
+
+#define png_set_sig_bytes               MOZ_PNG_set_sig_b
+#define png_reset_zstream               MOZ_PNG_reset_zs
+
+/* The following may have changed, or can be affected by conditional compilation
+   choices, and will be mangled. */
+#define png_64bit_product               MOZ_PNG_64bit_product
+#define png_build_gamma_table           MOZ_PNG_build_gamma_tab
+#define png_build_grayscale_palette     MOZ_PNG_build_g_p
+#define png_calculate_crc               MOZ_PNG_calc_crc
+#define png_calloc                      MOZ_PNG_calloc
+#define png_check_cHRM_fixed            MOZ_PNG_ck_cHRM_fixed
+#define png_check_chunk_name            MOZ_PNG_ck_chunk_name
+#define png_check_IHDR                  MOZ_PNG_ck_IHDR
+#define png_check_keyword               MOZ_PNG_ck_keyword
+#define png_combine_row                 MOZ_PNG_combine_row
+#define png_convert_from_struct_tm      MOZ_PNG_cv_from_struct_tm
+#define png_convert_from_time_t         MOZ_PNG_cv_from_time_t
+#define png_convert_to_rfc1123          MOZ_PNG_cv_to_rfc1123
+#define png_correct_palette             MOZ_PNG_correct_palette
+#define png_crc_error                   MOZ_PNG_crc_error
+#define png_crc_finish                  MOZ_PNG_crc_finish
+#define png_crc_read                    MOZ_PNG_crc_read
+#define png_create_info_struct          MOZ_PNG_cr_info_str
+#define png_create_read_struct          MOZ_PNG_cr_read_str
+#define png_create_read_struct_2        MOZ_PNG_cr_read_str_2
+#define png_create_struct               MOZ_PNG_create_st
+#define png_create_struct_2             MOZ_PNG_create_s2
+#define png_create_write_struct         MOZ_PNG_cr_write_str
+#define png_create_write_struct_2       MOZ_PNG_cr_write_str_2
+#define png_data_freer                  MOZ_PNG_data_freer
+#define png_decompress_chunk            MOZ_PNG_decomp_chunk
+#define png_default_error               MOZ_PNG_def_error
+#define png_default_flush               MOZ_PNG_def_flush
+#define png_default_read_data           MOZ_PNG_def_read_data
+#define png_default_warning             MOZ_PNG_def_warning
+#define png_default_write_data          MOZ_PNG_default_write_data
+#define png_destroy_info_struct         MOZ_PNG_dest_info_str
+#define png_destroy_read_struct         MOZ_PNG_dest_read_str
+#define png_destroy_struct              MOZ_PNG_dest_str
+#define png_destroy_struct_2            MOZ_PNG_dest_str_2
+#define png_destroy_write_struct        MOZ_PNG_dest_write_str
+#define png_digit                       MOZ_PNG_digit
+#define png_do_bgr                      MOZ_PNG_do_bgr
+#define png_do_chop                     MOZ_PNG_do_chop
+#define png_do_expand                   MOZ_PNG_do_expand
+#define png_do_expand_palette           MOZ_PNG_do_expand_plte
+#define png_do_gamma                    MOZ_PNG_do_gamma
+#define png_do_gray_to_rgb              MOZ_PNG_do_g_to_rgb
+#define png_do_invert                   MOZ_PNG_do_invert
+#define png_do_packswap                 MOZ_PNG_do_packswap
+#define png_do_read_filler              MOZ_PNG_do_read_fill
+#define png_do_read_interlace           MOZ_PNG_do_read_int
+#define png_do_read_intrapixel          MOZ_PNG_do_read_intra
+#define png_do_read_invert_alpha        MOZ_PNG_do_read_inv_alph
+#define png_do_read_swap_alpha          MOZ_PNG_do_read_swap_alph
+#define png_do_read_transformations     MOZ_PNG_do_read_trans
+#define png_do_rgb_to_gray              MOZ_PNG_do_rgb_to_g
+#define png_do_shift                    MOZ_PNG_do_shift
+#define png_do_swap                     MOZ_PNG_do_swap
+#define png_do_unpack                   MOZ_PNG_do_unpack
+#define png_do_unshift                  MOZ_PNG_do_unshift
+#define png_do_write_interlace          MOZ_PNG_do_write_interlace
+#define png_do_write_intrapixel         MOZ_PNG_do_write_intrapixel
+#define png_do_write_invert_alpha       MOZ_PNG_do_write_invert_alpha
+#define png_do_write_swap_alpha         MOZ_PNG_do_write_swap_alpha
+#define png_do_write_transformations    MOZ_PNG_do_write_trans
+#define png_err                         MOZ_PNG_err
+#define png_far_to_near                 MOZ_PNG_far_to_near
+#define png_fixed                       MOZ_PNG_fixed
+#define png_flush                       MOZ_PNG_flush
+#define png_format_buffer               MOZ_PNG_format_buf
+#define png_free                        MOZ_PNG_free
+#define png_free_data                   MOZ_PNG_free_data
+#define png_free_default                MOZ_PNG_free_def
+#define png_get_bit_depth               MOZ_PNG_get_bit_depth
+#define png_get_bKGD                    MOZ_PNG_get_bKGD
+#define png_get_channels                MOZ_PNG_get_channels
+#define png_get_cHRM                    MOZ_PNG_get_cHRM
+#define png_get_cHRM_fixed              MOZ_PNG_get_cHRM_fixed
+#define png_get_color_type              MOZ_PNG_get_color_type
+#define png_get_compression_buffer_size MOZ_PNG_get_comp_buf_siz
+#define png_get_compression_type        MOZ_PNG_get_comp_type
+#define png_get_copyright               MOZ_PNG_get_copyright
+#define png_get_error_ptr               MOZ_PNG_get_error_ptr
+#define png_get_filter_type             MOZ_PNG_get_filter_type
+#define png_get_gAMA                    MOZ_PNG_get_gAMA
+#define png_get_gAMA_fixed              MOZ_PNG_get_gAMA_fixed
+#define png_get_header_ver              MOZ_PNG_get_hdr_ver
+#define png_get_header_version          MOZ_PNG_get_hdr_vn
+#define png_get_hIST                    MOZ_PNG_get_hIST
+#define png_get_iCCP                    MOZ_PNG_get_iCCP
+#define png_get_IHDR                    MOZ_PNG_get_IHDR
+#define png_get_image_height            MOZ_PNG_get_image_h
+#define png_get_image_width             MOZ_PNG_get_image_w
+#define png_get_interlace_type          MOZ_PNG_get_interlace_type
+#define png_get_libpng_ver              MOZ_PNG_get_libpng_ver
+#define png_get_mem_ptr                 MOZ_PNG_get_mem_ptr
+#define png_get_oFFs                    MOZ_PNG_get_oFFs
+#define png_get_pCAL                    MOZ_PNG_get_pCAL
+#define png_get_pHYs                    MOZ_PNG_get_pHYs
+#define png_get_pHYs_dpi                MOZ_PNG_get_pHYs_dpi
+#define png_get_pixel_aspect_ratio      MOZ_PNG_get_pixel_aspect_ratio
+#define png_get_pixels_per_inch         MOZ_PNG_get_pixels_per_inch
+#define png_get_pixels_per_meter        MOZ_PNG_get_pixels_p_m
+#define png_get_PLTE                    MOZ_PNG_get_PLTE
+#define png_get_progressive_ptr         MOZ_PNG_get_progressive_ptr
+#define png_get_rgb_to_gray_status      MOZ_PNG_get_rgb_to_gray_status
+#define png_get_rowbytes                MOZ_PNG_get_rowbytes
+#define png_get_rows                    MOZ_PNG_get_rows
+#define png_get_sBIT                    MOZ_PNG_get_sBIT
+#define png_get_sCAL                    MOZ_PNG_get_sCAL
+#define png_get_sCAL_s                  MOZ_PNG_get_sCAL_s
+#define png_get_signature               MOZ_PNG_get_signature
+#define png_get_sPLT                    MOZ_PNG_get_sPLT
+#define png_get_sRGB                    MOZ_PNG_get_sRGB
+#define png_get_text                    MOZ_PNG_get_text
+#define png_get_tIME                    MOZ_PNG_get_tIME
+#define png_get_tRNS                    MOZ_PNG_get_tRNS
+#define png_get_unknown_chunks          MOZ_PNG_get_unk_chunks
+#define png_get_user_chunk_ptr          MOZ_PNG_get_user_chunk_ptr
+#define png_get_user_height_max         MOZ_PNG_get_user_height_max
+#define png_get_user_transform_ptr      MOZ_PNG_get_user_transform_ptr
+#define png_get_user_width_max          MOZ_PNG_get_user_width_max
+#define png_get_valid                   MOZ_PNG_get_valid
+#define png_get_x_offset_inches         MOZ_PNG_get_x_offset_inches
+#define png_get_x_offset_microns        MOZ_PNG_get_x_offs_microns
+#define png_get_x_offset_pixels         MOZ_PNG_get_x_offs_pixels
+#define png_get_x_pixels_per_inch       MOZ_PNG_get_x_pixels_per_inch
+#define png_get_x_pixels_per_meter      MOZ_PNG_get_x_pix_per_meter
+#define png_get_y_offset_inches         MOZ_PNG_get_y_offset_inches
+#define png_get_y_offset_microns        MOZ_PNG_get_y_offs_microns
+#define png_get_y_offset_pixels         MOZ_PNG_get_y_offs_pixels
+#define png_get_y_pixels_per_inch       MOZ_PNG_get_y_pixels_per_inch
+#define png_get_y_pixels_per_meter      MOZ_PNG_get_y_pix_per_meter
+#define png_handle_as_unknown           MOZ_PNG_handle_as_unknown
+#define png_handle_bKGD                 MOZ_PNG_handle_bKGD
+#define png_handle_cHRM                 MOZ_PNG_handle_cHRM
+#define png_handle_gAMA                 MOZ_PNG_handle_gAMA
+#define png_handle_hIST                 MOZ_PNG_handle_hIST
+#define png_handle_iCCP                 MOZ_PNG_handle_iCCP
+#define png_handle_IEND                 MOZ_PNG_handle_IEND
+#define png_handle_IHDR                 MOZ_PNG_handle_IHDR
+#define png_handle_iTXt                 MOZ_PNG_handle_iTXt
+#define png_handle_oFFs                 MOZ_PNG_handle_oFFs
+#define png_handle_pCAL                 MOZ_PNG_handle_pCAL
+#define png_handle_pHYs                 MOZ_PNG_handle_pHYs
+#define png_handle_PLTE                 MOZ_PNG_handle_PLTE
+#define png_handle_sBIT                 MOZ_PNG_handle_sBIT
+#define png_handle_sCAL                 MOZ_PNG_handle_sCAL
+#define png_handle_sPLT                 MOZ_PNG_handle_sPLT
+#define png_handle_sRGB                 MOZ_PNG_handle_sRGB
+#define png_handle_tEXt                 MOZ_PNG_handle_tEXt
+#define png_handle_tIME                 MOZ_PNG_handle_tIME
+#define png_handle_tRNS                 MOZ_PNG_handle_tRNS
+#define png_handle_unknown              MOZ_PNG_handle_unknown
+#define png_handle_zTXt                 MOZ_PNG_handle_zTXt
+#define png_inflate                     MOZ_PNG_inflate
+#define png_info_destroy                MOZ_PNG_info_dest
+#define png_info_init_3                 MOZ_PNG_info_init_3
+#define png_init_io                     MOZ_PNG_init_io
+#define png_init_read_transformations   MOZ_PNG_init_read_transf
+#define png_malloc                      MOZ_PNG_malloc
+#define png_malloc_default              MOZ_PNG_malloc_default
+#define png_malloc_warn                 MOZ_PNG_malloc_warn
+#define png_permit_mng_features         MOZ_PNG_permit_mng_features
+#define png_process_data                MOZ_PNG_process_data
+#define png_process_IDAT_data           MOZ_PNG_proc_IDAT_data
+#define png_process_some_data           MOZ_PNG_proc_some_data
+#define png_progressive_combine_row     MOZ_PNG_progressive_combine_row
+#define png_push_check_crc              MOZ_PNG_push_check_crc
+#define png_push_crc_finish             MOZ_PNG_push_crc_finish
+#define png_push_crc_skip               MOZ_PNG_push_crc_skip
+#define png_push_fill_buffer            MOZ_PNG_push_fill_buffer
+#define png_push_handle_iTXt            MOZ_PNG_push_handle_iTXt
+#define png_push_handle_tEXt            MOZ_PNG_push_handle_tEXt
+#define png_push_handle_unknown         MOZ_PNG_push_handle_unk
+#define png_push_handle_zTXt            MOZ_PNG_push_handle_ztXt
+#define png_push_have_end               MOZ_PNG_push_have_end
+#define png_push_have_info              MOZ_PNG_push_have_info
+#define png_push_have_row               MOZ_PNG_push_have_row
+#define png_push_process_row            MOZ_PNG_push_proc_row
+#define png_push_read_chunk             MOZ_PNG_push_read_chunk
+#define png_push_read_end               MOZ_PNG_push_read_end
+#define png_push_read_IDAT              MOZ_PNG_push_read_IDAT
+#define png_push_read_iTXt              MOZ_PNG_push_read_iTXt
+#define png_push_read_sig               MOZ_PNG_push_read_sig
+#define png_push_read_tEXt              MOZ_PNG_push_read_tEXt
+#define png_push_read_zTXt              MOZ_PNG_push_read_zTXt
+#define png_push_restore_buffer         MOZ_PNG_push_rest_buf
+#define png_push_save_buffer            MOZ_PNG_push_save_buf
+#define png_read_chunk_header           MOZ_PNG_read_chunk_header
+#define png_read_data                   MOZ_PNG_read_data
+#define png_read_destroy                MOZ_PNG_read_dest
+#define png_read_end                    MOZ_PNG_read_end
+#define png_read_filter_row             MOZ_PNG_read_filt_row
+#define png_read_finish_row             MOZ_PNG_read_finish_row
+#define png_read_image                  MOZ_PNG_read_image
+#define png_read_info                   MOZ_PNG_read_info
+#define png_read_png                    MOZ_PNG_read_png
+#define png_read_push_finish_row        MOZ_PNG_read_push_finish_row
+#define png_read_row                    MOZ_PNG_read_row
+#define png_read_rows                   MOZ_PNG_read_rows
+#define png_read_start_row              MOZ_PNG_read_start_row
+#define png_read_transform_info         MOZ_PNG_read_transform_info
+#define png_read_update_info            MOZ_PNG_read_update_info
+#define png_reset_crc                   MOZ_PNG_reset_crc
+#define png_save_int_32                 MOZ_PNG_save_int_32
+#define png_save_uint_16                MOZ_PNG_save_uint_16
+#define png_save_uint_32                MOZ_PNG_save_uint_32
+#define png_set_add_alpha               MOZ_PNG_set_add_alpha
+#define png_set_background              MOZ_PNG_set_background
+#define png_set_benign_errors           MOZ_PNG_set_benign_errors
+#define png_set_bgr                     MOZ_PNG_set_bgr
+#define png_set_bKGD                    MOZ_PNG_set_bKGD
+#define png_set_cHRM                    MOZ_PNG_set_cHRM
+#define png_set_cHRM_fixed              MOZ_PNG_set_cHRM_fixed
+#define png_set_compression_buffer_size MOZ_PNG_set_comp_buf_siz
+#define png_set_compression_level       MOZ_PNG_set_comp_level
+#define png_set_compression_mem_level   MOZ_PNG_set_comp_mem_lev
+#define png_set_compression_method      MOZ_PNG_set_comp_method
+#define png_set_compression_strategy    MOZ_PNG_set_comp_strategy
+#define png_set_compression_window_bits MOZ_PNG_set_comp_win_bits
+#define png_set_crc_action              MOZ_PNG_set_crc_action
+#define png_set_error_fn                MOZ_PNG_set_error_fn
+#define png_set_expand                  MOZ_PNG_set_expand
+#define png_set_expand_gray_1_2_4_to_8  MOZ_PNG_set_x_g_124_to_8
+#define png_set_filler                  MOZ_PNG_set_filler
+#define png_set_filter                  MOZ_PNG_set_filter
+#define png_set_filter_heuristics       MOZ_PNG_set_filter_heur
+#define png_set_flush                   MOZ_PNG_set_flush
+#define png_set_gAMA                    MOZ_PNG_set_gAMA
+#define png_set_gAMA_fixed              MOZ_PNG_set_gAMA_fixed
+#define png_set_gamma                   MOZ_PNG_set_gamma
+#define png_set_gray_to_rgb             MOZ_PNG_set_gray_to_rgb
+#define png_set_hIST                    MOZ_PNG_set_hIST
+#define png_set_iCCP                    MOZ_PNG_set_iCCP
+#define png_set_IHDR                    MOZ_PNG_set_IHDR
+#define png_set_interlace_handling      MOZ_PNG_set_interlace_handling
+#define png_set_invalid                 MOZ_PNG_set_invalid
+#define png_set_invert_alpha            MOZ_PNG_set_invert_alpha
+#define png_set_invert_mono             MOZ_PNG_set_invert_mono
+#define png_set_keep_unknown_chunks     MOZ_PNG_set_keep_unknown_chunks
+#define png_set_mem_fn                  MOZ_PNG_set_mem_fn
+#define png_set_oFFs                    MOZ_PNG_set_oFFs
+
+/* This can be deleted when libpng-1.6.14 lands. */
+#define png_set_option                  MOZ_PNG_set_option
+
+#define png_set_packing                 MOZ_PNG_set_packing
+#define png_set_packswap                MOZ_PNG_set_packswap
+#define png_set_palette_to_rgb          MOZ_PNG_set_palette_to_rgb
+#define png_set_pCAL                    MOZ_PNG_set_pCAL
+#define png_set_pHYs                    MOZ_PNG_set_pHYs
+#define png_set_PLTE                    MOZ_PNG_set_PLTE
+#define png_set_progressive_read_fn     MOZ_PNG_set_progressive_read_fn
+#define png_set_read_fn                 MOZ_PNG_set_read_fn
+#define png_set_read_status_fn          MOZ_PNG_set_read_status_fn
+#define png_set_read_user_chunk_fn      MOZ_PNG_set_read_user_chunk_fn
+#define png_set_read_user_transform_fn  MOZ_PNG_set_read_user_trans_fn
+#define png_set_rgb_to_gray             MOZ_PNG_set_rgb_to_gray
+#define png_set_rgb_to_gray_fixed       MOZ_PNG_set_rgb_to_gray_fixed
+#define png_set_rows                    MOZ_PNG_set_rows
+#define png_set_sBIT                    MOZ_PNG_set_sBIT
+#define png_set_sCAL                    MOZ_PNG_set_sCAL
+#define png_set_sCAL_s                  MOZ_PNG_set_sCAL_s
+#define png_set_shift                   MOZ_PNG_set_shift
+#define png_set_sPLT                    MOZ_PNG_set_sPLT
+#define png_set_sRGB                    MOZ_PNG_set_sRGB
+#define png_set_sRGB_gAMA_and_cHRM      MOZ_PNG_set_sRGB_gAMA_and_cHRM
+#define png_set_strip_16                MOZ_PNG_set_strip_16
+#define png_set_strip_alpha             MOZ_PNG_set_strip_alpha
+#define png_set_strip_error_numbers     MOZ_PNG_set_strip_err_nums
+#define png_set_swap                    MOZ_PNG_set_swap
+#define png_set_swap_alpha              MOZ_PNG_set_swap_alpha
+#define png_set_text                    MOZ_PNG_set_text
+#define png_set_text_2                  MOZ_PNG_set_text_2
+#define png_set_tIME                    MOZ_PNG_set_tIME
+#define png_set_tRNS                    MOZ_PNG_set_tRNS
+#define png_set_tRNS_to_alpha           MOZ_PNG_set_tRNS_to_alpha
+#define png_set_unknown_chunk_location  MOZ_PNG_set_unknown_chunk_loc
+#define png_set_unknown_chunks          MOZ_PNG_set_unknown_chunks
+#define png_set_user_limits             MOZ_PNG_set_user_limits
+#define png_set_user_transform_info     MOZ_PNG_set_user_transform_info
+#define png_set_write_fn                MOZ_PNG_set_write_fn
+#define png_set_write_status_fn         MOZ_PNG_set_write_status_fn
+#define png_set_write_user_transform_fn MOZ_PNG_set_write_user_trans_fn
+#define png_start_read_image            MOZ_PNG_start_read_image
+#define png_text_compress               MOZ_PNG_text_compress
+#define png_write_bKGD                  MOZ_PNG_write_bKGD
+#define png_write_cHRM                  MOZ_PNG_write_cHRM
+#define png_write_cHRM_fixed            MOZ_PNG_write_cHRM_fixed
+#define png_write_chunk                 MOZ_PNG_write_chunk
+#define png_write_chunk_data            MOZ_PNG_write_chunk_data
+#define png_write_chunk_end             MOZ_PNG_write_chunk_end
+#define png_write_chunk_start           MOZ_PNG_write_chunk_start
+#define png_write_compressed_data_out   MOZ_PNG_write_compressed_data_out
+#define png_write_data                  MOZ_PNG_write_data
+#define png_write_destroy               MOZ_PNG_write_destroy
+#define png_write_end                   MOZ_PNG_write_end
+#define png_write_filtered_row          MOZ_PNG_write_filtered_row
+#define png_write_find_filter           MOZ_PNG_write_find_filter
+#define png_write_finish_row            MOZ_PNG_write_finish_row
+#define png_write_flush                 MOZ_PNG_write_flush
+#define png_write_gAMA                  MOZ_PNG_write_gAMA
+#define png_write_gAMA_fixed            MOZ_PNG_write_gAMA_fixed
+#define png_write_hIST                  MOZ_PNG_write_hIST
+#define png_write_iCCP                  MOZ_PNG_write_iCCP
+#define png_write_IDAT                  MOZ_PNG_write_IDAT
+#define png_write_IEND                  MOZ_PNG_write_IEND
+#define png_write_IHDR                  MOZ_PNG_write_IHDR
+#define png_write_image                 MOZ_PNG_write_image
+#define png_write_info                  MOZ_PNG_write_info
+#define png_write_info_before_PLTE      MOZ_PNG_write_info_before_PLTE
+#define png_write_iTXt                  MOZ_PNG_write_iTXt
+#define png_write_oFFs                  MOZ_PNG_write_oFFs
+#define png_write_pCAL                  MOZ_PNG_write_pCAL
+#define png_write_pHYs                  MOZ_PNG_write_pHYs
+#define png_write_PLTE                  MOZ_PNG_write_PLTE
+#define png_write_png                   MOZ_PNG_write_png
+#define png_write_row                   MOZ_PNG_write_row
+#define png_write_rows                  MOZ_PNG_write_rows
+#define png_write_sBIT                  MOZ_PNG_write_sBIT
+#define png_write_sCAL_s                MOZ_PNG_write_sCAL_s
+#define png_write_sig                   MOZ_PNG_write_sig
+#define png_write_sPLT                  MOZ_PNG_write_sPLT
+#define png_write_sRGB                  MOZ_PNG_write_sRGB
+#define png_write_start_row             MOZ_PNG_write_trans
+#define png_write_tEXt                  MOZ_PNG_write_tEXt
+#define png_write_tIME                  MOZ_PNG_write_tIME
+#define png_write_tRNS                  MOZ_PNG_write_tRNS
+#define png_write_zTXt                  MOZ_PNG_write_zTXt
+#define png_zalloc                      MOZ_PNG_zalloc
+#define png_zfree                       MOZ_PNG_zfree
+#define onebppswaptable                 MOZ_onebppswaptable
+#define twobppswaptable                 MOZ_twobppswaptable
+#define fourbppswaptable                MOZ_fourbppswaptable
+
+/* APNG additions */
+#define png_ensure_fcTL_is_valid        MOZ_APNG_ensure_fcTL_is_valid
+#define png_ensure_sequence_number      MOZ_APNG_ensure_seqno
+#define png_get_acTL                    MOZ_APNG_get_acTL
+#define png_get_first_frame_is_hidden   MOZ_APNG_get_first_frame_is_hidden
+#define png_get_next_frame_blend_op     MOZ_APNG_get_next_frame_blend_op
+#define png_get_next_frame_delay_den    MOZ_APNG_get_next_frame_delay_den
+#define png_get_next_frame_delay_num    MOZ_APNG_get_next_frame_delay_num
+#define png_get_next_frame_dispose_op   MOZ_APNG_get_next_frame_dispose_op
+#define png_get_next_frame_fcTL         MOZ_APNG_get_next_frame_fcTL
+#define png_get_next_frame_height       MOZ_APNG_get_next_frame_height
+#define png_get_next_frame_width        MOZ_APNG_get_next_frame_width
+#define png_get_next_frame_x_offset     MOZ_APNG_get_next_frame_x_offset
+#define png_get_next_frame_y_offset     MOZ_APNG_get_next_frame_y_offset
+#define png_get_num_frames              MOZ_APNG_set_num_frames
+#define png_get_num_plays               MOZ_APNG_set_num_plays
+#define png_handle_acTL                 MOZ_APNG_handle_acTL
+#define png_handle_fcTL                 MOZ_APNG_handle_fcTL
+#define png_handle_fdAT                 MOZ_APNG_handle_fdAT
+#define png_have_info                   MOZ_APNG_have_info
+#define png_progressive_read_reset      MOZ_APNG_prog_read_reset
+#define png_read_frame_head             MOZ_APNG_read_frame_head
+#define png_read_reinit                 MOZ_APNG_read_reinit
+#define png_read_reset                  MOZ_APNG_read_reset
+#define png_set_acTL                    MOZ_APNG_set_acTL
+#define png_set_first_frame_is_hidden   MOZ_APNG_set_first_frame_is_hidden
+#define png_set_next_frame_fcTL         MOZ_APNG_set_next_frame_fcTL
+#define png_set_progressive_frame_fn    MOZ_APNG_set_prog_frame_fn
+#define png_write_acTL                  MOZ_APNG_write_acTL
+#define png_write_fcTL                  MOZ_APNG_write_fcTL
+#define png_write_fdAT                  MOZ_APNG_write_fdAT
+#define png_write_frame_head            MOZ_APNG_write_frame_head
+#define png_write_frame_tail            MOZ_APNG_write_frame_tail
+#define png_write_reinit                MOZ_APNG_write_reinit
+#define png_write_reset                 MOZ_APNG_write_reset
+
+/* libpng-1.4.x additions */
+#define png_do_quantize                 MOZ_PNG_do_quantize
+#define png_get_chunk_cache_max         MOZ_PNG_get_chunk_cache_max
+#define png_get_chunk_malloc_max        MOZ_PNG_get_chunk_malloc_max
+#define png_get_io_chunk_name           MOZ_PNG_get_io_chunk_name
+#define png_get_io_state                MOZ_PNG_get_io_state
+#define png_longjmp                     MOZ_PNG_longjmp
+#define png_read_sig                    MOZ_PNG_read_sig
+#define png_set_chunk_cache_max         MOZ_PNG_set_chunk_cache_max
+#define png_set_chunk_malloc_max        MOZ_PNG_set_chunk_malloc_max
+#define png_set_longjmp_fn              MOZ_PNG_set_longjmp_fn
+#define png_set_quantize                MOZ_PNG_set_quantize
+
+/* libpng-1.5.x additions */
+#define png_32bit_exp                             MOZ_PNG_32bit_exp
+#define png_8bit_l2                               MOZ_PNG_8bit_l2
+#define png_ascii_from_fixed                      MOZ_PNG_ascii_from_fixed
+#define png_ascii_from_fp                         MOZ_PNG_ascii_from_fp
+#define png_build_16bit_table                     MOZ_PNG_build_16bit_table
+#define png_build_16to8_table                     MOZ_PNG_build_16to8_table
+#define png_build_8bit_table                      MOZ_PNG_build_8bit_table
+#define png_check_fp_number                       MOZ_PNG_check_fp_number
+#define png_check_fp_string                       MOZ_PNG_check_fp_string
+#define png_chunk_unknown_handling                MOZ_PNG_chunk_unk_handling
+#define png_destroy_gamma_table                   MOZ_PNG_destroy_gamma_table
+#define png_do_compose                            MOZ_PNG_do_compose
+#define png_do_encode_alpha                       MOZ_PNG_do_encode_alpha
+#define png_do_expand_16                          MOZ_PNG_do_expand_16
+#define png_do_scale_16_to_8                      MOZ_PNG_do_scale_16_to_8
+#define png_do_strip_channel                      MOZ_PNG_do_strip_channel
+#define png_exp                                   MOZ_PNG_exp
+#define png_exp16bit                              MOZ_PNG_exp16bit
+#define png_exp8bit                               MOZ_PNG_exp8bit
+#define png_fixed_inches_from_microns             MOZ_PNG_fixed_inch_from_micr
+#define png_format_number                         MOZ_PNG_format_number
+#define png_gamma_16bit_correct                   MOZ_PNG_gamma_16bit_correct
+#define png_gamma_8bit_correct                    MOZ_PNG_gamma_8bit_correct
+#define png_gamma_correct                         MOZ_PNG_gamma_correct
+#define png_gamma_significant                     MOZ_PNG_gamma_significant
+#define png_gamma_threshold                       MOZ_PNG_gamma_threshold
+#define png_get_cHRM_XYZ                          MOZ_PNG_get_cHRM_XYZ
+#define png_get_cHRM_XYZ_fixed                    MOZ_PNG_get_cHRM_XYZ_fixed
+#define png_get_current_pass_number               MOZ_PNG_get_cur_pass_number
+#define png_get_current_row_number                MOZ_PNG_get_cur_row_number
+#define png_get_fixed_point                       MOZ_PNG_get_fixed_point
+#define png_get_io_chunk_type                     MOZ_PNG_get_io_chunk_type
+#define png_get_pixel_aspect_ratio_fixed          MOZ_PNG_get_pixel_aspect_fx
+#define png_get_sCAL_fixed                        MOZ_PNG_get_sCAL_fixed
+#define png_get_x_offset_inches_fixed             MOZ_PNG_get_x_offs_inches_fx
+#define png_get_y_offset_inches_fixed             MOZ_PNG_get_y_offs_inches_fx
+#define png_have_hwcap                            MOZ_PNG_have_hwcap
+#define png_init_filter_functions                 MOZ_PNG_init_filt_func
+#define png_init_filter_functions_neon            MOZ_PNG_init_filt_func_neon
+#define png_init_filter_heuristics                MOZ_PNG_init_filt_heur
+#define png_init_palette_transformations          MOZ_PNG_init_palette_transf
+#define png_init_rgb_transformations              MOZ_PNG_init_rgb_transf
+#define png_log16bit                              MOZ_PNG_log16bit
+#define png_log8bit                               MOZ_PNG_log8bit
+#define png_muldiv                                MOZ_PNG_muldiv
+#define png_muldiv_warn                           MOZ_PNG_muldiv_warn
+#define png_pow10                                 MOZ_PNG_pow10
+#define png_process_data_pause                    MOZ_PNG_process_data_pause
+#define png_process_data_skip                     MOZ_PNG_process_data_skip
+#define png_product2                              MOZ_PNG_product2
+#define png_read_filter_row_avg                   MOZ_PNG_read_filt_row_a
+#define png_read_filter_row_avg3_neon             MOZ_PNG_read_filt_row_a3_neon
+#define png_read_filter_row_avg4_neon             MOZ_PNG_read_filt_row_a4_neon
+#define png_read_filter_row_paeth_1byte_pixel     MOZ_PNG_read_filt_row_p_1b_px
+#define png_read_filter_row_paeth_multibyte_pixel MOZ_PNG_read_filt_row_p_mb_px
+#define png_read_filter_row_paeth3_neon           MOZ_PNG_read_filt_row_p3_neon
+#define png_read_filter_row_paeth4_neon           MOZ_PNG_read_filt_row_p4_neon
+#define png_read_filter_row_sub                   MOZ_PNG_read_filt_row_s
+#define png_read_filter_row_sub3_neon             MOZ_PNG_read_filt_row_s3_neon
+#define png_read_filter_row_sub4_neon             MOZ_PNG_read_filt_row_s4_neon
+#define png_read_filter_row_up                    MOZ_PNG_read_filt_row_up
+#define png_read_filter_row_up_neon               MOZ_PNG_read_filt_row_up_neon
+#define png_reciprocal                            MOZ_PNG_reciprocal
+#define png_reciprocal2                           MOZ_PNG_reciprocal2
+#define png_reset_filter_heuristics               MOZ_PNG_reset_filt_heur
+#define png_safecat                               MOZ_PNG_safecat
+#define png_set_alpha_mode                        MOZ_PNG_set_alpha_mode
+#define png_set_alpha_mode_fixed                  MOZ_PNG_set_alpha_mode_fx
+#define png_set_background_fixed                  MOZ_PNG_set_background_fx
+#define png_set_cHRM_XYZ                          MOZ_PNG_set_cHRM_XYZ
+#define png_set_cHRM_XYZ_fixed                    MOZ_PNG_set_cHRM_XYZ_fixed
+#define png_set_expand_16                         MOZ_PNG_set_expand_16
+#define png_set_filter_heuristics_fixed           MOZ_PNG_set_filter_heur_fx
+#define png_set_gamma_fixed                       MOZ_PNG_set_gamma_fixed
+#define png_set_sCAL_fixed                        MOZ_PNG_set_sCAL_fixed
+#define png_set_scale_16                          MOZ_PNG_set_scale_16
+#define png_set_text_compression_level            MOZ_PNG_set_text_c_level
+#define png_set_text_compression_mem_level        MOZ_PNG_set_text_c_mem_level
+#define png_set_text_compression_method           MOZ_PNG_set_text_c_method
+#define png_set_text_compression_strategy         MOZ_PNG_set_text_c_strategy
+#define png_set_text_compression_window_bits      MOZ_PNG_set_text_c_wnd_bits
+#define png_user_version_check                    MOZ_PNG_user_version_check
+#define png_write_chunk_header                    MOZ_PNG_write_chunk_header
+#define png_write_complete_chunk                  MOZ_PNG_write_complete_chunk
+#define png_xy_from_XYZ                           MOZ_PNG_xy_from_XYZ
+#define png_XYZ_from_xy                           MOZ_PNG_XYZ_from_xy
+#define png_XYZ_from_xy_checked                   MOZ_PNG_XYZ_from_xy_checked
+#define png_zlib_claim                            MOZ_PNG_zlib_claim
+#define png_zlib_release                          MOZ_PNG_zlib_release
+#define convert_gamma_value                       MOZ_convert_gamma_value
+#define ppi_from_ppm                              MOZ_ppi_from_ppm
+#define translate_gamma_flags                     MOZ_translate_gamma_flags
+
+/* libpng-1.6.x additions */
+#define png_app_error                             MOZ_PNG_app_err
+#define png_app_warning                           MOZ_PNG_app_warn
+#ifndef png_benign_error
+#  define png_benign_error                        MOZ_PNG_benign_err
+#endif
+#ifndef png_chunk_benign_error
+#  define png_chunk_benign_error                  MOZ_PNG_chunk_benign_err
+#endif
+#define png_chunk_report                          MOZ_PNG_chunk_report
+#define png_colorspace_set_ICC                    MOZ_PNG_cs_set_ICC
+#define png_colorspace_set_chromaticities         MOZ_PNG_cs_set_chromats
+#define png_colorspace_set_endpoints              MOZ_PNG_cs_set_endpts
+#define png_colorspace_set_gamma                  MOZ_PNG_cs_set_gamma
+#define png_colorspace_set_sRGB                   MOZ_PNG_cs_set_sRGB
+#define png_colorspace_sync                       MOZ_PNG_cs_sync
+#define png_colorspace_sync_info                  MOZ_PNG_cs_sync_info
+#define png_compress_IDAT                         MOZ_PNG_compress_IDAT
+#define png_create_png_struct                     MOZ_PNG_create_png_struct
+#define png_destroy_png_struct                    MOZ_PNG_destroy_png_struct
+#define png_free_buffer_list                      MOZ_PNG_free_buffer_list
+#define png_free_jmpbuf                           MOZ_PNG_free_jmpbuf
+#define png_get_uint_31                           MOZ_PNG_get_uint_31
+#define png_icc_check_header                      MOZ_PNG_icc_check_header
+#define png_icc_check_length                      MOZ_PNG_icc_check_length
+#define png_icc_check_tag_table                   MOZ_PNG_icc_check_tags
+#define png_icc_set_sRGB                          MOZ_PNG_icc_set_sRGB
+#define png_malloc_array                          MOZ_PNG_malloc_array
+#define png_malloc_base                           MOZ_PNG_malloc_base
+#define png_realloc_array                         MOZ_PNG_realloc_array
+#define png_zstream_error                         MOZ_PNG_zstream_error
+
+#if defined(PR_LOGGING)
+#ifndef png_warning
+#  define png_warning                     MOZ_PNG_warning
+#endif
+#ifndef png_chunk_error
+#  define png_chunk_error                 MOZ_PNG_chunk_err
+#endif
+#ifndef png_chunk_warning
+#  define png_chunk_warning               MOZ_PNG_chunk_warn
+#endif
+#define png_fixed_error                 MOZ_PNG_fixed_err
+#define png_formatted_warning           MOZ_PNG_formatted_warning
+#define png_warning_parameter           MOZ_PNG_warn_param
+#define png_warning_parameter_signed    MOZ_PNG_warn_param_signed
+#define png_warning_parameter_unsigned  MOZ_PNG_warn_param_unsigned
+#endif
+
+#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
+#define png_set_packing  MOZ_PNG_set_packing
+#endif
+
+#endif /* PNGLCONF_H */
--- a/media/libpng/pngpread.c
+++ b/media/libpng/pngpread.c
@@ -1,12 +1,12 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
@@ -44,17 +44,17 @@ png_process_data(png_structrp png_ptr, p
 png_size_t PNGAPI
 png_process_data_pause(png_structrp png_ptr, int save)
 {
    if (png_ptr != NULL)
    {
       /* It's easiest for the caller if we do the save, then the caller doesn't
        * have to supply the same data again:
        */
-      if (save)
+      if (save != 0)
          png_push_save_buffer(png_ptr);
       else
       {
          /* This includes any pending saved bytes: */
          png_size_t remaining = png_ptr->buffer_size;
          png_ptr->buffer_size = 0;
 
          /* So subtract the saved buffer size, unless all the data
@@ -1164,25 +1164,25 @@ png_push_process_row(png_structrp png_pt
          png_error(png_ptr, "progressive row overflow");
    }
 
    else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth)
       png_error(png_ptr, "internal progressive row size calculation error");
 
 
 #ifdef PNG_READ_INTERLACING_SUPPORTED
-   /* Blow up interlaced rows to full size */
+   /* Expand interlaced rows to full size */
    if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
    {
       if (png_ptr->pass < 6)
          png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
             png_ptr->transformations);
 
-    switch (png_ptr->pass)
-    {
+      switch (png_ptr->pass)
+      {
          case 0:
          {
             int i;
             for (i = 0; i < 8 && png_ptr->pass == 0; i++)
             {
                png_push_have_row(png_ptr, png_ptr->row_buf + 1);
                png_read_push_finish_row(png_ptr); /* Updates png_ptr->pass */
             }
@@ -1339,27 +1339,25 @@ png_push_process_row(png_structrp png_pt
                break;
 
             png_push_have_row(png_ptr, NULL);
             png_read_push_finish_row(png_ptr);
          }
       }
    }
    else
-#endif
    {
       png_push_have_row(png_ptr, png_ptr->row_buf + 1);
       png_read_push_finish_row(png_ptr);
    }
 }
 
 void /* PRIVATE */
 png_read_push_finish_row(png_structrp png_ptr)
 {
-#ifdef PNG_READ_INTERLACING_SUPPORTED
    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 
    /* Start of interlace block */
    static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
 
    /* Offset to next interlace block */
    static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
 
@@ -1374,17 +1372,16 @@ png_read_push_finish_row(png_structrp pn
    static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
    */
 #endif
 
    png_ptr->row_number++;
    if (png_ptr->row_number < png_ptr->num_rows)
       return;
 
-#ifdef PNG_READ_INTERLACING_SUPPORTED
    if (png_ptr->interlaced)
    {
       png_ptr->row_number = 0;
       memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
 
       do
       {
          png_ptr->pass++;
@@ -1409,17 +1406,16 @@ png_read_push_finish_row(png_structrp pn
 
          png_ptr->num_rows = (png_ptr->height +
              png_pass_yinc[png_ptr->pass] - 1 -
              png_pass_ystart[png_ptr->pass]) /
              png_pass_yinc[png_ptr->pass];
 
       } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
    }
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
 }
 
 void /* PRIVATE */
 png_push_have_info(png_structrp png_ptr, png_inforp info_ptr)
 {
    if (png_ptr->info_fn != NULL)
       (*(png_ptr->info_fn))(png_ptr, info_ptr);
 }
@@ -1434,32 +1430,30 @@ png_push_have_end(png_structrp png_ptr, 
 void /* PRIVATE */
 png_push_have_row(png_structrp png_ptr, png_bytep row)
 {
    if (png_ptr->row_fn != NULL)
       (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
          (int)png_ptr->pass);
 }
 
-#ifdef PNG_READ_INTERLACING_SUPPORTED
 void PNGAPI
 png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
     png_const_bytep new_row)
 {
    if (png_ptr == NULL)
       return;
 
    /* new_row is a flag here - if it is NULL then the app callback was called
     * from an empty row (see the calls to png_struct::row_fn below), otherwise
     * it must be png_ptr->row_buf+1
     */
    if (new_row != NULL)
-      png_combine_row(png_ptr, old_row, 1/*display*/);
+      png_combine_row(png_ptr, old_row, 1/*blocky display*/);
 }
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
 
 void PNGAPI
 png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
     png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
     png_progressive_end_ptr end_fn)
 {
    if (png_ptr == NULL)
       return;
--- a/media/libpng/pngpriv.h
+++ b/media/libpng/pngpriv.h
@@ -1,17 +1,17 @@
 
 /* pngpriv.h - private declarations for use inside libpng
  *
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
- * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Last changed in libpng 1.6.10 [March 6, 1014]]
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
 
 /* The symbols declared in this file (including the functions declared
  * as extern) are PRIVATE.  They are not part of the libpng public
@@ -58,18 +58,16 @@
  */
 #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
 #  include <config.h>
 
    /* Pick up the definition of 'restrict' from config.h if it was read: */
 #  define PNG_RESTRICT restrict
 #endif
 
-#include "mozpngconf.h"
-
 /* To support symbol prefixing it is necessary to know *before* including png.h
  * whether the fixed point (and maybe other) APIs are exported, because if they
  * are not internal definitions may be required.  This is handled below just
  * before png.h is included, but load the configuration now if it is available.
  */
 #ifndef PNGLCONF_H
 #  include "pnglibconf.h"
 #endif
@@ -116,18 +114,22 @@
     * unconditionally on NEON instructions not crashing, otherwise we must
     * disable use of NEON instructions.
     *
     * NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they
     * can only be turned on automatically if that is supported too.  If
     * PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
     * to compile with an appropriate #error if ALIGNED_MEMORY has been turned
     * off.
+    *
+    * Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
+    * check both variants.
     */
-#  if defined(__ARM_NEON__) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
+#  if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
+   defined(PNG_ALIGNED_MEMORY_SUPPORTED)
 #     define PNG_ARM_NEON_OPT 2
 #  else
 #     define PNG_ARM_NEON_OPT 0
 #  endif
 #endif
 
 #if PNG_ARM_NEON_OPT > 0
    /* NEON optimizations are to be at least considered by libpng, so enable the
@@ -145,17 +147,17 @@
     *
     * It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
     * this is *NOT* supported and may cease to work even after a minor revision
     * to libpng.  It *is* valid to do this for testing purposes, e.g. speed
     * testing or a new compiler, but the results should be communicated to the
     * libpng implementation list for incorporation in the next minor release.
     */
 #  ifndef PNG_ARM_NEON_IMPLEMENTATION
-#     ifdef __ARM_NEON__
+#     if defined(__ARM_NEON__) || defined(__ARM_NEON)
 #        if defined(__clang__)
             /* At present it is unknown by the libpng developers which versions
              * of clang support the intrinsics, however some or perhaps all
              * versions do not work with the assembler so this may be
              * irrelevant, so just use the default (do nothing here.)
              */
 #        elif defined(__GNUC__)
             /* GCC 4.5.4 NEON support is known to be broken.  4.6.3 is known to
@@ -833,17 +835,17 @@
 #  error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
       "-I (include path) error: see the notes in pngpriv.h"
    /* This means that when pnglibconf.h was built the copy of zlib.h that it
     * used is not the same as the one being used here.  Because the build of
     * libpng makes decisions to use inflateInit2 and inflateReset2 based on the
     * zlib version number and because this affects handling of certain broken
     * PNG files the -I directives must match.
     *
-    * The most likely explanation is that you passed a -I in CFLAGS, this will
+    * The most likely explanation is that you passed a -I in CFLAGS. This will
     * not work; all the preprocessor directories and in particular all the -I
     * directives must be in CPPFLAGS.
     */
 #endif
 
 /* This is used for 16 bit gamma tables -- only the top level pointers are
  * const; this could be changed:
  */
--- a/media/libpng/pngread.c
+++ b/media/libpng/pngread.c
@@ -1,12 +1,12 @@
 
 /* pngread.c - read a PNG file
  *
- * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
@@ -647,17 +647,17 @@ png_read_row(png_structrp png_ptr, png_b
       if (row_info.pixel_depth > png_ptr->maximum_pixel_depth)
          png_error(png_ptr, "sequential row overflow");
    }
 
    else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth)
       png_error(png_ptr, "internal sequential row size calculation error");
 
 #ifdef PNG_READ_INTERLACING_SUPPORTED
-   /* Blow up interlaced rows to full size */
+   /* Expand interlaced rows to full size */
    if (png_ptr->interlaced &&
       (png_ptr->transformations & PNG_INTERLACE))
    {
       if (png_ptr->pass < 6)
          png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
             png_ptr->transformations);
 
       if (dsp_row != NULL)
@@ -1020,17 +1020,17 @@ png_read_destroy(png_structrp png_ptr)
 #endif
 
    inflateEnd(&png_ptr->zstream);
 
 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
    png_free(png_ptr, png_ptr->save_buffer);
 #endif
 
-#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) &&\
+#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \
    defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
    png_free(png_ptr, png_ptr->unknown_chunk.data);
 #endif
 
 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
    png_free(png_ptr, png_ptr->chunk_list);
 #endif
 
@@ -1295,17 +1295,17 @@ png_read_png(png_structrp png_ptr, png_i
 /* Encoding of PNG data (used by the color-map code) */
 #  define P_NOTSET  0 /* File encoding not yet known */
 #  define P_sRGB    1 /* 8-bit encoded to sRGB gamma */
 #  define P_LINEAR  2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
 #  define P_FILE    3 /* 8-bit encoded to file gamma, not sRGB or linear */
 #  define P_LINEAR8 4 /* 8-bit linear: only from a file value */
 
 /* Color-map processing: after libpng has run on the PNG image further
- * processing may be needed to conver the data to color-map indicies.
+ * processing may be needed to convert the data to color-map indices.
  */
 #define PNG_CMAP_NONE      0
 #define PNG_CMAP_GA        1 /* Process GA data to a color-map with alpha */
 #define PNG_CMAP_TRANS     2 /* Process GA data to a background index */
 #define PNG_CMAP_RGB       3 /* Process RGB data */
 #define PNG_CMAP_RGB_ALPHA 4 /* Process RGBA data */
 
 /* The following document where the background is for each processing case. */
@@ -1863,17 +1863,17 @@ png_create_colormap_entry(png_image_read
       blue = png_sRGB_table[blue];
       alpha *= 257;
       encoding = P_LINEAR;
    }
 
    /* This is set if the color isn't gray but the output is. */
    if (encoding == P_LINEAR)
    {
-      if (convert_to_Y)
+      if (convert_to_Y != 0)
       {
          /* NOTE: these values are copied from png_do_rgb_to_gray */
          png_uint_32 y = (png_uint_32)6968 * red  + (png_uint_32)23434 * green +
             (png_uint_32)2366 * blue;
 
          if (output_encoding == P_LINEAR)
             y = (y + 16384) >> 15;
 
@@ -2262,17 +2262,17 @@ png_image_read_colormap(png_voidp argume
                   png_create_colormap_entry(display, i, back_r, back_g, back_b,
                      back_alpha, output_encoding);
             }
 
             /* We need libpng to preserve the original encoding. */
             data_encoding = P_FILE;
 
             /* The rows from libpng, while technically gray values, are now also
-             * color-map indicies; however, they may need to be expanded to 1
+             * color-map indices; however, they may need to be expanded to 1
              * byte per pixel.  This is what png_set_packing does (i.e., it
              * unpacks the bit values into bytes.)
              */
             if (png_ptr->bit_depth < 8)
                png_set_packing(png_ptr);
          }
 
          else /* bit depth is 16 */
@@ -2348,18 +2348,18 @@ png_image_read_colormap(png_voidp argume
 
                   back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
                }
 
                /* output_processing means that the libpng-processed row will be
                 * 8-bit GA and it has to be processing to single byte color-map
                 * values.  Entry 254 is replaced by either a completely
                 * transparent entry or by the background color at full
-                * precision (and the background color is not a simple gray leve
-                * in this case.)
+                * precision (and the background color is not a simple gray
+                * level in this case.)
                 */
                expand_tRNS = 1;
                output_processing = PNG_CMAP_TRANS;
                background_index = 254;
 
                /* And set (overwrite) color-map entry 254 to the actual
                 * background color at full precision.
                 */
@@ -2827,17 +2827,17 @@ png_image_read_colormap(png_voidp argume
                (output_format & PNG_FORMAT_FLAG_ALPHA) == 0;
             unsigned int i;
 
             /* Just in case: */
             if (trans == NULL)
                num_trans = 0;
 
             output_processing = PNG_CMAP_NONE;
-            data_encoding = P_FILE; /* Don't change from color-map indicies */
+            data_encoding = P_FILE; /* Don't change from color-map indices */
             cmap_entries = png_ptr->num_palette;
             if (cmap_entries > 256)
                cmap_entries = 256;
 
             if (cmap_entries > image->colormap_entries)
                png_error(png_ptr, "palette color-map: too few entries");
 
             for (i=0; i < cmap_entries; ++i)
@@ -2867,17 +2867,17 @@ png_image_read_colormap(png_voidp argume
                }
 
                else
                   png_create_colormap_entry(display, i, colormap[i].red,
                      colormap[i].green, colormap[i].blue,
                      i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/);
             }
 
-            /* The PNG data may have indicies packed in fewer than 8 bits, it
+            /* The PNG data may have indices packed in fewer than 8 bits, it
              * must be expanded if so.
              */
             if (png_ptr->bit_depth < 8)
                png_set_packing(png_ptr);
          }
          break;
 
       default:
@@ -3392,21 +3392,21 @@ png_image_read_composite(png_voidp argum
 
 /* The do_local_background case; called when all the following transforms are to
  * be done:
  *
  * PNG_RGB_TO_GRAY
  * PNG_COMPOSITE
  * PNG_GAMMA
  *
- * This is a work-round for the fact that both the PNG_RGB_TO_GRAY and
+ * This is a work-around for the fact that both the PNG_RGB_TO_GRAY and
  * PNG_COMPOSITE code performs gamma correction, so we get double gamma
- * correction.  The fix-up is to prevent the PNG_COMPOSITE operation happening
- * inside libpng, so this routine sees an 8 or 16-bit gray+alpha row and handles
- * the removal or pre-multiplication of the alpha channel.
+ * correction.  The fix-up is to prevent the PNG_COMPOSITE operation from
+ * happening inside libpng, so this routine sees an 8 or 16-bit gray+alpha
+ * row and handles the removal or pre-multiplication of the alpha channel.
  */
 static int
 png_image_read_background(png_voidp argument)
 {
    png_image_read_control *display = png_voidcast(png_image_read_control*,
       argument);
    png_imagep image = display->image;
    png_structrp png_ptr = image->opaque->png_ptr;
@@ -3661,17 +3661,17 @@ png_image_read_background(png_voidp argu
                            component /= 65535;
                         }
                      }
 
                      else
                         component = 0;
 
                      outrow[swap_alpha] = (png_uint_16)component;
-                     if (preserve_alpha)
+                     if (preserve_alpha != 0)
                         outrow[1 ^ swap_alpha] = alpha;
 
                      inrow += 2; /* components and alpha channel */
                   }
                }
             }
          }
          break;
@@ -3754,17 +3754,17 @@ png_image_read_direct(png_voidp argument
             input_gamma_default = PNG_DEFAULT_sRGB;
 
          /* Call png_set_alpha_mode to set the default for the input gamma; the
           * output gamma is set by a second call below.
           */
          png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default);
       }
 
-      if (linear)
+      if (linear != 0)
       {
          /* If there *is* an alpha channel in the input it must be multiplied
           * out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG.
           */
          if (base_format & PNG_FORMAT_FLAG_ALPHA)
             mode = PNG_ALPHA_STANDARD; /* associated alpha */
 
          else
@@ -3780,17 +3780,17 @@ png_image_read_direct(png_voidp argument
       }
 
       /* If 'do_local_background' is set check for the presence of gamma
        * correction; this is part of the work-round for the libpng bug
        * described above.
        *
        * TODO: fix libpng and remove this.
        */
-      if (do_local_background)
+      if (do_local_background != 0)
       {
          png_fixed_point gtest;
 
          /* This is 'png_gamma_threshold' from pngrtran.c; the test used for
           * gamma correction, the screen gamma hasn't been set on png_struct
           * yet; it's set below.  png_struct::gamma, however, is set to the
           * final value.
           */
@@ -3828,21 +3828,21 @@ png_image_read_direct(png_voidp argument
           */
          if (base_format & PNG_FORMAT_FLAG_ALPHA)
          {
             /* If RGB->gray is happening the alpha channel must be left and the
              * operation completed locally.
              *
              * TODO: fix libpng and remove this.
              */
-            if (do_local_background)
+            if (do_local_background != 0)
                do_local_background = 2/*required*/;
 
             /* 16-bit output: just remove the channel */
-            else if (linear) /* compose on black (well, pre-multiply) */
+            else if (linear != 0) /* compose on black (well, pre-multiply) */
                png_set_strip_alpha(png_ptr);
 
             /* 8-bit output: do an appropriate compose */
             else if (display->background != NULL)
             {
                png_color_16 c;
 
                c.index = 0; /*unused*/
@@ -3879,17 +3879,17 @@ png_image_read_direct(png_voidp argument
             /* This is tricky because it happens before the swap operation has
              * been accomplished; however, the swap does *not* swap the added
              * alpha channel (weird API), so it must be added in the correct
              * place.
              */
             png_uint_32 filler; /* opaque filler */
             int where;
 
-            if (linear)
+            if (linear != 0)
                filler = 65535;
 
             else
                filler = 255;
 
 #           ifdef PNG_FORMAT_AFIRST_SUPPORTED
                if (format & PNG_FORMAT_FLAG_AFIRST)
                {
@@ -3952,61 +3952,61 @@ png_image_read_direct(png_voidp argument
 
             change &= ~PNG_FORMAT_FLAG_AFIRST;
          }
 #     endif
 
       /* If the *output* is 16-bit then we need to check for a byte-swap on this
        * architecture.
        */
-      if (linear)
+      if (linear != 0)
       {
          PNG_CONST png_uint_16 le = 0x0001;
 
          if (*(png_const_bytep)&le)
             png_set_swap(png_ptr);
       }
 
       /* If change is not now 0 some transformation is missing - error out. */
-      if (change)
+      if (change != 0)
          png_error(png_ptr, "png_read_image: unsupported transformation");
    }
 
    PNG_SKIP_CHUNKS(png_ptr);
 
    /* Update the 'info' structure and make sure the result is as required; first
     * make sure to turn on the interlace handling if it will be required
     * (because it can't be turned on *after* the call to png_read_update_info!)
     *
     * TODO: remove the do_local_background fixup below.
     */
-   if (!do_local_compose && do_local_background != 2)
+   if (do_local_compose == 0 && do_local_background != 2)
       passes = png_set_interlace_handling(png_ptr);
 
    png_read_update_info(png_ptr, info_ptr);
 
    {
       png_uint_32 info_format = 0;
 
       if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
          info_format |= PNG_FORMAT_FLAG_COLOR;
 
       if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
       {
          /* do_local_compose removes this channel below. */
-         if (!do_local_compose)
+         if (do_local_compose == 0)
          {
             /* do_local_background does the same if required. */
             if (do_local_background != 2 ||
                (format & PNG_FORMAT_FLAG_ALPHA) != 0)
                info_format |= PNG_FORMAT_FLAG_ALPHA;
          }
       }
 
-      else if (do_local_compose) /* internal error */
+      else if (do_local_compose != 0) /* internal error */
          png_error(png_ptr, "png_image_read: alpha channel lost");
 
       if (info_ptr->bit_depth == 16)
          info_format |= PNG_FORMAT_FLAG_LINEAR;
 
 #     ifdef PNG_FORMAT_BGR_SUPPORTED
          if (png_ptr->transformations & PNG_BGR)
             info_format |= PNG_FORMAT_FLAG_BGR;
@@ -4039,34 +4039,34 @@ png_image_read_direct(png_voidp argument
     * a local row buffer.  The output will be GA, RGBA or BGRA and must be
     * converted to G, RGB or BGR as appropriate.  The 'local_row' member of the
     * display acts as a flag.
     */
    {
       png_voidp first_row = display->buffer;
       ptrdiff_t row_bytes = display->row_stride;
 
-      if (linear)
+      if (linear != 0)
          row_bytes *= 2;
 
       /* The following expression is designed to work correctly whether it gives
        * a signed or an unsigned result.
        */
       if (row_bytes < 0)
       {
          char *ptr = png_voidcast(char*, first_row);
          ptr += (image->height-1) * (-row_bytes);
          first_row = png_voidcast(png_voidp, ptr);
       }
 
       display->first_row = first_row;
       display->row_bytes = row_bytes;
    }
 
-   if (do_local_compose)
+   if (do_local_compose != 0)
    {
       int result;
       png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
 
       display->local_row = row;
       result = png_safe_execute(image, png_image_read_composite, display);
       display->local_row = NULL;
       png_free(png_ptr, row);
--- a/media/libpng/pngrtran.c
+++ b/media/libpng/pngrtran.c
@@ -1,12 +1,12 @@
 
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
- * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
@@ -138,17 +138,17 @@ png_set_background_fixed(png_structrp pn
 
    png_ptr->transformations |= PNG_COMPOSE | PNG_STRIP_ALPHA;
    png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
    png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
 
    png_ptr->background = *background_color;
    png_ptr->background_gamma = background_gamma;
    png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
-   if (need_expand)
+   if (need_expand != 0)
       png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
    else
       png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
 }
 
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
 void PNGAPI
 png_set_background(png_structrp png_ptr,
@@ -221,26 +221,26 @@ translate_gamma_flags(png_structrp png_p
       /* If there is no sRGB support this just sets the gamma to the standard
        * sRGB value.  (This is a side effect of using this function!)
        */
 #     ifdef PNG_READ_sRGB_SUPPORTED
          png_ptr->flags |= PNG_FLAG_ASSUME_sRGB;
 #     else
          PNG_UNUSED(png_ptr)
 #     endif
-      if (is_screen)
+      if (is_screen != 0)
          output_gamma = PNG_GAMMA_sRGB;
       else
          output_gamma = PNG_GAMMA_sRGB_INVERSE;
    }
 
    else if (output_gamma == PNG_GAMMA_MAC_18 ||
       output_gamma == PNG_FP_1 / PNG_GAMMA_MAC_18)
    {
-      if (is_screen)
+      if (is_screen != 0)
          output_gamma = PNG_GAMMA_MAC_OLD;
       else
          output_gamma = PNG_GAMMA_MAC_INVERSE;
    }
 
    return output_gamma;
 }
 
@@ -358,17 +358,17 @@ png_set_alpha_mode_fixed(png_structrp pn
    }
 
    /* But always set the output gamma: */
    png_ptr->screen_gamma = output_gamma;
 
    /* Finally, if pre-multiplying, set the background fields to achieve the
     * desired result.
     */
-   if (compose)
+   if (compose != 0)
    {
       /* And obtain alpha pre-multiplication by composing on black: */
       memset(&png_ptr->background, 0, (sizeof png_ptr->background));
       png_ptr->background_gamma = png_ptr->colorspace.gamma; /* just in case */
       png_ptr->background_gamma_type = PNG_BACKGROUND_GAMMA_FILE;
       png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
 
       if (png_ptr->transformations & PNG_COMPOSE)
@@ -415,17 +415,17 @@ png_set_quantize(png_structrp png_ptr, p
 {
    png_debug(1, "in png_set_quantize");
 
    if (!png_rtran_ok(png_ptr, 0))
       return;
 
    png_ptr->transformations |= PNG_QUANTIZE;
 
-   if (!full_quantize)
+   if (full_quantize == 0)
    {
       int i;
 
       png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
           (png_uint_32)(num_palette * (sizeof (png_byte))));
       for (i = 0; i < num_palette; i++)
          png_ptr->quantize_index[i] = (png_byte)i;
    }
@@ -470,22 +470,22 @@ png_set_quantize(png_structrp png_ptr, p
 
                   t = png_ptr->quantize_sort[j];
                   png_ptr->quantize_sort[j] = png_ptr->quantize_sort[j + 1];
                   png_ptr->quantize_sort[j + 1] = t;
                   done = 0;
                }
             }
 
-            if (done)
+            if (done != 0)
                break;
          }
 
          /* Swap the palette around, and set up a table, if necessary */
-         if (full_quantize)
+         if (full_quantize != 0)
          {
             int j = num_palette;
 
             /* Put all the useful colors within the max, but don't
              * move the others.
              */
             for (i = 0; i < maximum_colors; i++)
             {
@@ -658,17 +658,17 @@ png_set_quantize(png_structrp png_ptr, p
                         {
                            j = p->right;
                            next_j = p->left;
                         }
 
                         num_new_palette--;
                         palette[png_ptr->index_to_palette[j]]
                             = palette[num_new_palette];
-                        if (!full_quantize)
+                        if (full_quantize == 0)
                         {
                            int k;
 
                            for (k = 0; k < num_palette; k++)
                            {
                               if (png_ptr->quantize_index[k] ==
                                   png_ptr->index_to_palette[j])
                                  png_ptr->quantize_index[k] =
@@ -726,17 +726,17 @@ png_set_quantize(png_structrp png_ptr, p
       num_palette = maximum_colors;
    }
    if (png_ptr->palette == NULL)
    {
       png_ptr->palette = palette;
    }
    png_ptr->num_palette = (png_uint_16)num_palette;
 
-   if (full_quantize)
+   if (full_quantize != 0)
    {
       int i;
       png_bytep distance;
       int total_bits = PNG_QUANTIZE_RED_BITS + PNG_QUANTIZE_GREEN_BITS +
           PNG_QUANTIZE_BLUE_BITS;
       int num_red = (1 << PNG_QUANTIZE_RED_BITS);
       int num_green = (1 << PNG_QUANTIZE_GREEN_BITS);
       int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS);
@@ -1126,26 +1126,26 @@ png_init_palette_transformations(png_str
             input_has_transparency = 1;
             input_has_alpha = 1;
             break;
          }
       }
    }
 
    /* If no alpha we can optimize. */
-   if (!input_has_alpha)
+   if (input_has_alpha == 0)
    {
       /* Any alpha means background and associative alpha processing is
        * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
        * and ENCODE_ALPHA are irrelevant.
        */
       png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
       png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
 
-      if (!input_has_transparency)
+      if (input_has_transparency == 0)
          png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
    }
 
 #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
    /* png_set_background handling - deals with the complexity of whether the
     * background color is in the file format or the screen format in the case
     * where an 'expand' will happen.
     */
@@ -1191,28 +1191,28 @@ png_init_rgb_transformations(png_structr
    /* Added to libpng-1.5.4: check the color type to determine whether there
     * is any alpha or transparency in the image and simply cancel the
     * background and alpha mode stuff if there isn't.
     */
    int input_has_alpha = (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0;
    int input_has_transparency = png_ptr->num_trans > 0;
 
    /* If no alpha we can optimize. */
-   if (!input_has_alpha)
+   if (input_has_alpha == 0)
    {
       /* Any alpha means background and associative alpha processing is
        * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
        * and ENCODE_ALPHA are irrelevant.
        */
 #     ifdef PNG_READ_ALPHA_MODE_SUPPORTED
          png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
          png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
 #     endif
 
-      if (!input_has_transparency)
+      if (input_has_transparency == 0)
          png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
    }
 
 #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
    /* png_set_background handling - deals with the complexity of whether the
     * background color is in the file format or the screen format in the case
     * where an 'expand' will happen.
     */
@@ -1331,17 +1331,17 @@ png_init_read_transformations(png_struct
       /* Now turn the gamma transformation on or off as appropriate.  Notice
        * that PNG_GAMMA just refers to the file->screen correction.  Alpha
        * composition may independently cause gamma correction because it needs
        * linear data (e.g. if the file has a gAMA chunk but the screen gamma
        * hasn't been specified.)  In any case this flag may get turned off in
        * the code immediately below if the transform can be handled outside the
        * row loop.
        */
-      if (gamma_correction)
+      if (gamma_correction != 0)
          png_ptr->transformations |= PNG_GAMMA;
 
       else
          png_ptr->transformations &= ~PNG_GAMMA;
    }
 #endif
 
    /* Certain transformations have the effect of preventing other
@@ -1738,42 +1738,42 @@ png_init_read_transformations(png_struct
 
                default:
                   png_error(png_ptr, "invalid background gamma type");
             }
 
             g_sig = png_gamma_significant(g);
             gs_sig = png_gamma_significant(gs);
 
-            if (g_sig)
+            if (g_sig != 0)
                png_ptr->background_1.gray = png_gamma_correct(png_ptr,
                    png_ptr->background.gray, g);
 
-            if (gs_sig)
+            if (gs_sig != 0)
                png_ptr->background.gray = png_gamma_correct(png_ptr,
                    png_ptr->background.gray, gs);
 
             if ((png_ptr->background.red != png_ptr->background.green) ||
                 (png_ptr->background.red != png_ptr->background.blue) ||
                 (png_ptr->background.red != png_ptr->background.gray))
             {
                /* RGB or RGBA with color background */
-               if (g_sig)
+               if (g_sig != 0)
                {
                   png_ptr->background_1.red = png_gamma_correct(png_ptr,
                       png_ptr->background.red, g);
 
                   png_ptr->background_1.green = png_gamma_correct(png_ptr,
                       png_ptr->background.green, g);
 
                   png_ptr->background_1.blue = png_gamma_correct(png_ptr,
                       png_ptr->background.blue, g);
                }
 
-               if (gs_sig)
+               if (gs_sig != 0)
                {
                   png_ptr->background.red = png_gamma_correct(png_ptr,
                       png_ptr->background.red, gs);
 
                   png_ptr->background.green = png_gamma_correct(png_ptr,
                       png_ptr->background.green, gs);
 
                   png_ptr->background.blue = png_gamma_correct(png_ptr,
@@ -2113,17 +2113,17 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTE
     * check in png_rowbytes that the user buffer won't get overwritten.  Note
     * that the field is not always set - if png_read_update_info isn't called
     * the application has to either not do any transforms or get the calculation
     * right itself.
     */
    png_ptr->info_rowbytes = info_ptr->rowbytes;
 
 #ifndef PNG_READ_EXPAND_SUPPORTED
-   if (png_ptr)
+   if (png_ptr != NULL)
       return;
 #endif
 }
 
 #ifdef PNG_READ_PACK_SUPPORTED
 /* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel,
  * without changing the actual values.  Thus, if you had a row with
  * a bit depth of 1, you would end up with bytes that only contained
@@ -2272,17 +2272,17 @@ png_do_unshift(png_row_infop row_info, p
              */
             if (shift[c] <= 0 || shift[c] >= bit_depth)
                shift[c] = 0;
 
             else
                have_shift = 1;
          }
 
-         if (!have_shift)
+         if (have_shift == 0)
             return;
       }
 
       switch (bit_depth)
       {
          default:
          /* Must be 1bpp gray: should not be here! */
             /* NOTREACHED */
@@ -3033,17 +3033,17 @@ png_do_rgb_to_gray(png_structrp png_ptr,
                    * set.
                    */
                   if (png_ptr->gamma_table != NULL)
                      red = png_ptr->gamma_table[red];
 
                   *(dp++) = red;
                }
 
-               if (have_alpha)
+               if (have_alpha != 0)
                   *(dp++) = *(sp++);
             }
          }
          else
 #endif
          {
             png_bytep sp = row;
             png_bytep dp = row;
@@ -3062,17 +3062,17 @@ png_do_rgb_to_gray(png_structrp png_ptr,
                    * truncates the results.
                    */
                   *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
                }
 
                else
                   *(dp++) = red;
 
-               if (have_alpha)
+               if (have_alpha != 0)
                   *(dp++) = *(sp++);
             }
          }
       }
 
       else /* RGB bit_depth == 16 */
       {
 #ifdef PNG_READ_GAMMA_SUPPORTED
@@ -3114,17 +3114,17 @@ png_do_rgb_to_gray(png_structrp png_ptr,
                   w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
                       png_ptr->gamma_shift][gray16 >> 8];
                   rgb_error |= 1;
                }
 
                *(dp++) = (png_byte)((w>>8) & 0xff);
                *(dp++) = (png_byte)(w & 0xff);
 
-               if (have_alpha)
+               if (have_alpha != 0)
                {
                   *(dp++) = *(sp++);
                   *(dp++) = *(sp++);
                }
             }
          }
          else
 #endif
@@ -3148,17 +3148,17 @@ png_do_rgb_to_gray(png_structrp png_ptr,
                 * in the 'fast' case - this is because this is where the code
                 * ends up when handling linear 16 bit data.
                 */
                gray16  = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
                   15);
                *(dp++) = (png_byte)((gray16>>8) & 0xff);
                *(dp++) = (png_byte)(gray16 & 0xff);
 
-               if (have_alpha)
+               if (have_alpha != 0)
                {
                   *(dp++) = *(sp++);
                   *(dp++) = *(sp++);
                }
             }
          }
       }
 
@@ -3216,17 +3216,17 @@ png_do_compose(png_row_infop row_info, p
                      if ((png_uint_16)((*sp >> shift) & 0x01)
                         == png_ptr->trans_color.gray)
                      {
                         unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
                         tmp |= png_ptr->background.gray << shift;
                         *sp = (png_byte)(tmp & 0xff);
                      }
 
-                     if (!shift)
+                     if (shift == 0)
                      {
                         shift = 7;
                         sp++;
                      }
 
                      else
                         shift--;
                   }
@@ -3255,17 +3255,17 @@ png_do_compose(png_row_infop row_info, p
                            unsigned int p = (*sp >> shift) & 0x03;
                            unsigned int g = (gamma_table [p | (p << 2) |
                                (p << 4) | (p << 6)] >> 6) & 0x03;
                            unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
                            tmp |= g << shift;
                            *sp = (png_byte)(tmp & 0xff);
                         }
 
-                        if (!shift)
+                        if (shift == 0)
                         {
                            shift = 6;
                            sp++;
                         }
 
                         else
                            shift -= 2;
                      }
@@ -3281,17 +3281,17 @@ png_do_compose(png_row_infop row_info, p
                         if ((png_uint_16)((*sp >> shift) & 0x03)
                             == png_ptr->trans_color.gray)
                         {
                            unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
                            tmp |= png_ptr->background.gray << shift;
                            *sp = (png_byte)(tmp & 0xff);
                         }
 
-                        if (!shift)
+                        if (shift == 0)
                         {
                            shift = 6;
                            sp++;
                         }
 
                         else
                            shift -= 2;
                      }
@@ -3321,17 +3321,17 @@ png_do_compose(png_row_infop row_info, p
                            unsigned int p = (*sp >> shift) & 0x0f;
                            unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
                               0x0f;
                            unsigned int tmp = *sp & (0xf0f >> (4 - shift));
                            tmp |= g << shift;
                            *sp = (png_byte)(tmp & 0xff);
                         }
 
-                        if (!shift)
+                        if (shift == 0)
                         {
                            shift = 4;
                            sp++;
                         }
 
                         else
                            shift -= 4;
                      }
@@ -3347,17 +3347,17 @@ png_do_compose(png_row_infop row_info, p
                         if ((png_uint_16)((*sp >> shift) & 0x0f)
                             == png_ptr->trans_color.gray)
                         {
                            unsigned int tmp = *sp & (0xf0f >> (4 - shift));
                            tmp |= png_ptr->background.gray << shift;
                            *sp = (png_byte)(tmp & 0xff);
                         }
 
-                        if (!shift)
+                        if (shift == 0)
                         {
                            shift = 4;
                            sp++;
                         }
 
                         else
                            shift -= 4;
                      }
@@ -3600,17 +3600,17 @@ png_do_compose(png_row_infop row_info, p
                      }
 
                      else
                      {
                         png_byte v, w;
 
                         v = gamma_to_1[*sp];
                         png_composite(w, v, a, png_ptr->background_1.gray);
-                        if (!optimize)
+                        if (optimize == 0)
                            w = gamma_from_1[w];
                         *sp = w;
                      }
                   }
                }
                else
 #endif
                {
@@ -3657,17 +3657,17 @@ png_do_compose(png_row_infop row_info, p
                      }
 
                      else
                      {
                         png_uint_16 g, v, w;
 
                         g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
                         png_composite_16(v, g, a, png_ptr->background_1.gray);
-                        if (optimize)
+                        if (optimize != 0)
                            w = v;
                         else
                            w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
                         *sp = (png_byte)((w >> 8) & 0xff);
                         *(sp + 1) = (png_byte)(w & 0xff);
                      }
                   }
                }
@@ -3731,27 +3731,27 @@ png_do_compose(png_row_infop row_info, p
                      }
 
                      else
                      {
                         png_byte v, w;
 
                         v = gamma_to_1[*sp];
                         png_composite(w, v, a, png_ptr->background_1.red);
-                        if (!optimize) w = gamma_from_1[w];
+                        if (optimize == 0) w = gamma_from_1[w];
                         *sp = w;
 
                         v = gamma_to_1[*(sp + 1)];
                         png_composite(w, v, a, png_ptr->background_1.green);
-                        if (!optimize) w = gamma_from_1[w];
+                        if (optimize == 0) w = gamma_from_1[w];
                         *(sp + 1) = w;
 
                         v = gamma_to_1[*(sp + 2)];
                         png_composite(w, v, a, png_ptr->background_1.blue);
-                        if (!optimize) w = gamma_from_1[w];
+                        if (optimize == 0) w = gamma_from_1[w];
                         *(sp + 2) = w;
                      }
                   }
                }
                else
 #endif
                {
                   sp = row;
@@ -3823,34 +3823,34 @@ png_do_compose(png_row_infop row_info, p
                      }
 
                      else
                      {
                         png_uint_16 v, w;
 
                         v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
                         png_composite_16(w, v, a, png_ptr->background_1.red);
-                        if (!optimize)
+                        if (optimize == 0)
                            w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
                                 8];
                         *sp = (png_byte)((w >> 8) & 0xff);
                         *(sp + 1) = (png_byte)(w & 0xff);
 
                         v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
                         png_composite_16(w, v, a, png_ptr->background_1.green);
-                        if (!optimize)
+                        if (optimize == 0)
                            w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
                                 8];
 
                         *(sp + 2) = (png_byte)((w >> 8) & 0xff);
                         *(sp + 3) = (png_byte)(w & 0xff);
 
                         v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
                         png_composite_16(w, v, a, png_ptr->background_1.blue);
-                        if (!optimize)
+                        if (optimize == 0)
                            w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
                                 8];
 
                         *(sp + 4) = (png_byte)((w >> 8) & 0xff);
                         *(sp + 5) = (png_byte)(w & 0xff);
                      }
                   }
                }
@@ -4758,17 +4758,17 @@ png_do_read_transformations(png_structrp
 
 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
    if (png_ptr->transformations & PNG_RGB_TO_GRAY)
    {
       int rgb_error =
           png_do_rgb_to_gray(png_ptr, row_info,
               png_ptr->row_buf + 1);
 
-      if (rgb_error)
+      if (rgb_error != 0)
       {
          png_ptr->rgb_to_gray_status=1;
          if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
              PNG_RGB_TO_GRAY_WARN)
             png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
 
          if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
              PNG_RGB_TO_GRAY_ERR)
--- a/media/libpng/pngrutil.c
+++ b/media/libpng/pngrutil.c
@@ -1,12 +1,12 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
@@ -260,17 +260,17 @@ png_crc_error(png_structrp png_ptr)
 
 #ifdef PNG_IO_STATE_SUPPORTED
    png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC;
 #endif
 
    /* The chunk CRC must be serialized in a single I/O call. */
    png_read_data(png_ptr, crc_bytes, 4);
 
-   if (need_crc)
+   if (need_crc != 0)
    {
       crc = png_get_uint_32(crc_bytes);
       return ((int)(crc != png_ptr->crc));
    }
 
    else
       return (0);
 }
@@ -306,17 +306,17 @@ png_read_buffer(png_structrp png_ptr, pn
       if (buffer != NULL)
       {
          png_ptr->read_buffer = buffer;
          png_ptr->read_buffer_size = new_size;
       }
 
       else if (warn < 2) /* else silent */
       {
-         if (warn)
+         if (warn != 0)
              png_chunk_warning(png_ptr, "insufficient memory to read chunk");
 
          else
              png_chunk_error(png_ptr, "insufficient memory to read chunk");
       }
    }
 
    return buffer;
@@ -632,17 +632,17 @@ png_decompress_chunk(png_structrp png_pt
                   ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
                      png_ptr->read_buffer + prefix_size, &lzsize,
                      text + prefix_size, newlength);
 
                   if (ret == Z_STREAM_END)
                   {
                      if (new_size == *newlength)
                      {
-                        if (terminate)
+                        if (terminate != 0)
                            text[prefix_size + *newlength] = 0;
 
                         if (prefix_size > 0)
                            memcpy(text, png_ptr->read_buffer, prefix_size);
 
                         {
                            png_bytep old_ptr = png_ptr->read_buffer;
 
@@ -1319,19 +1319,19 @@ png_handle_iCCP(png_structrp png_ptr, pn
       png_chunk_benign_error(png_ptr, "out of place");
       return;
    }
 
    /* Consistent with all the above colorspace handling an obviously *invalid*
     * chunk is just ignored, so does not invalidate the color space.  An
     * alternative is to set the 'invalid' flags at the start of this routine
     * and only clear them in they were not set before and all the tests pass.
-    * The minimum 'deflate' stream is assumed to be just the 2 byte header and 4
-    * byte checksum.  The keyword must be one character and there is a
-    * terminator (0) byte and the compression method.
+    * The minimum 'deflate' stream is assumed to be just the 2 byte header and
+    * 4 byte checksum.  The keyword must be at least one character and there is
+    * a terminator (0) byte and the compression method.
     */
    if (length < 9)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "too short");
       return;
    }
 
@@ -1558,17 +1558,17 @@ png_handle_iCCP(png_structrp png_ptr, pn
       else
          errmsg = "bad keyword";
    }
 
    else
       errmsg = "too many profiles";
 
    /* Failure: the reason is in 'errmsg' */
-   if (!finished)
+   if (finished == 0)
       png_crc_finish(png_ptr, length);
 
    png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
    png_colorspace_sync(png_ptr, info_ptr);
    if (errmsg != NULL) /* else already output */
       png_chunk_benign_error(png_ptr, errmsg);
 }
 #endif /* PNG_READ_iCCP_SUPPORTED */
@@ -2640,17 +2640,17 @@ png_handle_iTXt(png_structrp png_ptr, pn
 
       for (; prefix_length < length && buffer[prefix_length] != 0;
          ++prefix_length)
          /* Empty loop */ ;
 
       /* prefix_length should now be at the trailing '\0' of the translated
        * keyword, but it may already be over the end.  None of this arithmetic
        * can overflow because chunks are at most 2^31 bytes long, but on 16-bit
-       * systems the available allocaton may overflow.
+       * systems the available allocation may overflow.
        */
       ++prefix_length;
 
       if (!compressed && prefix_length <= length)
          uncompressed_length = length - prefix_length;
 
       else if (compressed && prefix_length < length)
       {
@@ -2672,17 +2672,17 @@ png_handle_iTXt(png_structrp png_ptr, pn
          errmsg = "truncated";
 
       if (errmsg == NULL)
       {
          png_text text;
 
          buffer[uncompressed_length+prefix_length] = 0;
 
-         if (compressed)
+         if (compressed != 0)
             text.compression = PNG_ITXT_COMPRESSION_NONE;
 
          else
             text.compression = PNG_ITXT_COMPRESSION_zTXt;
 
          text.key = (png_charp)buffer;
          text.lang = (png_charp)buffer + language_offset;
          text.lang_key = (png_charp)buffer + translated_keyword_offset;
@@ -3326,17 +3326,17 @@ png_combine_row(png_const_structrp png_p
          /* Utility macros to construct all the masks for a depth/swap
           * combination.  The 's' parameter says whether the format is PNG
           * (big endian bytes) or not.  Only the three odd-numbered passes are
           * required for the display/block algorithm.
           */
 #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
             S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
 
-#        define B_MASKS(d,s) { B_MASK(1,d,s), S_MASK(3,d,s), S_MASK(5,d,s) }
+#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
 
 #        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
 
          /* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and
           * then pass:
           */
          static PNG_CONST png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] =
          {
@@ -3365,17 +3365,17 @@ png_combine_row(png_const_structrp png_p
          /* This is the runtime alternative: it seems unlikely that this will
           * ever be either smaller or faster than the compile time approach.
           */
 #        define MASK(pass,depth,display,png)\
             ((display)?B_MASK(pass,depth,png):S_MASK(pass,depth,png))
 #endif /* !PNG_USE_COMPILE_TIME_MASKS */
 
          /* Use the appropriate mask to copy the required bits.  In some cases
-          * the byte mask will be 0 or 0xff, optimize these cases.  row_width is
+          * the byte mask will be 0 or 0xff; optimize these cases.  row_width is
           * the number of pixels, but the code copies bytes, so it is necessary
           * to special case the end.
           */
          png_uint_32 pixels_per_byte = 8 / pixel_depth;
          png_uint_32 mask;
 
 #        ifdef PNG_READ_PACKSWAP_SUPPORTED
             if (png_ptr->transformations & PNG_PACKSWAP)
@@ -3437,17 +3437,17 @@ png_combine_row(png_const_structrp png_p
             unsigned int offset = PNG_PASS_START_COL(pass) * pixel_depth;
 
             row_width -= offset;
             dp += offset;
             sp += offset;
          }
 
          /* Work out the bytes to copy. */
-         if (display)
+         if (display != 0)
          {
             /* When doing the 'block' algorithm the pixel in the pass gets
              * replicated to adjacent pixels.  This is why the even (0,2,4,6)
              * passes are skipped above - the entire expanded row is copied.
              */
             bytes_to_copy = (1<<((6-pass)>>1)) * pixel_depth;
 
             /* But don't allow this number to exceed the actual row width. */
@@ -3637,17 +3637,17 @@ png_combine_row(png_const_structrp png_p
          }
 
          /* NOT REACHED*/
       } /* pixel_depth >= 8 */
 
       /* Here if pixel_depth < 8 to check 'end_ptr' below. */
    }
    else
-#endif
+#endif /* PNG_READ_INTERLACING_SUPPORTED */
 
    /* If here then the switch above wasn't used so just memcpy the whole row
     * from the temporary row buffer (notice that this overwrites the end of the
     * destination row if it is a partial byte.)
     */
    memcpy(dp, sp, PNG_ROWBYTES(pixel_depth, row_width));
 
    /* Restore the overwritten bits from the last byte if necessary. */
@@ -4323,38 +4323,35 @@ png_read_finish_IDAT(png_structrp png_pt
        */
       (void)png_crc_finish(png_ptr, png_ptr->idat_size);
    }
 }
 
 void /* PRIVATE */
 png_read_finish_row(png_structrp png_ptr)
 {
-#ifdef PNG_READ_INTERLACING_SUPPORTED
    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 
    /* Start of interlace block */
    static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
 
    /* Offset to next interlace block */
    static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 
    /* Start of interlace block in the y direction */
    static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
 
    /* Offset to next interlace block in the y direction */
    static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
 
    png_debug(1, "in png_read_finish_row");
    png_ptr->row_number++;
    if (png_ptr->row_number < png_ptr->num_rows)
       return;
 
-#ifdef PNG_READ_INTERLACING_SUPPORTED
    if (png_ptr->interlaced)
    {
       png_ptr->row_number = 0;
 
       /* TO DO: don't do this if prev_row isn't needed (requires
        * read-ahead of the next row's filter byte.
        */
       memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
@@ -4382,68 +4379,63 @@ png_read_finish_row(png_structrp png_ptr
          else  /* if (png_ptr->transformations & PNG_INTERLACE) */
             break; /* libpng deinterlacing sees every row */
 
       } while (png_ptr->num_rows == 0 || png_ptr->iwidth == 0);
 
       if (png_ptr->pass < 7)
          return;
    }
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
 
    /* Here after at the end of the last row of the last pass. */
    png_read_finish_IDAT(png_ptr);
 }
 #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
 
 void /* PRIVATE */
 png_read_start_row(png_structrp png_ptr)
 {
-#ifdef PNG_READ_INTERLACING_SUPPORTED
    /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
 
    /* Start of interlace block */
    static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
 
    /* Offset to next interlace block */
    static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
 
    /* Start of interlace block in the y direction */
    static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
 
    /* Offset to next interlace block in the y direction */
    static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-#endif
 
    int max_pixel_depth;
    png_size_t row_bytes;
 
    png_debug(1, "in png_read_start_row");
 
 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
    png_init_read_transformations(png_ptr);
 #endif
-#ifdef PNG_READ_INTERLACING_SUPPORTED
    if (png_ptr->interlaced)
    {
       if (!(png_ptr->transformations & PNG_INTERLACE))
          png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
              png_pass_ystart[0]) / png_pass_yinc[0];
 
       else
          png_ptr->num_rows = png_ptr->height;
 
       png_ptr->iwidth = (png_ptr->width +
           png_pass_inc[png_ptr->pass] - 1 -
           png_pass_start[png_ptr->pass]) /
           png_pass_inc[png_ptr->pass];
    }
 
    else
-#endif /* PNG_READ_INTERLACING_SUPPORTED */
    {
       png_ptr->num_rows = png_ptr->height;
       png_ptr->iwidth = png_ptr->width;
    }
 
    max_pixel_depth = png_ptr->pixel_depth;
 
    /* WARNING: * png_read_transform_info (pngrtran.c) performs a simpliar set of
--- a/media/libpng/pngset.c
+++ b/media/libpng/pngset.c
@@ -1,13 +1,13 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * Last changed in libpng 1.6.8 [December 19, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.11 [June 5, 2014]
+ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  *
  * The functions here are used during reads to store data from the file
@@ -637,17 +637,17 @@ png_set_iCCP(png_const_structrp png_ptr,
     */
    {
       int result = png_colorspace_set_ICC(png_ptr, &info_ptr->colorspace, name,
          proflen, profile, info_ptr->color_type);
 
       png_colorspace_sync_info(png_ptr, info_ptr);
 
       /* Don't do any of the copying if the profile was bad, or inconsistent. */
-      if (!result)
+      if (result == 0)
          return;
 
       /* But do write the gAMA and cHRM chunks from the profile. */
       info_ptr->colorspace.flags |=
          PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
    }
 
    length = strlen(name)+1;
@@ -686,17 +686,17 @@ png_set_iCCP(png_const_structrp png_ptr,
 #ifdef PNG_TEXT_SUPPORTED
 void PNGAPI
 png_set_text(png_const_structrp png_ptr, png_inforp info_ptr,
     png_const_textp text_ptr, int num_text)
 {
    int ret;
    ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
 
-   if (ret)
+   if (ret != 0)
       png_error(png_ptr, "Insufficient memory to store text");
 }
 
 int /* PRIVATE */
 png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
     png_const_textp text_ptr, int num_text)
 {
    int i;
@@ -855,17 +855,17 @@ png_set_text_2(png_const_structrp png_pt
 
       else
       {
          textp->lang=NULL;
          textp->lang_key=NULL;
          textp->text = textp->key + key_len + 1;
       }
 
-      if (text_length)
+      if (text_length != 0)
          memcpy(textp->text, text_ptr[i].text, text_length);
 
       *(textp->text + text_length) = '\0';
 
 #  ifdef PNG_iTXt_SUPPORTED
       if (textp->compression > 0)
       {
          textp->text_length = 0;
@@ -1494,17 +1494,17 @@ png_set_keep_unknown_chunks(png_structrp
       png_app_error(png_ptr, "png_set_keep_unknown_chunks: too many chunks");
       return;
    }
 
    /* If these chunks are being reset to the default then no more memory is
     * required because add_one_chunk above doesn't extend the list if the 'keep'
     * parameter is the default.
     */
-   if (keep)
+   if (keep != 0)
    {
       new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
           5 * (num_chunks + old_num_chunks)));
 
       if (old_num_chunks > 0)
          memcpy(new_list, png_ptr->chunk_list, 5*old_num_chunks);
    }
 
@@ -1590,17 +1590,17 @@ png_set_rows(png_const_structrp png_ptr,
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
    if (info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers))
       png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
 
    info_ptr->row_pointers = row_pointers;
 
-   if (row_pointers)
+   if (row_pointers != NULL)
       info_ptr->valid |= PNG_INFO_IDAT;
 }
 #endif
 
 void PNGAPI
 png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
 {
     if (png_ptr == NULL)
@@ -1677,26 +1677,26 @@ png_set_user_limits (png_structrp png_pt
    png_ptr->user_width_max = user_width_max;
    png_ptr->user_height_max = user_height_max;
 }
 
 /* This function was added to libpng 1.4.0 */
 void PNGAPI
 png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
 {
-    if (png_ptr)
+    if (png_ptr != NULL)
        png_ptr->user_chunk_cache_max = user_chunk_cache_max;
 }
 
 /* This function was added to libpng 1.4.1 */
 void PNGAPI
 png_set_chunk_malloc_max (png_structrp png_ptr,
     png_alloc_size_t user_chunk_malloc_max)
 {
-   if (png_ptr)
+   if (png_ptr != NULL)
       png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
 }
 #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
 
 
 #ifdef PNG_BENIGN_ERRORS_SUPPORTED
 void PNGAPI
 png_set_benign_errors(png_structrp png_ptr, int allowed)
@@ -1704,17 +1704,17 @@ png_set_benign_errors(png_structrp png_p
    png_debug(1, "in png_set_benign_errors");
 
    /* If allowed is 1, png_benign_error() is treated as a warning.
     *
     * If allowed is 0, png_benign_error() is treated as an error (which
     * is the default behavior if png_set_benign_errors() is not called).
     */
 
-   if (allowed)
+   if (allowed != 0)
       png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
          PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
 
    else
       png_ptr->flags &= ~(PNG_FLAG_BENIGN_ERRORS_WARN |
          PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN);
 }
 #endif /* PNG_BENIGN_ERRORS_SUPPORTED */
--- a/media/libpng/pngtrans.c
+++ b/media/libpng/pngtrans.c
@@ -1,12 +1,12 @@
 
 /* pngtrans.c - transforms the data in a row (used by both readers and writers)
  *
- * Last changed in libpng 1.6.9 [February 6, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
@@ -322,19 +322,26 @@ png_do_swap(png_row_infop row_info, png_
    if (row_info->bit_depth == 16)
    {
       png_bytep rp = row;
       png_uint_32 i;
       png_uint_32 istop= row_info->width * row_info->channels;
 
       for (i = 0; i < istop; i++, rp += 2)
       {
+#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
+         /* Feature added to libpng-1.6.11 for testing purposes, not
+          * enabled by default.
+          */
+         *(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
+#else
          png_byte t = *rp;
          *rp = *(rp + 1);
          *(rp + 1) = t;
+#endif
       }
    }
 }
 #endif
 #endif
 
 #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
 static PNG_CONST png_byte onebppswaptable[256] = {
@@ -498,31 +505,31 @@ png_do_strip_channel(png_row_infop row_i
     *            nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc.
     */
 
    /* GA, GX, XG cases */
    if (row_info->channels == 2)
    {
       if (row_info->bit_depth == 8)
       {
-         if (at_start) /* Skip initial filler */
+         if (at_start != 0) /* Skip initial filler */
             ++sp;
          else          /* Skip initial channel and, for sp, the filler */
             sp += 2, ++dp;
 
          /* For a 1 pixel wide image there is nothing to do */
          while (sp < ep)
             *dp++ = *sp, sp += 2;
 
          row_info->pixel_depth = 8;
       }
 
       else if (row_info->bit_depth == 16)
       {
-         if (at_start) /* Skip initial filler */
+         if (at_start != 0) /* Skip initial filler */
             sp += 2;
          else          /* Skip initial channel and, for sp, the filler */
             sp += 4, dp += 2;
 
          while (sp < ep)
             *dp++ = *sp++, *dp++ = *sp, sp += 3;
 
          row_info->pixel_depth = 16;
@@ -538,31 +545,31 @@ png_do_strip_channel(png_row_infop row_i
          row_info->color_type = PNG_COLOR_TYPE_GRAY;
    }
 
    /* RGBA, RGBX, XRGB cases */
    else if (row_info->channels == 4)
    {
       if (row_info->bit_depth == 8)
       {
-         if (at_start) /* Skip initial filler */
+         if (at_start != 0) /* Skip initial filler */
             ++sp;
          else          /* Skip initial channels and, for sp, the filler */
             sp += 4, dp += 3;
 
          /* Note that the loop adds 3 to dp and 4 to sp each time. */
          while (sp < ep)
             *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
 
          row_info->pixel_depth = 24;
       }
 
       else if (row_info->bit_depth == 16)
       {
-         if (at_start) /* Skip initial filler */
+         if (at_start != 0) /* Skip initial filler */
             sp += 2;
          else          /* Skip initial channels and, for sp, the filler */
             sp += 8, dp += 6;
 
          while (sp < ep)
          {
             /* Copy 6 bytes, skip 2 */
             *dp++ = *sp++, *dp++ = *sp++;
--- a/media/libpng/pngwrite.c
+++ b/media/libpng/pngwrite.c
@@ -1,12 +1,12 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * Last changed in libpng 1.6.10 [March 6, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
@@ -436,16 +436,17 @@ png_write_end(png_structrp png_ptr, png_
       write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT);
 #endif
    }
 
    png_ptr->mode |= PNG_AFTER_IDAT;
 
    /* Write end of PNG file */
    png_write_IEND(png_ptr);
+
    /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
     * and restored again in libpng-1.2.30, may cause some applications that
     * do not set png_ptr->output_flush_fn to crash.  If your application
     * experiences a problem, please try building libpng with
     * PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to
     * png-mng-implement at lists.sf.net .
     */
 #ifdef PNG_WRITE_FLUSH_SUPPORTED
@@ -483,30 +484,30 @@ png_convert_from_time_t(png_timep ptime,
 
 /* Initialize png_ptr structure, and allocate any memory needed */
 PNG_FUNCTION(png_structp,PNGAPI
 png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
     png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
 {
 #ifndef PNG_USER_MEM_SUPPORTED
    png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
-      error_fn, warn_fn, NULL, NULL, NULL);
+       error_fn, warn_fn, NULL, NULL, NULL);
 #else
    return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
        warn_fn, NULL, NULL, NULL);
 }
 
 /* Alternate initialize png_ptr structure, and allocate any memory needed */
 PNG_FUNCTION(png_structp,PNGAPI
 png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
     png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
     png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
 {
    png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
-      error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
+       error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
 #endif /* PNG_USER_MEM_SUPPORTED */
    if (png_ptr != NULL)
    {
       /* Set the zlib control values to defaults; they can be overridden by the
        * application after the struct has been created.
        */
       png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
 
@@ -529,20 +530,20 @@ png_create_write_struct_2,(png_const_cha
 #endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
 
       /* This is a highly dubious configuration option; by default it is off,
        * but it may be appropriate for private builds that are testing
        * extensions not conformant to the current specification, or of
        * applications that must not fail to write at all costs!
        */
 #ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
-      png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
       /* In stable builds only warn if an application error can be completely
        * handled.
        */
+      png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
 #endif
 
       /* App warnings are warnings in release (or release candidate) builds but
        * are errors during development.
        */
 #if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
       png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
 #endif
@@ -830,17 +831,17 @@ png_write_row(png_structrp png_ptr, png_
 
 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
    /* Handle interlacing */
    if (png_ptr->interlaced && png_ptr->pass < 6 &&
        (png_ptr->transformations & PNG_INTERLACE))
    {
       png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass);
       /* This should always get caught above, but still ... */
-      if (!(row_info.width))
+      if (row_info.width == 0)
       {
          png_write_finish_row(png_ptr);
          return;
       }
    }
 #endif
 
 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
@@ -2181,17 +2182,17 @@ png_image_write_main(png_voidp argument)
          PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
 
    /* Counter-intuitively the data transformations must be called *after*
     * png_write_info, not before as in the read code, but the 'set' functions
     * must still be called before.  Just set the color space information, never
     * write an interlaced image.
     */
 
-   if (write_16bit)
+   if (write_16bit != 0)
    {
       /* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
       png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
 
       if (!(image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB))
          png_set_cHRM_fixed(png_ptr, info_ptr,
             /* color      x       y */
             /* white */ 31270, 32900,
@@ -2213,17 +2214,17 @@ png_image_write_main(png_voidp argument)
    /* Write the file header. */
    png_write_info(png_ptr, info_ptr);
 
    /* Now set up the data transformations (*after* the header is written),
     * remove the handled transformations from the 'format' flags for checking.
     *
     * First check for a little endian system if writing 16 bit files.
     */
-   if (write_16bit)
+   if (write_16bit != 0)
    {
       PNG_CONST png_uint_16 le = 0x0001;
 
       if (*(png_const_bytep)&le)
          png_set_swap(png_ptr);
    }
 
 #  ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
@@ -2254,17 +2255,17 @@ png_image_write_main(png_voidp argument)
    if ((format & ~(png_uint_32)(PNG_FORMAT_FLAG_COLOR | PNG_FORMAT_FLAG_LINEAR |
          PNG_FORMAT_FLAG_ALPHA | PNG_FORMAT_FLAG_COLORMAP)) != 0)
       png_error(png_ptr, "png_write_image: unsupported transformation");
 
    {
       png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
       ptrdiff_t row_bytes = display->row_stride;
 
-      if (linear)
+      if (linear != 0)
          row_bytes *= (sizeof (png_uint_16));
 
       if (row_bytes < 0)
          row += (image->height-1) * (-row_bytes);
 
       display->first_row = row;
       display->row_bytes = row_bytes;
    }
@@ -2287,26 +2288,26 @@ png_image_write_main(png_voidp argument)
     */
    if ((linear && alpha) || (!colormap && display->convert_to_8bit))
    {
       png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
          png_get_rowbytes(png_ptr, info_ptr)));
       int result;
 
       display->local_row = row;
-      if (write_16bit)
+      if (write_16bit != 0)
          result = png_safe_execute(image, png_write_image_16bit, display);
       else
          result = png_safe_execute(image, png_write_image_8bit, display);
       display->local_row = NULL;
 
       png_free(png_ptr, row);
 
       /* Skip the 'write_end' on error: */
-      if (!result)
+      if (result == 0)
          return 0;
    }
 
    /* Otherwise this is the case where the input is in a format currently
     * supported by the rest of the libpng write code; call it directly.
     */
    else
    {
--- a/media/libpng/pngwutil.c
+++ b/media/libpng/pngwutil.c
@@ -1,13 +1,13 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * Last changed in libpng 1.6.2 [April 25, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.11 [June 5, 2014]
+ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
  * and license in png.h
  */
 
@@ -694,50 +694,50 @@ png_check_keyword(png_structrp png_ptr, 
 
    while (*key && key_len < 79)
    {
       png_byte ch = (png_byte)(0xff & *key++);
 
       if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
          *new_key++ = ch, ++key_len, space = 0;
 
-      else if (!space)
+      else if (space == 0)
       {
          /* A space or an invalid character when one wasn't seen immediately
           * before; output just a space.
           */
          *new_key++ = 32, ++key_len, space = 1;
 
          /* If the character was not a space then it is invalid. */
          if (ch != 32)
             bad_character = ch;
       }
 
-      else if (!bad_character)
+      else if (bad_character == 0)
          bad_character = ch; /* just skip it, record the first error */
    }
 
    if (key_len > 0 && space) /* trailing space */
    {
       --key_len, --new_key;
-      if (!bad_character)
+      if (bad_character == 0)
          bad_character = 32;
    }
 
    /* Terminate the keyword */
    *new_key = 0;
 
    if (key_len == 0)
       return 0;
 
    /* Try to only output one warning per keyword: */
    if (*key) /* keyword too long */
       png_warning(png_ptr, "keyword truncated");
 
-   else if (bad_character)
+   else if (bad_character != 0)
    {
       PNG_WARNING_PARAMETERS(p)
 
       png_warning_parameter(p, 1, orig_key);
       png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
 
       png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
    }
@@ -898,17 +898,17 @@ png_write_IHDR(png_structrp png_ptr, png
    /* Write the chunk */
    png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
 
 #ifdef PNG_WRITE_APNG_SUPPORTED
    png_ptr->first_frame_width = width;
    png_ptr->first_frame_height = height;
 #endif
 
-   if (!(png_ptr->do_filter))
+   if ((png_ptr->do_filter) == PNG_NO_FILTERS)
    {
       if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
           png_ptr->bit_depth < 8)
          png_ptr->do_filter = PNG_FILTER_NONE;
 
       else
          png_ptr->do_filter = PNG_ALL_FILTERS;
    }
@@ -1209,31 +1209,33 @@ png_write_sRGB(png_structrp png_ptr, int
 void /* PRIVATE */
 png_write_iCCP(png_structrp png_ptr, png_const_charp name,
     png_const_bytep profile)
 {
    png_uint_32 name_len;
    png_uint_32 profile_len;
    png_byte new_name[81]; /* 1 byte for the compression byte */
    compression_state comp;
+   png_uint_32 temp;
 
    png_debug(1, "in png_write_iCCP");
 
    /* These are all internal problems: the profile should have been checked
     * before when it was stored.
     */
    if (profile == NULL)
       png_error(png_ptr, "No profile for iCCP chunk"); /* internal error */
 
    profile_len = png_get_uint_32(profile);
 
    if (profile_len < 132)
       png_error(png_ptr, "ICC profile too short");
 
-   if (profile_len & 0x03)
+   temp = (png_uint_32) (*(profile+8));
+   if (temp > 3 && (profile_len & 0x03))
       png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)");
 
    {
       png_uint_32 embedded_profile_len = png_get_uint_32(profile);
 
       if (profile_len != embedded_profile_len)
          png_error(png_ptr, "Profile length does not match profile");
    }
@@ -1624,17 +1626,17 @@ png_write_tEXt(png_structrp png_ptr, png
    /*
     * We leave it to the application to meet PNG-1.0 requirements on the
     * contents of the text.  PNG-1.0 through PNG-1.2 discourage the use of
     * any non-Latin-1 characters except for NEWLINE.  ISO PNG will forbid them.
     * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG.
     */
    png_write_chunk_data(png_ptr, new_key, key_len + 1);
 
-   if (text_len)
+   if (text_len != 0)
       png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
 
    png_write_chunk_end(png_ptr);
 }
 #endif
 
 #ifdef PNG_WRITE_zTXt_SUPPORTED
 /* Write a compressed text chunk */
@@ -1750,17 +1752,17 @@ png_write_iTXt(png_structrp png_ptr, int
 
    if (lang_key_len > PNG_UINT_31_MAX-prefix_len)
       prefix_len = PNG_UINT_31_MAX;
    else
       prefix_len = (png_uint_32)(prefix_len + lang_key_len);
 
    png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
 
-   if (compression)
+   if (compression != 0)
    {
       if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
          png_error(png_ptr, png_ptr->zstream.msg);
    }
 
    else
    {
       if (comp.input_len > PNG_UINT_31_MAX-prefix_len)
@@ -1773,17 +1775,17 @@ png_write_iTXt(png_structrp png_ptr, int
    png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len);
 
    png_write_chunk_data(png_ptr, new_key, key_len);
 
    png_write_chunk_data(png_ptr, (png_const_bytep)lang, lang_len);
 
    png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
 
-   if (compression)
+   if (compression != 0)
       png_write_compressed_data_out(png_ptr, &comp);
 
    else
       png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.input_len);
 
    png_write_chunk_end(png_ptr);
 }
 #endif