From b61b18157bce101667c1da31987d74645f6b1605 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sat, 12 Jan 2019 12:58:21 +0100 Subject: [PATCH] [LIBPNG] Update to version 1.6.36. CORE-15280 --- dll/3rdparty/libpng/docs/ANNOUNCE | 99 +++-- dll/3rdparty/libpng/docs/CHANGES | 29 +- dll/3rdparty/libpng/docs/LICENSE | 175 ++++---- dll/3rdparty/libpng/docs/README | 111 ++--- dll/3rdparty/libpng/docs/TODO | 49 +-- dll/3rdparty/libpng/docs/example.c | 431 +++++++++---------- dll/3rdparty/libpng/docs/libpng-manual.txt | 91 +--- dll/3rdparty/libpng/png.c | 50 +-- dll/3rdparty/libpng/pngdebug.h | 6 +- dll/3rdparty/libpng/pngerror.c | 12 +- dll/3rdparty/libpng/pngget.c | 6 +- dll/3rdparty/libpng/pnginfo.h | 6 +- dll/3rdparty/libpng/pngmem.c | 6 +- dll/3rdparty/libpng/pngpread.c | 16 +- dll/3rdparty/libpng/pngpriv.h | 38 +- dll/3rdparty/libpng/pngread.c | 32 +- dll/3rdparty/libpng/pngrio.c | 6 +- dll/3rdparty/libpng/pngrtran.c | 88 ++-- dll/3rdparty/libpng/pngrutil.c | 39 +- dll/3rdparty/libpng/pngset.c | 12 +- dll/3rdparty/libpng/pngstruct.h | 10 +- dll/3rdparty/libpng/pngtrans.c | 12 +- dll/3rdparty/libpng/pngwio.c | 6 +- dll/3rdparty/libpng/pngwrite.c | 38 +- dll/3rdparty/libpng/pngwtran.c | 11 +- dll/3rdparty/libpng/pngwutil.c | 38 +- sdk/include/reactos/libs/libpng/png.h | 303 ++++++------- sdk/include/reactos/libs/libpng/pngconf.h | 16 +- sdk/include/reactos/libs/libpng/pnglibconf.h | 11 +- 29 files changed, 854 insertions(+), 893 deletions(-) diff --git a/dll/3rdparty/libpng/docs/ANNOUNCE b/dll/3rdparty/libpng/docs/ANNOUNCE index 9fc9021b5a8..f1724c0d0d9 100644 --- a/dll/3rdparty/libpng/docs/ANNOUNCE +++ b/dll/3rdparty/libpng/docs/ANNOUNCE @@ -1,48 +1,77 @@ -Libpng 1.6.35 - July 15, 2018 +libpng 1.6.36 - December 1, 2018 +================================ This is a public release of libpng, intended for use in production code. -Files available for download: + +Files available for download +---------------------------- Source files with LF line endings (for Unix/Linux): - libpng-1.6.35.tar.xz (LZMA-compressed, recommended) - libpng-1.6.35.tar.gz + * libpng-1.6.36.tar.xz (LZMA-compressed, recommended) + * libpng-1.6.36.tar.gz Source files with CRLF line endings (for Windows): - lp1635.7z (LZMA-compressed, recommended) - lp1635.zip + * lp1636.7z (LZMA-compressed, recommended) + * lp1636.zip Other information: - libpng-1.6.35-README.txt - libpng-1.6.35-LICENSE.txt - -Changes since the last public release (1.6.34): - - Restored 21 of the contrib/pngsuite/i*.png, which do not cause test - failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png. - Added calls to png_set_*() transforms commonly used by browsers to - the fuzzer. - Removed some unnecessary brackets in pngrtran.c - Fixed miscellaneous typos (Patch by github user "luzpaz"). - Change "ASM C" to "C ASM" in CMakeLists.txt - Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin) - Added hardware optimization directories to zip and 7z distributions. - Fixed incorrect bitmask for options. - Fixed many spelling typos. - Make png_get_iCCP consistent with man page (allow compression-type argument - to be NULL, bug report by Lenard Szolnoki). - Replaced the remaining uses of png_size_t with size_t (Cosmin) - Fixed the calculation of row_factor in png_check_chunk_length - (reported by Thuan Pham in SourceForge issue #278) - Added missing parentheses to a macro definition - (suggested by "irwir" in GitHub issue #216) - -Send comments/corrections/commendations to png-mng-implement at lists.sf.net -(subscription required; visit -https://lists.sourceforge.net/lists/listinfo/png-mng-implement -to subscribe). + * README.md + * LICENSE.md + * AUTHORS.md + * TRADEMARK.md + + +IMPORTANT licensing update: libpng license v2 +--------------------------------------------- + +The new libpng license comprises the terms and conditions from the zlib +license, and the disclaimer from the Boost license. + +The legacy libpng license, used until libpng-1.6.35, is appended to the +new license, following the precedent established in the Python Software +Foundation License version 2. -Glenn R-P +From now on, the list of contributing authors shall be maintained in a +separate AUTHORS file. The lists of previous contributing authors, +mentioned in the legacy libpng license and considered to be an integral +part of that license, are kept intact, with no further updates. + + +Changes since the previous public release (version 1.6.35) +---------------------------------------------------------- + + * Optimized png_do_expand_palette for ARM processors. + Improved performance by around 10-22% on a recent ARM Chromebook. + (Contributed by Richard Townsend, ARM Holdings) + * Fixed manipulation of machine-specific optimization options. + (Contributed by Vicki Pfau) + * Used memcpy instead of manual pointer arithmetic on Intel SSE2. + (Contributed by Samuel Williams) + * Fixed build errors with MSVC on ARM64. + (Contributed by Zhijie Liang) + * Fixed detection of libm in CMakeLists. + (Contributed by Cameron Cawley) + * Fixed incorrect creation of pkg-config file in CMakeLists. + (Contributed by Kyle Bentley) + * Fixed the CMake build on Windows MSYS by avoiding symlinks. + * Fixed a build warning on OpenBSD. + (Contributed by Theo Buehler) + * Fixed various typos in comments. + (Contributed by "luz.paz") + * Raised the minimum required CMake version from 3.0.2 to 3.1. + * Removed yet more of the vestigial support for pre-ANSI C compilers. + * Removed ancient makefiles for ancient systems that have been broken + across all previous libpng-1.6.x versions. + * Removed the Y2K compliance statement and the export control + information. + * Applied various code style and documentation fixes. + + +Send comments/corrections/commendations to png-mng-implement at lists.sf.net. +Subscription is required; visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement +to subscribe. diff --git a/dll/3rdparty/libpng/docs/CHANGES b/dll/3rdparty/libpng/docs/CHANGES index 0ed6a118729..bdd44806549 100644 --- a/dll/3rdparty/libpng/docs/CHANGES +++ b/dll/3rdparty/libpng/docs/CHANGES @@ -6063,9 +6063,34 @@ Version 1.6.35 [July 15, 2018] Added missing parentheses to a macro definition (suggested by "irwir" in GitHub issue #216) +Version 1.6.36 [December 1, 2018] + Optimized png_do_expand_palette for ARM processors. + Improved performance by around 10-22% on a recent ARM Chromebook. + (Contributed by Richard Townsend, ARM Holdings) + Fixed manipulation of machine-specific optimization options. + (Contributed by Vicki Pfau) + Used memcpy instead of manual pointer arithmetic on Intel SSE2. + (Contributed by Samuel Williams) + Fixed build errors with MSVC on ARM64. + (Contributed by Zhijie Liang) + Fixed detection of libm in CMakeLists. + (Contributed by Cameron Cawley) + Fixed incorrect creation of pkg-config file in CMakeLists. + (Contributed by Kyle Bentley) + Fixed the CMake build on Windows MSYS by avoiding symlinks. + Fixed a build warning on OpenBSD. + (Contributed by Theo Buehler) + Fixed various typos in comments. + (Contributed by "luz.paz") + Raised the minimum required CMake version from 3.0.2 to 3.1. + Removed yet more of the vestigial support for pre-ANSI C compilers. + Removed ancient makefiles for ancient systems that have been broken + across all previous libpng-1.6.x versions. + Removed the Y2K compliance statement and the export control + information. + Applied various code style and documentation fixes. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe). - -Glenn R-P diff --git a/dll/3rdparty/libpng/docs/LICENSE b/dll/3rdparty/libpng/docs/LICENSE index 6ee9c8f5548..62ab8e48dcf 100644 --- a/dll/3rdparty/libpng/docs/LICENSE +++ b/dll/3rdparty/libpng/docs/LICENSE @@ -1,14 +1,43 @@ +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= -This copy of the libpng notices is provided for your convenience. In case of -any discrepancy between this copy and the notices in the file png.h that is -included in the libpng distribution, the latter shall prevail. +PNG Reference Library License version 2 +--------------------------------------- -COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + * Copyright (c) 1995-2018 The PNG Reference Library Authors. + * Copyright (c) 2018 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. -If you modify libpng you may insert additional notices immediately following -this sentence. +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no even shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. -This code is released under the libpng license. +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are @@ -16,38 +45,38 @@ derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: - Simon-Pierre Cadieux - Eric S. Raymond - Mans Rullgard - Cosmin Truta - Gilles Vollant - James Yu - Mandar Sahastrabuddhe - Google Inc. - Vadim Barkov + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: - There is no warranty against interference with your enjoyment of the - library or against infringement. There is no warranty that our - efforts or the library will fulfill any of your particular purposes - or needs. This library is provided with all faults, and the entire - risk of satisfactory quality, performance, accuracy, and effort is with - the user. + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. Some files in the "contrib" directory and some configure-generated -files that are distributed with libpng have other copyright owners and +files that are distributed with libpng have other copyright owners, and are released under other open source licenses. libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from libpng-0.96, and are distributed according to the same disclaimer and -license as libpng-0.96, with the following individuals added to the list -of Contributing Authors: +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: - Tom Lane - Glenn Randers-Pehrson - Willem van Schaik + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik libpng versions 0.89, June 1996, through 0.96, May 1997, are Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, @@ -55,14 +84,14 @@ and are distributed according to the same disclaimer and license as libpng-0.88, with the following individuals added to the list of Contributing Authors: - John Bowler - Kevin Bracey - Sam Bushell - Magnus Holmgren - Greg Roelofs - Tom Tanner + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner -Some files in the "scripts" directory have other copyright owners +Some files in the "scripts" directory have other copyright owners, but are released under this license. libpng versions 0.5, May 1995, through 0.88, January 1996, are @@ -71,63 +100,35 @@ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. For the purposes of this copyright and license, "Contributing Authors" is defined as the following set of individuals: - Andreas Dilger - Dave Martindale - Guy Eric Schalnat - Paul Schmidt - Tim Wegner - -The PNG Reference Library is supplied "AS IS". The Contributing Authors -and Group 42, Inc. disclaim all warranties, expressed or implied, -including, without limitation, the warranties of merchantability and of -fitness for any purpose. The Contributing Authors and Group 42, Inc. -assume no liability for direct, indirect, incidental, special, exemplary, -or consequential damages, which may result from the use of the PNG -Reference Library, even if advised of the possibility of such damage. + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, for any purpose, without fee, subject to the following restrictions: - 1. The origin of this source code must not be misrepresented. - - 2. Altered versions must be plainly marked as such and must not - be misrepresented as being the original source. - - 3. This Copyright notice may not be removed or altered from any - source or altered source distribution. - -The Contributing Authors and Group 42, Inc. specifically permit, without -fee, and encourage the use of this source code as a component to -supporting the PNG file format in commercial products. If you use this -source code in a product, acknowledgment is not required but would be -appreciated. - -END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. - -TRADEMARK: - -The name "libpng" has not been registered by the Copyright owner -as a trademark in any jurisdiction. However, because libpng has -been distributed and maintained world-wide, continually since 1995, -the Copyright owner claims "common-law trademark protection" in any -jurisdiction where common-law trademark is recognized. - -OSI CERTIFICATION: - -Libpng is OSI Certified Open Source Software. OSI Certified Open Source is -a certification mark of the Open Source Initiative. OSI has not addressed -the additional disclaimers inserted at version 1.0.7. + 1. The origin of this source code must not be misrepresented. -EXPORT CONTROL: + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. -The Copyright owner believes that the Export Control Classification -Number (ECCN) for libpng is EAR99, which means not subject to export -controls or International Traffic in Arms Regulations (ITAR) because -it is open source, publicly available software, that does not contain -any encryption software. See the EAR, paragraphs 734.3(b)(3) and -734.7(b). + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. -Glenn Randers-Pehrson -glennrp at users.sourceforge.net -July 15, 2018 +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. diff --git a/dll/3rdparty/libpng/docs/README b/dll/3rdparty/libpng/docs/README index f098b27f397..e41e0f549bb 100644 --- a/dll/3rdparty/libpng/docs/README +++ b/dll/3rdparty/libpng/docs/README @@ -1,15 +1,16 @@ -README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0) -See the note about version numbers near the top of png.h +README for libpng version 1.6.36 - December 1, 2018 +=================================================== +See the note about version numbers near the top of png.h. See INSTALL for instructions on how to install libpng. Libpng comes in several distribution formats. Get libpng-*.tar.gz or -libpng-*.tar.xz or if you want UNIX-style line endings in the text files, -or lpng*.7z or lpng*.zip if you want DOS-style line endings. +libpng-*.tar.xz or if you want UNIX-style line endings in the text +files, or lpng*.7z or lpng*.zip if you want DOS-style line endings. Version 0.89 was the first official release of libpng. Don't let the -fact that it's the first release fool you. The libpng library has been in -extensive use and testing since mid-1995. By late 1997 it had +fact that it's the first release fool you. The libpng library has been +in extensive use and testing since mid-1995. By late 1997 it had finally gotten to the stage where there hadn't been significant changes to the API in some time, and people have a bad feeling about libraries with versions < 1.0. Version 1.0.0 was released in @@ -60,59 +61,37 @@ the library action on the detection of chunk CRC errors. It is possible to set different actions based on whether the CRC error occurred in a critical or an ancillary chunk. -The changes made to the library, and bugs fixed are based on discussions -on the PNG-implement mailing list and not on material submitted -privately to Guy, Andreas, or Glenn. They will forward any good -suggestions to the list. - -For a detailed description on using libpng, read libpng-manual.txt. For -examples of libpng in a program, see example.c and pngtest.c. For usage -information and restrictions (what little they are) on libpng, see -png.h. For a description on using zlib (the compression library used by -libpng) and zlib's restrictions, see zlib.h +For a detailed description on using libpng, read libpng-manual.txt. +For examples of libpng in a program, see example.c and pngtest.c. For +usage information and restrictions (what little they are) on libpng, +see png.h. For a description on using zlib (the compression library +used by libpng) and zlib's restrictions, see zlib.h I have included a general makefile, as well as several machine and -compiler specific ones, but you may have to modify one for your own needs. +compiler specific ones, but you may have to modify one for your own +needs. You should use zlib 1.0.4 or later to run this, but it MAY work with versions as old as zlib 0.95. Even so, there are bugs in older zlib versions which can cause the output of invalid compression streams for -some images. You will definitely need zlib 1.0.4 or later if you are -taking advantage of the MS-DOS "far" structure allocation for the small -and medium memory models. You should also note that zlib is a -compression library that is useful for more things than just PNG files. -You can use zlib as a drop-in replacement for fread() and fwrite() if -you are so inclined. +some images. + +You should also note that zlib is a compression library that is useful +for more things than just PNG files. You can use zlib as a drop-in +replacement for fread() and fwrite(), if you are so inclined. -zlib should be available at the same place that libpng is, or at zlib.net. +zlib should be available at the same place that libpng is, or at +https://zlib.net. You may also want a copy of the PNG specification. It is available as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find these at http://www.libpng.org/pub/png/pngdocs.html . This code is currently being archived at libpng.sourceforge.io in the -[DOWNLOAD] area, and at http://libpng.download/src . If you -can't find it in any of those places, e-mail me, and I'll help you find it. - -I am not a lawyer, but I believe that the Export Control Classification -Number (ECCN) for libpng is EAR99, which means not subject to export -controls or International Traffic in Arms Regulations (ITAR) because it -is open source, publicly available software, that does not contain any -encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b). - -If you have any code changes, requests, problems, etc., please e-mail -them to me. Also, I'd appreciate any make files or project files, -and any modifications you needed to make to get libpng to compile, -along with a #define variable to tell what compiler/system you are on. -If you needed to add transformations to libpng, or wish libpng would -provide the image in a different way, drop me a note (and code, if -possible), so I can consider supporting the transformation. -Finally, if you get any warning messages when compiling libpng -(note: not zlib), and they are easy to fix, I'd appreciate the -fix. Please mention "libpng" somewhere in the subject line. Thanks. - -This release was created and will be supported by myself (of course -based in a large way on Guy's and Andreas' earlier work), and the PNG +[DOWNLOAD] area, and at http://libpng.download/src . + +This release, based in a large way on Glenn's, Guy's and Andreas' +earlier work, was created and will be supported by myself and the PNG development group. Send comments/corrections/commendations to png-mng-implement at @@ -120,34 +99,21 @@ lists.sourceforge.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe). -You can't reach Guy, the original libpng author, at the addresses -given in previous versions of this document. He and Andreas will -read mail addressed to the png-implement list, however. - -Please do not send general questions about PNG. Send them to -png-mng-misc at lists.sf.net (subscription required; visit +Send general questions about the PNG specification to png-mng-misc +at lists.sourceforge.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-misc to -subscribe). If you have a question about something -in the PNG specification that is related to using libpng, send it -to me. Send me any questions that start with "I was using libpng, -and ...". If in doubt, send questions to me. I'll bounce them -to others, if necessary. - -Please do not send suggestions on how to change PNG. We have -been discussing PNG for twenty years now, and it is official and -finished. If you have suggestions for libpng, however, I'll -gladly listen. Even if your suggestion is not used immediately, -it may be used later. +subscribe). Files in this distribution: ANNOUNCE => Announcement of this version, with recent changes + AUTHORS => List of contributing authors CHANGES => Description of changes between libpng versions KNOWNBUG => List of known bugs and deficiencies LICENSE => License to use and redistribute libpng README => This file TODO => Things not implemented in the current library - Y2KINFO => Statement of Y2K compliance + TRADEMARK => Trademark information example.c => Example code for using libpng functions libpng.3 => manual page for libpng (includes libpng-manual.txt) libpng-manual.txt => Description of libpng and its functions @@ -208,15 +174,10 @@ Files in this distribution: scripts => Directory containing scripts for building libpng: (see scripts/README.txt for the list of scripts) -Good luck, and happy coding. - --Glenn Randers-Pehrson (current maintainer, since 1998) - Internet: glennrp at users.sourceforge.net - --Andreas Eric Dilger (former maintainer, 1996-1997) - Internet: adilger at enel.ucalgary.ca - Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/ +Good luck, and happy coding! --Guy Eric Schalnat (original author and former maintainer, 1995-1996) - (formerly of Group 42, Inc) - Internet: gschal at infinet.com + * Cosmin Truta (current maintainer, since 2018) + * Glenn Randers-Pehrson (former maintainer, 1998-2018) + * Andreas Eric Dilger (former maintainer, 1996-1997) + * Guy Eric Schalnat (original author and former maintainer, 1995-1996) + (formerly of Group 42, Inc.) diff --git a/dll/3rdparty/libpng/docs/TODO b/dll/3rdparty/libpng/docs/TODO index 36d6092a2e7..562dab06966 100644 --- a/dll/3rdparty/libpng/docs/TODO +++ b/dll/3rdparty/libpng/docs/TODO @@ -1,30 +1,23 @@ -/* TODO - list of things to do for libpng: -Final bug fixes. -Better C++ wrapper/full C++ implementation? -Fix problem with C++ and EXTERN "C". -cHRM transformation. -Remove setjmp/longjmp usage in favor of returning error codes. As a start on - this, minimize the use of png_error(), replacing them with - png_warning(); return(0); or similar. -Palette creation. -Add "grayscale->palette" transformation and "palette->grayscale" detection. -Improved dithering. -Multi-lingual error and warning message support. -Complete sRGB transformation (presently it simply uses gamma=0.45455). -Man pages for function calls. -Better documentation. -Better filter selection - (counting huffman bits/precompression? filter inertia? filter costs?). -Histogram creation. -Text conversion between different code pages (Latin-1 -> Mac and DOS). -Avoid building gamma tables whenever possible. -Use greater precision when changing to linear gamma for compositing against - background and doing rgb-to-gray transformation. -Investigate pre-incremented loop counters and other loop constructions. -Add interpolated method of handling interlacing. -Extend pngvalid.c to validate more of the libpng transformations. -Refactor preprocessor conditionals to compile entire statements - -*/ +* Fix all defects (duh!) +* Better C++ wrapper / full C++ implementation (?) +* Fix the problems with C++ and 'extern "C"'. +* cHRM transformation. +* Palette creation. +* "grayscale->palette" transformation and "palette->grayscale" detection. +* Improved dithering. +* Multi-lingual error and warning message support. +* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.) +* Man pages for function calls. +* Better documentation. +* Better filter selection + (e.g., counting huffman bits/precompression; filter inertia; filter costs). +* Histogram creation. +* Text conversion between different code pages (e.g., Latin-1 -> Mac). +* Avoid building gamma tables whenever possible. +* Greater precision in changing to linear gamma for compositing against + background, and in doing rgb-to-gray transformations. +* Investigate pre-incremented loop counters and other loop constructions. +* Interpolated method of handling interlacing. +* More validations for libpng transformations. diff --git a/dll/3rdparty/libpng/docs/example.c b/dll/3rdparty/libpng/docs/example.c index 34ecfde22c7..2e2afaafb66 100644 --- a/dll/3rdparty/libpng/docs/example.c +++ b/dll/3rdparty/libpng/docs/example.c @@ -2,19 +2,20 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.6.35 [July 15, 2018] + * * Maintained 2018 Cosmin Truta * Maintained 1998-2016 Glenn Randers-Pehrson - * Maintained 1996, 1997 Andreas Dilger) - * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * Maintained 1996-1997 Andreas Dilger + * Written 1995-1996 Guy Eric Schalnat, Group 42, Inc. + * * To the extent possible under law, the authors have waived * all copyright and related or neighboring rights to this file. * This work is published from: United States, Canada. */ /* This is an example of how to use libpng to read and write PNG files. - * The file libpng-manual.txt is much more verbose then this. If you have not - * read it, do so first. This was designed to be a starting point of an + * The file libpng-manual.txt is much more verbose then this. If you have + * not read it, do so first. This was designed to be a starting point of an * implementation. This is not officially part of libpng, is hereby placed * in the public domain, and therefore does not require a copyright notice. * @@ -25,16 +26,17 @@ * see also the programs in the contrib directory. */ -/* The simple, but restricted, approach to reading a PNG file or data stream - * just requires two function calls, as in the following complete program. - * Writing a file just needs one function call, so long as the data has an +/* The simple, but restricted approach to reading a PNG file or data stream + * requires just two function calls, as in the following complete program. + * Writing a file needs just one function call, so long as the data has an * appropriate layout. * * The following code reads PNG image data from a file and writes it, in a - * potentially new format, to a new file. While this code will compile there is - * minimal (insufficient) error checking; for a more realistic version look at - * contrib/examples/pngtopng.c + * potentially new format, to a new file. While this code will compile, there + * is minimal (insufficient) error checking. For a more realistic version, + * see contrib/examples/pngtopng.c */ + #include #include #include @@ -69,28 +71,28 @@ int main(int argc, const char **argv) */ buffer = malloc(PNG_IMAGE_SIZE(image)); - /* If enough memory was available read the image in the desired format - * then write the result out to the new file. 'background' is not - * necessary when reading the image because the alpha channel is + /* If enough memory was available, read the image in the desired + * format, then write the result out to the new file. 'background' is + * not necessary when reading the image, because the alpha channel is * preserved; if it were to be removed, for example if we requested * PNG_FORMAT_RGB, then either a solid background color would have to - * be supplied or the output buffer would have to be initialized to the - * actual background of the image. + * be supplied, or the output buffer would have to be initialized to + * the actual background of the image. * * The fourth argument to png_image_finish_read is the 'row_stride' - * this is the number of components allocated for the image in each * row. It has to be at least as big as the value returned by * PNG_IMAGE_ROW_STRIDE, but if you just allocate space for the - * default, minimum, size using PNG_IMAGE_SIZE as above you can pass + * default, minimum size, using PNG_IMAGE_SIZE as above, you can pass * zero. * * The final argument is a pointer to a buffer for the colormap; - * colormaps have exactly the same format as a row of image pixels (so - * you choose what format to make the colormap by setting + * colormaps have exactly the same format as a row of image pixels + * (so you choose what format to make the colormap by setting * image.format). A colormap is only returned if * PNG_FORMAT_FLAG_COLORMAP is also set in image.format, so in this * case NULL is passed as the final argument. If you do want to force - * all images into an index/color-mapped format then you can use: + * all images into an index/color-mapped format, then you can use: * * PNG_IMAGE_COLORMAP_SIZE(image) * @@ -112,17 +114,15 @@ int main(int argc, const char **argv) exit(0); } } - else { /* Calling png_image_free is optional unless the simplified API was - * not run to completion. In this case if there wasn't enough - * memory for 'buffer' we didn't complete the read, so we must free - * the image: + * not run to completion. In this case, if there wasn't enough + * memory for 'buffer', we didn't complete the read, so we must + * free the image: */ if (buffer == NULL) png_image_free(&image); - else free(buffer); } @@ -131,65 +131,67 @@ int main(int argc, const char **argv) * textual message in the 'png_image' structure: */ fprintf(stderr, "pngtopng: error: %s\n", image.message); - exit (1); + exit(1); } fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n"); - exit(1); + exit(2); } /* That's it ;-) Of course you probably want to do more with PNG files than * just converting them all to 32-bit RGBA PNG files; you can do that between * the call to png_image_finish_read and png_image_write_to_file. You can also - * ask for the image data to be presented in a number of different formats. You - * do this by simply changing the 'format' parameter set before allocating the - * buffer. + * ask for the image data to be presented in a number of different formats. + * You do this by simply changing the 'format' parameter set before allocating + * the buffer. * * The format parameter consists of five flags that define various aspects of - * the image, you can simply add these together to get the format or you can use - * one of the predefined macros from png.h (as above): + * the image. You can simply add these together to get the format, or you can + * use one of the predefined macros from png.h (as above): * - * PNG_FORMAT_FLAG_COLOR: if set the image will have three color components per - * pixel (red, green and blue), if not set the image will just have one + * PNG_FORMAT_FLAG_COLOR: if set, the image will have three color components + * per pixel (red, green and blue); if not set, the image will just have one * luminance (grayscale) component. * - * PNG_FORMAT_FLAG_ALPHA: if set each pixel in the image will have an additional - * alpha value; a linear value that describes the degree the image pixel - * covers (overwrites) the contents of the existing pixel on the display. + * PNG_FORMAT_FLAG_ALPHA: if set, each pixel in the image will have an + * additional alpha value; a linear value that describes the degree the + * image pixel covers (overwrites) the contents of the existing pixel on the + * display. * - * PNG_FORMAT_FLAG_LINEAR: if set the components of each pixel will be returned - * as a series of 16-bit linear values, if not set the components will be - * returned as a series of 8-bit values encoded according to the 'sRGB' - * standard. The 8-bit format is the normal format for images intended for - * direct display, because almost all display devices do the inverse of the - * sRGB transformation to the data they receive. The 16-bit format is more - * common for scientific data and image data that must be further processed; - * because it is linear simple math can be done on the component values. - * Regardless of the setting of this flag the alpha channel is always linear, - * although it will be 8 bits or 16 bits wide as specified by the flag. + * PNG_FORMAT_FLAG_LINEAR: if set, the components of each pixel will be + * returned as a series of 16-bit linear values; if not set, the components + * will be returned as a series of 8-bit values encoded according to the + * sRGB standard. The 8-bit format is the normal format for images intended + * for direct display, because almost all display devices do the inverse of + * the sRGB transformation to the data they receive. The 16-bit format is + * more common for scientific data and image data that must be further + * processed; because it is linear, simple math can be done on the component + * values. Regardless of the setting of this flag, the alpha channel is + * always linear, although it will be 8 bits or 16 bits wide as specified by + * the flag. * - * PNG_FORMAT_FLAG_BGR: if set the components of a color pixel will be returned - * in the order blue, then green, then red. If not set the pixel components - * are in the order red, then green, then blue. + * PNG_FORMAT_FLAG_BGR: if set, the components of a color pixel will be + * returned in the order blue, then green, then red. If not set, the pixel + * components are in the order red, then green, then blue. * - * PNG_FORMAT_FLAG_AFIRST: if set the alpha channel (if present) precedes the - * color or grayscale components. If not set the alpha channel follows the + * PNG_FORMAT_FLAG_AFIRST: if set, the alpha channel (if present) precedes the + * color or grayscale components. If not set, the alpha channel follows the * components. * * You do not have to read directly from a file. You can read from memory or, * on systems that support it, from a FILE*. This is controlled by - * the particular png_image_read_from_ function you call at the start. Likewise - * on write you can write to a FILE* if your system supports it. Check the - * macro PNG_STDIO_SUPPORTED to see if stdio support has been included in your - * libpng build. + * the particular png_image_read_from_ function you call at the start. + * Likewise, on write, you can write to a FILE* if your system supports it. + * Check the macro PNG_STDIO_SUPPORTED to see if stdio support has been + * included in your libpng build. * - * If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data you may need to write it in - * the 8-bit format for display. You do this by setting the convert_to_8bit + * If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data, you may need to write it + * in the 8-bit format for display. You do this by setting the convert_to_8bit * flag to 'true'. * * Don't repeatedly convert between the 8-bit and 16-bit forms. There is - * significant data loss when 16-bit data is converted to the 8-bit encoding and - * the current libpng implementation of conversion to 16-bit is also + * significant data loss when 16-bit data is converted to the 8-bit encoding, + * and the current libpng implementation of conversion to 16-bit is also * significantly lossy. The latter will be fixed in the future, but the former * is unavoidable - the 8-bit format just doesn't have enough resolution. */ @@ -200,10 +202,10 @@ int main(int argc, const char **argv) * interfaces. * * All these interfaces require that you do your own error handling - your - * program must be able to arrange for control to return to your own code any - * time libpng encounters a problem. There are several ways to do this, but the - * standard way is to use the ANSI-C (C90) interface to establish a - * return point within your own code. You must do this if you do not use the + * program must be able to arrange for control to return to your own code, any + * time libpng encounters a problem. There are several ways to do this, but + * the standard way is to use the interface to establish a return + * point within your own code. You must do this if you do not use the * simplified interface (above). * * The first step is to include the header files you need, including the libpng @@ -215,7 +217,7 @@ int main(int argc, const char **argv) /* The png_jmpbuf() macro, used in error handling, became available in * libpng version 1.0.6. If you want to be able to run your code with older * versions of libpng, you must define the macro yourself (but only if it - * is not already defined by libpng!). + * is not already defined by libpng!) */ #ifndef png_jmpbuf @@ -223,10 +225,10 @@ int main(int argc, const char **argv) #endif /* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp() - * returns zero if the image is a PNG and nonzero if it isn't a PNG. + * returns zero if the image is a PNG, and nonzero otherwise. * * The function check_if_png() shown here, but not used, returns nonzero (true) - * if the file can be opened and is a PNG, 0 (false) otherwise. + * if the file can be opened and is a PNG, and 0 (false) otherwise. * * If this call is successful, and you are going to keep the file open, * you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once @@ -239,7 +241,7 @@ int main(int argc, const char **argv) * * Many applications already read the first 2 or 4 bytes from the start * of the image to determine the file type, so it would be easiest just - * to pass the bytes to png_sig_cmp() or even skip that if you know + * to pass the bytes to png_sig_cmp(), or even skip that if you know * you have a PNG file, and call png_set_sig_bytes(). */ #define PNG_BYTES_TO_CHECK 4 @@ -251,13 +253,13 @@ int check_if_png(char *file_name, FILE **fp) if ((*fp = fopen(file_name, "rb")) == NULL) return 0; - /* Read in some of the signature bytes */ + /* Read in some of the signature bytes. */ if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK) return 0; /* Compare the first PNG_BYTES_TO_CHECK bytes of the signature. - Return nonzero (true) if they match */ - + * Return nonzero (true) if they match. + */ return(!png_sig_cmp(buf, 0, PNG_BYTES_TO_CHECK)); } @@ -268,7 +270,7 @@ int check_if_png(char *file_name, FILE **fp) * some or all of the magic bytes read - see comments above). */ #ifdef open_file /* prototype 1 */ -void read_png(char *file_name) /* We need to open the file */ +void read_png(char *file_name) /* We need to open the file */ { png_structp png_ptr; png_infop info_ptr; @@ -281,7 +283,7 @@ void read_png(char *file_name) /* We need to open the file */ return (ERROR); #else no_open_file /* prototype 2 */ -void read_png(FILE *fp, int sig_read) /* File is already open */ +void read_png(FILE *fp, int sig_read) /* File is already open */ { png_structp png_ptr; png_infop info_ptr; @@ -293,7 +295,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ * functions. If you want to use the default stderr and longjump method, * you can supply NULL for the last three parameters. We also supply the * the compiler header file version, so that we know if the application - * was compiled with a compatible version of the library. REQUIRED + * was compiled with a compatible version of the library. REQUIRED. */ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp user_error_ptr, user_error_fn, user_warning_fn); @@ -317,35 +319,33 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ * the normal method of doing things with libpng). REQUIRED unless you * set up your own error handlers in the png_create_read_struct() earlier. */ - if (setjmp(png_jmpbuf(png_ptr))) { - /* Free all of the memory associated with the png_ptr and info_ptr */ + /* Free all of the memory associated with the png_ptr and info_ptr. */ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); - /* If we get here, we had a problem reading the file */ + /* If we get here, we had a problem reading the file. */ return (ERROR); } - /* One of the following I/O initialization methods is REQUIRED */ + /* One of the following I/O initialization methods is REQUIRED. */ #ifdef streams /* PNG file I/O method 1 */ - /* Set up the input control if you are using standard C streams */ + /* Set up the input control if you are using standard C streams. */ png_init_io(png_ptr, fp); #else no_streams /* PNG file I/O method 2 */ /* If you are using replacement read functions, instead of calling - * png_init_io() here you would call: + * png_init_io(), you would call: */ png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn); - /* where user_io_ptr is a structure you want available to the callbacks */ + /* where user_io_ptr is a structure you want available to the callbacks. */ #endif no_streams /* Use only one I/O method! */ /* If we have already read some of the signature */ png_set_sig_bytes(png_ptr, sig_read); #ifdef hilevel - /* - * If you have enough memory to read in the entire image at once, + /* If you have enough memory to read in the entire image at once, * and you need to specify only transforms that can be controlled * with one of the PNG_TRANSFORM_* bits (this presently excludes * quantizing, filling, setting background, and doing gamma @@ -355,10 +355,10 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ png_read_png(png_ptr, info_ptr, png_transforms, NULL); #else - /* OK, you're doing it the hard way, with the lower-level functions */ + /* OK, you're doing it the hard way, with the lower-level functions. */ /* The call to png_read_info() gives us all of the information from the - * PNG file before the first IDAT (image data chunk). REQUIRED + * PNG file before the first IDAT (image data chunk). REQUIRED. */ png_read_info(png_ptr, info_ptr); @@ -386,20 +386,21 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ */ png_set_strip_alpha(png_ptr); - /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single + /* Extract multiple pixels with bit depths of 1, 2 or 4 from a single * byte into separate bytes (useful for paletted and grayscale images). */ png_set_packing(png_ptr); /* Change the order of packed pixels to least significant bit first - * (not useful if you are using png_set_packing). */ + * (not useful if you are using png_set_packing). + */ png_set_packswap(png_ptr); - /* Expand paletted colors into true RGB triplets */ + /* Expand paletted colors into true RGB triplets. */ if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr); - /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ + /* Expand grayscale images to the full 8 bits from 1, 2 or 4 bits/pixel. */ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr); @@ -410,12 +411,11 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ png_set_tRNS_to_alpha(png_ptr); /* Set the background color to draw transparent and alpha images over. - * It is possible to set the red, green, and blue components directly - * for paletted images instead of supplying a palette index. Note that + * It is possible to set the red, green and blue components directly + * for paletted images, instead of supplying a palette index. Note that, * even if the PNG file supplies a background, you are not required to * use it - you should use the (solid) application background if it has one. */ - png_color_16 my_background, *image_background; if (png_get_bKGD(png_ptr, info_ptr, &image_background) != 0) @@ -425,32 +425,29 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ png_set_background(png_ptr, &my_background, PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); - /* Some suggestions as to how to get a screen gamma value + /* Some suggestions as to how to get a screen gamma value. * * Note that screen gamma is the display_exponent, which includes - * the CRT_exponent and any correction for viewing conditions + * the CRT_exponent and any correction for viewing conditions. */ if (/* We have a user-defined screen gamma value */) - { screen_gamma = user-defined screen_gamma; - } - /* This is one way that applications share the same screen gamma value */ + /* This is one way that applications share the same screen gamma value. */ else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL) - { screen_gamma = atof(gamma_str); - } /* If we don't have another value */ else { - screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor - in a dimly lit room */ - screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */ + screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor + in a dimly lit room */ + screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac + systems */ } /* Tell libpng to handle the gamma conversion for you. The final call * is a good guess for PC generated images, but it should be configurable - * by the user at run time by the user. It is strongly suggested that - * your application support gamma correction. + * by the user at run time. Gamma correction support in your application + * is strongly recommended. */ int intent; @@ -467,7 +464,7 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ } #ifdef PNG_READ_QUANTIZE_SUPPORTED - /* Quantize RGB files down to 8-bit palette or reduce palettes + /* Quantize RGB files down to 8-bit palette, or reduce palettes * to the number of colors available on your screen. */ if ((color_type & PNG_COLOR_MASK_COLOR) != 0) @@ -475,29 +472,26 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ int num_palette; png_colorp palette; - /* This reduces the image to the application supplied palette */ + /* This reduces the image to the application-supplied palette. */ if (/* We have our own palette */) { - /* An array of colors to which the image should be quantized */ + /* An array of colors to which the image should be quantized. */ png_color std_color_cube[MAX_SCREEN_COLORS]; - png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS, MAX_SCREEN_COLORS, NULL, 0); } - /* This reduces the image to the palette supplied in the file */ + /* This reduces the image to the palette supplied in the file. */ else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) != 0) { png_uint_16p histogram = NULL; - png_get_hIST(png_ptr, info_ptr, &histogram); - png_set_quantize(png_ptr, palette, num_palette, max_screen_colors, histogram, 0); } } #endif /* READ_QUANTIZE */ - /* Invert monochrome files to have 0 as white and 1 as black */ + /* Invert monochrome files to have 0 as white and 1 as black. */ png_set_invert_mono(png_ptr); /* If you want to shift the pixel values from the range [0,255] or @@ -507,22 +501,21 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT) != 0) { png_color_8p sig_bit_p; - png_get_sBIT(png_ptr, info_ptr, &sig_bit_p); png_set_shift(png_ptr, sig_bit_p); } - /* Flip the RGB pixels to BGR (or RGBA to BGRA) */ + /* Flip the RGB pixels to BGR (or RGBA to BGRA). */ if ((color_type & PNG_COLOR_MASK_COLOR) != 0) png_set_bgr(png_ptr); - /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ + /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR). */ png_set_swap_alpha(png_ptr); - /* Swap bytes of 16-bit files to least significant byte first */ + /* Swap bytes of 16-bit files to least significant byte first. */ png_set_swap(png_ptr); - /* Add filler (or alpha) byte (before/after each RGB triplet) */ + /* Add filler (or alpha) byte (before/after each RGB triplet). */ png_set_filler(png_ptr, 0xffff, PNG_FILLER_AFTER); #ifdef PNG_READ_INTERLACING_SUPPORTED @@ -535,40 +528,31 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ number_passes = 1; #endif /* READ_INTERLACING */ - /* Optional call to gamma correct and add the background to the palette * and update info structure. REQUIRED if you are expecting libpng to - * update the palette for you (ie you selected such a transform above). + * update the palette for you (i.e. you selected such a transform above). */ png_read_update_info(png_ptr, info_ptr); /* Allocate the memory to hold the image using the fields of info_ptr. */ - - /* The easiest way to read the image: */ png_bytep row_pointers[height]; - - /* Clear the pointer array */ for (row = 0; row < height; row++) - row_pointers[row] = NULL; - + row_pointers[row] = NULL; /* Clear the pointer array */ for (row = 0; row < height; row++) row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); - /* Now it's time to read the image. One of these methods is REQUIRED */ + /* Now it's time to read the image. One of these methods is REQUIRED. */ #ifdef entire /* Read the entire image in one go */ png_read_image(png_ptr, row_pointers); #else no_entire /* Read the image one or more scanlines at a time */ /* The other way to read images - deal with interlacing: */ - for (pass = 0; pass < number_passes; pass++) { #ifdef single /* Read the image a single row at a time */ for (y = 0; y < height; y++) - { png_read_rows(png_ptr, &row_pointers[y], NULL, 1); - } #else no_single /* Read the image several rows at a time */ for (y = 0; y < height; y += number_of_rows) @@ -582,24 +566,24 @@ void read_png(FILE *fp, int sig_read) /* File is already open */ #endif no_sparkle /* Use only one of these two methods */ } - /* If you want to display the image after every pass, do so here */ + /* If you want to display the image after every pass, do so here. */ #endif no_single /* Use only one of these two methods */ } #endif no_entire /* Use only one of these two methods */ - /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ + /* Read rest of file, and get additional chunks in info_ptr. REQUIRED. */ png_read_end(png_ptr, info_ptr); #endif hilevel - /* At this point you have read the entire image */ + /* At this point you have read the entire image. */ - /* Clean up after the read, and free any memory allocated - REQUIRED */ + /* Clean up after the read, and free any memory allocated. REQUIRED. */ png_destroy_read_struct(&png_ptr, &info_ptr, NULL); - /* Close the file */ + /* Close the file. */ fclose(fp); - /* That's it */ + /* That's it! */ return (OK); } @@ -611,34 +595,30 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) /* Create and initialize the png_struct with the desired error handler * functions. If you want to use the default stderr and longjump method, * you can supply NULL for the last three parameters. We also check that - * the library version is compatible in case we are using dynamically + * the library version is compatible, in case we are using dynamically * linked libraries. */ *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp user_error_ptr, user_error_fn, user_warning_fn); - if (*png_ptr == NULL) { *info_ptr = NULL; return (ERROR); } - *info_ptr = png_create_info_struct(png_ptr); - if (*info_ptr == NULL) { png_destroy_read_struct(png_ptr, info_ptr, NULL); return (ERROR); } - if (setjmp(png_jmpbuf((*png_ptr)))) { png_destroy_read_struct(png_ptr, info_ptr, NULL); return (ERROR); } - /* This one's new. You will need to provide all three - * function callbacks, even if you aren't using them all. + /* You will need to provide all three function callbacks, + * even if you aren't using all of them. * If you aren't using all functions, you can specify NULL * parameters. Even when all three functions are NULL, * you need to call png_set_progressive_read_fn(). @@ -651,7 +631,6 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) */ png_set_progressive_read_fn(*png_ptr, (void *)stream_data, info_callback, row_callback, end_callback); - return (OK); } @@ -661,18 +640,18 @@ process_data(png_structp *png_ptr, png_infop *info_ptr, { if (setjmp(png_jmpbuf((*png_ptr)))) { - /* Free the png_ptr and info_ptr memory on error */ + /* Free the png_ptr and info_ptr memory on error. */ png_destroy_read_struct(png_ptr, info_ptr, NULL); return (ERROR); } - /* This one's new also. Simply give it chunks of data as - * they arrive from the data stream (in order, of course). + /* Give chunks of data as they arrive from the data stream + * (in order, of course). * On segmented machines, don't give it any more than 64K. * The library seems to run fine with sizes of 4K, although - * you can give it much less if necessary (I assume you can + * you can give it much less if necessary. (I assume you can * give it chunks of 1 byte, but I haven't tried with less - * than 256 bytes yet). When this function returns, you may + * than 256 bytes yet.) When this function returns, you may * want to display any rows that were generated in the row * callback, if you aren't already displaying them there. */ @@ -694,8 +673,7 @@ info_callback(png_structp png_ptr, png_infop info) row_callback(png_structp png_ptr, png_bytep new_row, png_uint_32 row_num, int pass) { - /* - * This function is called for every row in the image. If the + /* This function is called for every row in the image. If the * image is interlaced, and you turned on the interlace handler, * this function will be called for every row in every pass. * @@ -706,25 +684,22 @@ row_callback(png_structp png_ptr, png_bytep new_row, * The new row data pointer "new_row" may be NULL, indicating there is * no new data to be replaced (in cases of interlace loading). * - * If new_row is not NULL then you need to call - * png_progressive_combine_row() to replace the corresponding row as + * If new_row is not NULL, then you need to call + * png_progressive_combine_row(), to replace the corresponding row as * shown below: */ - /* Get pointer to corresponding row in our - * PNG read buffer. - */ + /* Get pointer to corresponding row in our PNG read buffer. */ png_bytep old_row = ((png_bytep *)our_data)[row_num]; #ifdef PNG_READ_INTERLACING_SUPPORTED - /* If both rows are allocated then copy the new row + /* If both rows are allocated, then copy the new row * data to the corresponding row data. */ - if ((old_row != NULL) && (new_row != NULL)) - png_progressive_combine_row(png_ptr, old_row, new_row); + if (old_row != NULL && new_row != NULL) + png_progressive_combine_row(png_ptr, old_row, new_row); - /* - * The rows and passes are called in order, so you don't really + /* The rows and passes are called in order, so you don't really * need the row_num and pass, but I'm supplying them because it * may make your life easier. * @@ -735,7 +710,6 @@ row_callback(png_structp png_ptr, png_bytep new_row, * (it just does the memcpy for you) if it will make the code * easier. Thus, you can just do this for all cases: */ - png_progressive_combine_row(png_ptr, old_row, new_row); /* where old_row is what was displayed for previous rows. Note @@ -782,14 +756,13 @@ void write_png(char *file_name /* , ... other image information ... */) */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp user_error_ptr, user_error_fn, user_warning_fn); - if (png_ptr == NULL) { fclose(fp); return (ERROR); } - /* Allocate/initialize the image information data. REQUIRED */ + /* Allocate/initialize the image information data. REQUIRED. */ info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { @@ -798,30 +771,30 @@ void write_png(char *file_name /* , ... other image information ... */) return (ERROR); } - /* Set error handling. REQUIRED if you aren't supplying your own + /* Set up error handling. REQUIRED if you aren't supplying your own * error handling functions in the png_create_write_struct() call. */ if (setjmp(png_jmpbuf(png_ptr))) { - /* If we get here, we had a problem writing the file */ + /* If we get here, we had a problem writing the file. */ fclose(fp); png_destroy_write_struct(&png_ptr, &info_ptr); return (ERROR); } - /* One of the following I/O initialization functions is REQUIRED */ + /* One of the following I/O initialization functions is REQUIRED. */ #ifdef streams /* I/O initialization method 1 */ - /* Set up the output control if you are using standard C streams */ + /* Set up the output control if you are using standard C streams. */ png_init_io(png_ptr, fp); #else no_streams /* I/O initialization method 2 */ /* If you are using replacement write functions, instead of calling - * png_init_io() here you would call + * png_init_io(), you would call: */ png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, user_IO_flush_function); - /* where user_io_ptr is a structure you want available to the callbacks */ + /* where user_io_ptr is a structure you want available to the callbacks. */ #endif no_streams /* Only use one initialization method */ #ifdef hilevel @@ -832,30 +805,32 @@ void write_png(char *file_name /* , ... other image information ... */) png_write_png(png_ptr, info_ptr, png_transforms, NULL); #else - /* This is the hard way */ + /* This is the hard way. */ /* Set the image information here. Width and height are up to 2^31, - * bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on - * the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, + * bit_depth is one of 1, 2, 4, 8 or 16, but valid values also depend on + * the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, * PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, * or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or * PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST - * currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED + * currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. + * REQUIRED. */ - png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, - PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, + PNG_COLOR_TYPE_???, PNG_INTERLACE_????, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - /* Set the palette if there is one. REQUIRED for indexed-color images */ - palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH - * (sizeof (png_color))); + /* Set the palette if there is one. REQUIRED for indexed-color images. */ + palette = (png_colorp)png_malloc(png_ptr, + PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))); /* ... Set palette colors ... */ png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); - /* You must not free palette here, because png_set_PLTE only makes a link to - * the palette that you malloced. Wait until you are about to destroy + /* You must not free palette here, because png_set_PLTE only makes a link + * to the palette that you allocated. Wait until you are about to destroy * the png structure. */ - /* Optional significant bit (sBIT) chunk */ + /* Optional significant bit (sBIT) chunk. */ png_color_8 sig_bit; /* If we are dealing with a grayscale image then */ @@ -871,18 +846,17 @@ void write_png(char *file_name /* , ... other image information ... */) png_set_sBIT(png_ptr, info_ptr, &sig_bit); - /* Optional gamma chunk is strongly suggested if you have any guess * as to the correct gamma of the image. */ png_set_gAMA(png_ptr, info_ptr, gamma); - /* Optionally write comments into the image */ + /* Optionally write comments into the image. */ { png_text text_ptr[3]; - char key0[]="Title"; - char text0[]="Mona Lisa"; + char key0[] = "Title"; + char text0[] = "Mona Lisa"; text_ptr[0].key = key0; text_ptr[0].text = text0; text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; @@ -890,8 +864,8 @@ void write_png(char *file_name /* , ... other image information ... */) text_ptr[0].lang = NULL; text_ptr[0].lang_key = NULL; - char key1[]="Author"; - char text1[]="Leonardo DaVinci"; + char key1[] = "Author"; + char text1[] = "Leonardo DaVinci"; text_ptr[1].key = key1; text_ptr[1].text = text1; text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; @@ -899,8 +873,8 @@ void write_png(char *file_name /* , ... other image information ... */) text_ptr[1].lang = NULL; text_ptr[1].lang_key = NULL; - char key2[]="Description"; - char text2[]=""; + char key2[] = "Description"; + char text2[] = ""; text_ptr[2].key = key2; text_ptr[2].text = text2; text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; @@ -911,14 +885,14 @@ void write_png(char *file_name /* , ... other image information ... */) png_set_text(write_ptr, write_info_ptr, text_ptr, 3); } - /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */ + /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs. */ - /* Note that if sRGB is present the gAMA and cHRM chunks must be ignored + /* Note that if sRGB is present, the gAMA and cHRM chunks must be ignored * on read and, if your application chooses to write them, they must - * be written in accordance with the sRGB profile + * be written in accordance with the sRGB profile. */ - /* Write the file header information. REQUIRED */ + /* Write the file header information. REQUIRED. */ png_write_info(png_ptr, info_ptr); /* If you want, you can write the info in two steps, in case you need to @@ -942,7 +916,7 @@ void write_png(char *file_name /* , ... other image information ... */) * all optional. Only call them if you want them. */ - /* Invert monochrome pixels */ + /* Invert monochrome pixels. */ png_set_invert_mono(png_ptr); /* Shift the pixels up to a legal bit depth and fill in @@ -950,30 +924,29 @@ void write_png(char *file_name /* , ... other image information ... */) */ png_set_shift(png_ptr, &sig_bit); - /* Pack pixels into bytes */ + /* Pack pixels into bytes. */ png_set_packing(png_ptr); - /* Swap location of alpha bytes from ARGB to RGBA */ + /* Swap location of alpha bytes from ARGB to RGBA. */ png_set_swap_alpha(png_ptr); /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into - * RGB (4 channels -> 3 channels). The second parameter is not used. + * RGB (4 channels -> 3 channels). The second parameter is not used. */ png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); - /* Flip BGR pixels to RGB */ + /* Flip BGR pixels to RGB. */ png_set_bgr(png_ptr); - /* Swap bytes of 16-bit files to most significant byte first */ + /* Swap bytes of 16-bit files to most significant byte first. */ png_set_swap(png_ptr); - /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */ + /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats. */ png_set_packswap(png_ptr); - /* Turn on interlace handling if you are not using png_write_image() */ + /* Turn on interlace handling if you are not using png_write_image(). */ if (interlacing != 0) number_passes = png_set_interlace_handling(png_ptr); - else number_passes = 1; @@ -983,29 +956,28 @@ void write_png(char *file_name /* , ... other image information ... */) */ png_uint_32 k, height, width; - /* In this example, "image" is a one-dimensional array of bytes */ + /* In this example, "image" is a one-dimensional array of bytes. */ - /* Guard against integer overflow */ - if (height > PNG_SIZE_MAX/(width*bytes_per_pixel)) { - png_error(png_ptr, "Image_data buffer would be too large"); - } - png_byte image[height*width*bytes_per_pixel]; + /* Guard against integer overflow. */ + if (height > PNG_SIZE_MAX / (width * bytes_per_pixel)) + png_error(png_ptr, "Image data buffer would be too large"); + png_byte image[height * width * bytes_per_pixel]; png_bytep row_pointers[height]; - if (height > PNG_UINT_32_MAX/(sizeof (png_bytep))) - png_error (png_ptr, "Image is too tall to process in memory"); + if (height > PNG_UINT_32_MAX / (sizeof (png_bytep))) + png_error(png_ptr, "Image is too tall to process in memory"); - /* Set up pointers into your "image" byte array */ + /* Set up pointers into your "image" byte array. */ for (k = 0; k < height; k++) - row_pointers[k] = image + k*width*bytes_per_pixel; + row_pointers[k] = image + k * width * bytes_per_pixel; - /* One of the following output methods is REQUIRED */ + /* One of the following output methods is REQUIRED. */ #ifdef entire /* Write out the entire image data in one call */ png_write_image(png_ptr, row_pointers); - /* The other way to write the image - deal with interlacing */ + /* The other way to write the image - deal with interlacing. */ #else no_entire /* Write out the image data by one or more scanlines */ @@ -1017,27 +989,27 @@ void write_png(char *file_name /* , ... other image information ... */) /* Write a few rows at a time. */ png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows); - /* If you are only writing one row at a time, this works */ + /* If you are only writing one row at a time, this works. */ for (y = 0; y < height; y++) png_write_rows(png_ptr, &row_pointers[y], 1); } #endif no_entire /* Use only one output method */ /* You can write optional chunks like tEXt, zTXt, and tIME at the end - * as well. Shouldn't be necessary in 1.2.0 and up as all the public - * chunks are supported and you can use png_set_unknown_chunks() to + * as well. Shouldn't be necessary in 1.2.0 and up, as all the public + * chunks are supported, and you can use png_set_unknown_chunks() to * register unknown chunks into the info structure to be written out. */ - /* It is REQUIRED to call this to finish writing the rest of the file */ + /* It is REQUIRED to call this to finish writing the rest of the file. */ png_write_end(png_ptr, info_ptr); #endif hilevel - /* If you png_malloced a palette, free it here (don't free info_ptr->palette, - * as recommended in versions 1.0.5m and earlier of this example; if - * libpng mallocs info_ptr->palette, libpng will free it). If you - * allocated it with malloc() instead of png_malloc(), use free() instead - * of png_free(). + /* If you png_malloced a palette, free it here. + * (Don't free info_ptr->palette, as shown in versions 1.0.5m and earlier of + * this example; if libpng mallocs info_ptr->palette, libpng will free it). + * If you allocated it with malloc() instead of png_malloc(), use free() + * instead of png_free(). */ png_free(png_ptr, palette); palette = NULL; @@ -1048,19 +1020,20 @@ void write_png(char *file_name /* , ... other image information ... */) */ png_free(png_ptr, trans); trans = NULL; - /* Whenever you use png_free() it is a good idea to set the pointer to + + /* Whenever you use png_free(), it is a good idea to set the pointer to * NULL in case your application inadvertently tries to png_free() it - * again. When png_free() sees a NULL it returns without action, thus - * avoiding the double-free security problem. + * again. When png_free() sees a NULL it returns without action, avoiding + * the double-free problem. */ - /* Clean up after the write, and free any memory allocated */ + /* Clean up after the write, and free any allocated memory. */ png_destroy_write_struct(&png_ptr, &info_ptr); - /* Close the file */ + /* Close the file. */ fclose(fp); - /* That's it */ + /* That's it! */ return (OK); } diff --git a/dll/3rdparty/libpng/docs/libpng-manual.txt b/dll/3rdparty/libpng/docs/libpng-manual.txt index b14a534163b..19cfed28add 100644 --- a/dll/3rdparty/libpng/docs/libpng-manual.txt +++ b/dll/3rdparty/libpng/docs/libpng-manual.txt @@ -1,7 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.35 - July 15, 2018 - Updated and distributed by Glenn Randers-Pehrson + Copyright (c) 2018 Cosmin Truta Copyright (c) 1998-2018 Glenn Randers-Pehrson This document is released under the libpng license. @@ -10,9 +9,13 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: + libpng version 1.6.36 - December 1, 2018 + Updated and distributed by Cosmin Truta + Copyright (c) 2018 Cosmin Truta + libpng versions 0.97, January 1998, through 1.6.35 - July 15, 2018 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2017 Glenn Randers-Pehrson + Copyright (c) 1998-2018 Glenn Randers-Pehrson libpng 1.0 beta 6 - version 0.96 - May 28, 1997 Updated and distributed by Andreas Dilger @@ -44,7 +47,6 @@ libpng-manual.txt - A description on how to use and modify libpng XIII. Detecting libpng XIV. Source code repository XV. Coding style - XVI. Y2K Compliance in libpng I. Introduction @@ -65,7 +67,7 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at -. The W3C and ISO documents have identical technical content. The PNG-1.2 specification is available at @@ -73,9 +75,9 @@ The PNG-1.2 specification is available at It is technically equivalent to the PNG specification (second edition) but has some additional material. -The PNG-1.0 specification is available as RFC 2083 +The PNG-1.0 specification is available as RFC 2083 at and as a -W3C Recommendation . +W3C Recommendation at . Some additional chunks are described in the special-purpose public chunks documents at @@ -4054,7 +4056,7 @@ Flags containing additional information about the image are held in the 'flags' field of png_image. PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB == 0x01 - This indicates the the RGB values of the in-memory bitmap do not + This indicates that the RGB values of the in-memory bitmap do not correspond to the red, green and blue end-points defined by sRGB. PNG_IMAGE_FLAG_FAST == 0x02 @@ -4520,7 +4522,7 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements having level = 0 will be printed. There aren't any such statements in this version of libpng, but if you insert some they will be printed. -VII. MNG support +VII. MNG support The MNG specification (available at http://www.libpng.org/pub/mng) allows certain extensions to PNG for PNG images that are embedded in MNG datastreams. @@ -4547,7 +4549,7 @@ or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at https://www.libmng.com/) instead. -VIII. Changes to Libpng from version 0.88 +VIII. Changes to Libpng from version 0.88 It should be noted that versions of libpng later than 0.96 are not distributed by the original libpng author, Guy Schalnat, nor by @@ -4602,7 +4604,7 @@ application: png_uint_32 application_vn = PNG_LIBPNG_VER; -IX. Changes to Libpng from version 1.0.x to 1.2.x +IX. Changes to Libpng from version 1.0.x to 1.2.x Support for user memory management was enabled by default. To accomplish this, the functions png_create_read_struct_2(), @@ -4699,7 +4701,7 @@ which also expands tRNS to alpha was replaced with png_set_expand_gray_1_2_4_to_8() which does not. It has been deprecated since libpng-1.0.18 and 1.2.9. -X. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x +X. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x Private libpng prototypes and macro definitions were moved from png.h and pngconf.h into a new pngpriv.h header file. @@ -4809,7 +4811,7 @@ was renamed to PNG_READ_QUANTIZE_SUPPORTED. We removed the trailing '.' from the warning and error messages. -XI. Changes to Libpng from version 1.4.x to 1.5.x +XI. Changes to Libpng from version 1.4.x to 1.5.x From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the function) incorrectly returned a value of type png_uint_32. @@ -4872,7 +4874,7 @@ to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytep. There are changes of form in png.h, including new and changed macros to declare parts of the API. Some API functions with arguments that are pointers to data not modified within the function have been corrected to -declare these arguments with PNG_CONST. +declare these arguments with const. Much of the internal use of C macros to control the library build has also changed and some of this is visible in the exported header files, in @@ -5067,7 +5069,7 @@ even though the default is to use the macros - this allows applications to choose at app buildtime whether or not to use macros (previously impossible because the functions weren't in the default build.) -XII. Changes to Libpng from version 1.5.x to 1.6.x +XII. Changes to Libpng from version 1.5.x to 1.6.x A "simplified API" has been added (see documentation in png.h and a simple example in contrib/examples/pngtopng.c). The new publicly visible API @@ -5230,7 +5232,7 @@ attempt to decode the Exif profile; it simply returns a byte array containing the profile to the calling application which must do its own decoding. -XIII. Detecting libpng +XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never changed, and is unaffected by conditional compilation macros. It is the @@ -5255,7 +5257,7 @@ or you can browse it with a web browser at https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to png-mng-implement at lists.sourceforge.net or -you can upload them to the libpng bug tracker at +uploaded to the libpng bug tracker at https://libpng.sourceforge.io/ @@ -5405,58 +5407,3 @@ We do not use the TAB character for indentation in the C sources. Lines do not exceed 80 characters. Other rules can be inferred by inspecting the libpng source. - -XVI. Y2K Compliance in libpng - -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.35 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. - -The string is - "char time_buffer[29]" in png_struct. This is no longer used -in libpng-1.6.x and will be removed from libpng-1.7.0. - -There are seven time-related functions: - - png_convert_to_rfc_1123_buffer() in png.c - (formerly png_convert_to_rfc_1152() in error, and - also formerly png_convert_to_rfc_1123()) - png_convert_from_struct_tm() in pngwrite.c, called - in pngwrite.c - png_convert_from_time_t() in pngwrite.c - png_get_tIME() in pngget.c - png_handle_tIME() in pngrutil.c, called in pngread.c - png_set_tIME() in pngset.c - png_write_tIME() in pngwutil.c, called in pngwrite.c - -All appear to handle dates properly in a Y2K environment. The -png_convert_from_time_t() function calls gmtime() to convert from system -clock time, which returns (year - 1900), which we properly convert to -the full 4-digit year. There is a possibility that applications using -libpng are not passing 4-digit years into the png_convert_to_rfc_1123() -function, or that they are incorrectly passing only a 2-digit year -instead of "year - 1900" into the png_convert_from_struct_tm() function, -but this is not under our control. The libpng documentation has always -stated that it works with 4-digit years, and the APIs have been -documented as such. - -The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned -integer to hold the year, and can hold years as large as 65535. - -zlib, upon which libpng depends, is also Y2K compliant. It contains -no date-related code. - - - Glenn Randers-Pehrson - libpng maintainer - PNG Development Group diff --git a/dll/3rdparty/libpng/png.c b/dll/3rdparty/libpng/png.c index a25afebcc8c..3dce191d17e 100644 --- a/dll/3rdparty/libpng/png.c +++ b/dll/3rdparty/libpng/png.c @@ -1,10 +1,10 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_35 Your_png_h_is_not_version_1_6_35; +typedef png_libpng_version_1_6_36 Your_png_h_is_not_version_1_6_36; #ifdef __GNUC__ /* The version tests may need to be added to, but the problem warning has @@ -736,7 +736,7 @@ png_save_int_32(png_bytep buf, png_int_32 i) int PNGAPI png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime) { - static PNG_CONST char short_months[12][4] = + static const char short_months[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; @@ -814,20 +814,14 @@ png_get_copyright(png_const_structrp png_ptr) #ifdef PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT #else -# ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.35 - July 15, 2018" PNG_STRING_NEWLINE \ + "libpng version 1.6.36" PNG_STRING_NEWLINE \ + "Copyright (c) 2018 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 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.35 - July 15, 2018\ - Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\ - Copyright (c) 1996-1997 Andreas Dilger\ - Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; -# endif #endif } @@ -1121,7 +1115,7 @@ png_colorspace_set_gamma(png_const_structrp png_ptr, png_colorspacerp colorspace, png_fixed_point gAMA) { /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't - * occur. Since the fixed point representation is asymetrical it is + * occur. Since the fixed point representation is asymmetrical it is * possible for 1/gamma to overflow the limit of 21474 and this means the * gamma value must be at least 5/100000 and hence at most 20000.0. For * safety the limits here are a little narrower. The values are 0.00016 to @@ -3134,11 +3128,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size, /* The total output count (max) is now 4+precision */ /* Check for an exponent, if we don't need one we are - * done and just need to terminate the string. At - * this point exp_b10==(-1) is effectively a flag - it got - * to '-1' because of the decrement after outputting - * the decimal point above (the exponent required is - * *not* -1!) + * done and just need to terminate the string. At this + * point, exp_b10==(-1) is effectively a flag: it got + * to '-1' because of the decrement, after outputting + * the decimal point above. (The exponent required is + * *not* -1.) */ if (exp_b10 >= (-1) && exp_b10 <= 2) { @@ -3976,18 +3970,18 @@ png_gamma_correct(png_structrp png_ptr, unsigned int value, */ static void png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) + unsigned int shift, png_fixed_point gamma_val) { /* Various values derived from 'shift': */ - PNG_CONST unsigned int num = 1U << (8U - shift); + unsigned int num = 1U << (8U - shift); #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* CSE the division and work round wacky GCC warnings (see the comments * in png_gamma_8bit_correct for where these come from.) */ - PNG_CONST double fmax = 1./(((png_int_32)1 << (16U - shift))-1); + double fmax = 1.0 / (((png_int_32)1 << (16U - shift)) - 1); #endif - PNG_CONST unsigned int max = (1U << (16U - shift))-1U; - PNG_CONST unsigned int max_by_2 = 1U << (15U-shift); + unsigned int max = (1U << (16U - shift)) - 1U; + unsigned int max_by_2 = 1U << (15U - shift); unsigned int i; png_uint_16pp table = *ptable = @@ -4053,10 +4047,10 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable, */ static void png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, - PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val) + unsigned int shift, png_fixed_point gamma_val) { - PNG_CONST unsigned int num = 1U << (8U - shift); - PNG_CONST unsigned int max = (1U << (16U - shift))-1U; + unsigned int num = 1U << (8U - shift); + unsigned int max = (1U << (16U - shift))-1U; unsigned int i; png_uint_32 last; @@ -4121,7 +4115,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable, */ static void png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable, - PNG_CONST png_fixed_point gamma_val) + png_fixed_point gamma_val) { unsigned int i; png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256); diff --git a/dll/3rdparty/libpng/pngdebug.h b/dll/3rdparty/libpng/pngdebug.h index 15a7ed0c95f..00d5a4569e4 100644 --- a/dll/3rdparty/libpng/pngdebug.h +++ b/dll/3rdparty/libpng/pngdebug.h @@ -1,10 +1,10 @@ /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c * - * Last changed in libpng 1.6.8 [December 19, 2013] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 diff --git a/dll/3rdparty/libpng/pngerror.c b/dll/3rdparty/libpng/pngerror.c index ad48bfb9864..ec3a709b9d2 100644 --- a/dll/3rdparty/libpng/pngerror.c +++ b/dll/3rdparty/libpng/pngerror.c @@ -1,10 +1,10 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2017 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -425,7 +425,7 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message) * if the character is invalid. */ #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) -static PNG_CONST char png_digit[16] = { +static const char png_digit[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; @@ -885,7 +885,7 @@ PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message), PNG_NORETURN) { - const png_const_structrp png_ptr = png_nonconst_ptr; + png_const_structrp png_ptr = png_nonconst_ptr; png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); /* An error is always logged here, overwriting anything (typically a warning) @@ -920,7 +920,7 @@ png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message), void /* PRIVATE */ PNGCBAPI png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message) { - const png_const_structrp png_ptr = png_nonconst_ptr; + png_const_structrp png_ptr = png_nonconst_ptr; png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); /* A warning is only logged if there is no prior warning or error. */ diff --git a/dll/3rdparty/libpng/pngget.c b/dll/3rdparty/libpng/pngget.c index 2325508f1dc..5abf1efd9f7 100644 --- a/dll/3rdparty/libpng/pngget.c +++ b/dll/3rdparty/libpng/pngget.c @@ -1,10 +1,10 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 diff --git a/dll/3rdparty/libpng/pnginfo.h b/dll/3rdparty/libpng/pnginfo.h index 2fcf868dacd..1f98dedc428 100644 --- a/dll/3rdparty/libpng/pnginfo.h +++ b/dll/3rdparty/libpng/pnginfo.h @@ -1,10 +1,10 @@ /* pnginfo.h - header file for PNG reference library * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 diff --git a/dll/3rdparty/libpng/pngmem.c b/dll/3rdparty/libpng/pngmem.c index ff3ef7e88c2..09ed9c1c990 100644 --- a/dll/3rdparty/libpng/pngmem.c +++ b/dll/3rdparty/libpng/pngmem.c @@ -1,10 +1,10 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.6.26 [October 20, 2016] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2014,2016 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 diff --git a/dll/3rdparty/libpng/pngpread.c b/dll/3rdparty/libpng/pngpread.c index c4ba51c4d4d..e283627b77c 100644 --- a/dll/3rdparty/libpng/pngpread.c +++ b/dll/3rdparty/libpng/pngpread.c @@ -1,10 +1,10 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -972,20 +972,20 @@ png_read_push_finish_row(png_structrp png_ptr) /* 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}; + static 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}; + static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ - static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; + static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ - static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; + static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h - static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; + static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; */ #endif diff --git a/dll/3rdparty/libpng/pngpriv.h b/dll/3rdparty/libpng/pngpriv.h index 3581f679199..973c3eac1f9 100644 --- a/dll/3rdparty/libpng/pngpriv.h +++ b/dll/3rdparty/libpng/pngpriv.h @@ -1,10 +1,10 @@ /* pngpriv.h - private declarations for use inside libpng * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -174,7 +174,10 @@ # else /* !defined __ARM_NEON__ */ /* The 'intrinsics' code simply won't compile without this -mfpu=neon: */ -# define PNG_ARM_NEON_IMPLEMENTATION 2 +# if !defined(__aarch64__) + /* The assembler code currently does not work on ARM64 */ +# define PNG_ARM_NEON_IMPLEMENTATION 2 +# endif /* __aarch64__ */ # endif /* __ARM_NEON__ */ # endif /* !PNG_ARM_NEON_IMPLEMENTATION */ @@ -1534,10 +1537,10 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, #endif PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr, - const png_uint_32 chunk_name),PNG_EMPTY); + png_uint_32 chunk_name),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr, - const png_uint_32 chunk_length),PNG_EMPTY); + png_uint_32 chunk_length),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); @@ -2114,6 +2117,29 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, png_const_charp key, png_bytep new_key), PNG_EMPTY); +#if PNG_ARM_NEON_IMPLEMENTATION == 1 +PNG_INTERNAL_FUNCTION(void, + png_riffle_palette_rgba, + (png_structrp, png_row_infop), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, + png_do_expand_palette_neon_rgba, + (png_structrp, + png_row_infop, + png_const_bytep, + const png_bytepp, + const png_bytepp), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, + png_do_expand_palette_neon_rgb, + (png_structrp, + png_row_infop, + png_const_bytep, + const png_bytepp, + const png_bytepp), + PNG_EMPTY); +#endif + /* Maintainer: Put new private prototypes here ^ */ #include "pngdebug.h" diff --git a/dll/3rdparty/libpng/pngread.c b/dll/3rdparty/libpng/pngread.c index bff7503ee3b..f8e762196eb 100644 --- a/dll/3rdparty/libpng/pngread.c +++ b/dll/3rdparty/libpng/pngread.c @@ -1,10 +1,10 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -1621,7 +1621,7 @@ png_image_skip_unused_chunks(png_structrp png_ptr) * errors (which are unfortunately quite common.) */ { - static PNG_CONST png_byte chunks_to_process[] = { + static const png_byte chunks_to_process[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 103, 65, 77, 65, '\0', /* gAMA */ @@ -1758,9 +1758,9 @@ png_create_colormap_entry(png_image_read_control *display, png_uint_32 alpha, int encoding) { png_imagep image = display->image; - const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? + int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; - const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && + int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 && (red != green || green != blue); if (ip > 255) @@ -1869,13 +1869,13 @@ png_create_colormap_entry(png_image_read_control *display, /* Store the value. */ { # ifdef PNG_FORMAT_AFIRST_SUPPORTED - const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && + int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 && (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; # else # define afirst 0 # endif # ifdef PNG_FORMAT_BGR_SUPPORTED - const int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; + int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; # else # define bgr 0 # endif @@ -2085,11 +2085,11 @@ png_image_read_colormap(png_voidp argument) { png_image_read_control *display = png_voidcast(png_image_read_control*, argument); - const png_imagep image = display->image; + png_imagep image = display->image; - const png_structrp png_ptr = image->opaque->png_ptr; - const png_uint_32 output_format = image->format; - const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? + png_structrp png_ptr = image->opaque->png_ptr; + png_uint_32 output_format = image->format; + int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ? P_LINEAR : P_sRGB; unsigned int cmap_entries; @@ -2802,7 +2802,7 @@ png_image_read_colormap(png_voidp argument) unsigned int num_trans = png_ptr->num_trans; png_const_bytep trans = num_trans > 0 ? png_ptr->trans_alpha : NULL; png_const_colorp colormap = png_ptr->palette; - const int do_background = trans != NULL && + int do_background = trans != NULL && (output_format & PNG_FORMAT_FLAG_ALPHA) == 0; unsigned int i; @@ -3946,7 +3946,7 @@ png_image_read_direct(png_voidp argument) */ if (linear != 0) { - PNG_CONST png_uint_16 le = 0x0001; + png_uint_16 le = 0x0001; if ((*(png_const_bytep) & le) != 0) png_set_swap(png_ptr); @@ -4108,7 +4108,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, * original PNG format because it may not occur in the output PNG format * and libpng deals with the issues of reading the original. */ - const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); + unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); /* The following checks just the 'row_stride' calculation to ensure it * fits in a signed 32-bit value. Because channels/components can be @@ -4119,7 +4119,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; - const png_uint_32 png_row_stride = image->width * channels; + png_uint_32 png_row_stride = image->width * channels; if (row_stride == 0) row_stride = (png_int_32)/*SAFE*/png_row_stride; diff --git a/dll/3rdparty/libpng/pngrio.c b/dll/3rdparty/libpng/pngrio.c index 372221483fe..7946358101b 100644 --- a/dll/3rdparty/libpng/pngrio.c +++ b/dll/3rdparty/libpng/pngrio.c @@ -1,10 +1,10 @@ /* pngrio.c - functions for data input * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 diff --git a/dll/3rdparty/libpng/pngrtran.c b/dll/3rdparty/libpng/pngrtran.c index 67d1f249a68..ccc58ce6f1d 100644 --- a/dll/3rdparty/libpng/pngrtran.c +++ b/dll/3rdparty/libpng/pngrtran.c @@ -1,10 +1,10 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -18,6 +18,17 @@ #include "pngpriv.h" +#ifdef PNG_ARM_NEON_IMPLEMENTATION +# if PNG_ARM_NEON_IMPLEMENTATION == 1 +# define PNG_ARM_NEON_INTRINSICS_AVAILABLE +# if defined(_MSC_VER) && defined(_M_ARM64) +# include +# else +# include +# endif +# endif +#endif + #ifdef PNG_READ_SUPPORTED /* Set the action on getting a CRC error for an ancillary or critical chunk. */ @@ -2986,7 +2997,6 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) */ static int png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row) - { int rgb_error = 0; @@ -2995,12 +3005,11 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row) if ((row_info->color_type & PNG_COLOR_MASK_PALETTE) == 0 && (row_info->color_type & PNG_COLOR_MASK_COLOR) != 0) { - PNG_CONST png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; - PNG_CONST png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; - PNG_CONST png_uint_32 bc = 32768 - rc - gc; - PNG_CONST png_uint_32 row_width = row_info->width; - PNG_CONST int have_alpha = - (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0; + png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; + png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; + png_uint_32 bc = 32768 - rc - gc; + png_uint_32 row_width = row_info->width; + int have_alpha = (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0; if (row_info->bit_depth == 8) { @@ -4143,12 +4152,11 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr) { if (row_info->bit_depth == 8) { - PNG_CONST png_bytep table = png_ptr->gamma_from_1; + png_bytep table = png_ptr->gamma_from_1; if (table != NULL) { - PNG_CONST int step = - (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2; + int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2; /* The alpha channel is the last component: */ row += step - 1; @@ -4162,13 +4170,12 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr) else if (row_info->bit_depth == 16) { - PNG_CONST png_uint_16pp table = png_ptr->gamma_16_from_1; - PNG_CONST int gamma_shift = png_ptr->gamma_shift; + png_uint_16pp table = png_ptr->gamma_16_from_1; + int gamma_shift = png_ptr->gamma_shift; if (table != NULL) { - PNG_CONST int step = - (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4; + int step = (row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4; /* The alpha channel is the last component: */ row += step - 2; @@ -4199,8 +4206,9 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr) * upon whether you supply trans and num_trans. */ static void -png_do_expand_palette(png_row_infop row_info, png_bytep row, - png_const_colorp palette, png_const_bytep trans_alpha, int num_trans) +png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info, + png_bytep row, png_const_colorp palette, png_const_bytep trans_alpha, + int num_trans) { int shift, value; png_bytep sp, dp; @@ -4304,14 +4312,25 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, sp = row + (size_t)row_width - 1; dp = row + ((size_t)row_width << 2) - 1; - for (i = 0; i < row_width; i++) + i = 0; +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + if (png_ptr->riffled_palette != NULL) + { + /* The RGBA optimization works with png_ptr->bit_depth == 8 + * but sometimes row_info->bit_depth has been changed to 8. + * In these cases, the palette hasn't been riffled. + */ + i = png_do_expand_palette_neon_rgba(png_ptr, row_info, row, + &sp, &dp); + } +#endif + + for (; i < row_width; i++) { if ((int)(*sp) >= num_trans) *dp-- = 0xff; - else *dp-- = trans_alpha[*sp]; - *dp-- = palette[*sp].blue; *dp-- = palette[*sp].green; *dp-- = palette[*sp].red; @@ -4328,8 +4347,13 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, { sp = row + (size_t)row_width - 1; dp = row + (size_t)(row_width * 3) - 1; + i = 0; +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + i = png_do_expand_palette_neon_rgb(png_ptr, row_info, row, + &sp, &dp); +#endif - for (i = 0; i < row_width; i++) + for (; i < row_width; i++) { *dp-- = palette[*sp].blue; *dp-- = palette[*sp].green; @@ -4743,8 +4767,22 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info) { if (row_info->color_type == PNG_COLOR_TYPE_PALETTE) { - png_do_expand_palette(row_info, png_ptr->row_buf + 1, - png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); +#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE + if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8)) + { + /* Allocate space for the decompressed full palette. */ + if (png_ptr->riffled_palette == NULL) + { + png_ptr->riffled_palette = png_malloc(png_ptr, 256*4); + if (png_ptr->riffled_palette == NULL) + png_error(png_ptr, "NULL row buffer"); + /* Build the RGBA palette. */ + png_riffle_palette_rgba(png_ptr, row_info); + } + } +#endif + png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1, + png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); } else diff --git a/dll/3rdparty/libpng/pngrutil.c b/dll/3rdparty/libpng/pngrutil.c index 7001f1976e7..d5fa08c397d 100644 --- a/dll/3rdparty/libpng/pngrutil.c +++ b/dll/3rdparty/libpng/pngrutil.c @@ -1,10 +1,10 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -1461,8 +1461,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { /* We have the ICC profile header; do the basic header checks. */ - const png_uint_32 profile_length = - png_get_uint_32(profile_header); + png_uint_32 profile_length = png_get_uint_32(profile_header); if (png_icc_check_length(png_ptr, &png_ptr->colorspace, keyword, profile_length) != 0) @@ -1479,8 +1478,8 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) * profile. The header check has already validated * that none of this stuff will overflow. */ - const png_uint_32 tag_count = png_get_uint_32( - profile_header+128); + png_uint_32 tag_count = + png_get_uint_32(profile_header + 128); png_bytep profile = png_read_buffer(png_ptr, profile_length, 2/*silent*/); @@ -3132,7 +3131,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, */ void /* PRIVATE */ -png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) +png_check_chunk_name(png_const_structrp png_ptr, png_uint_32 chunk_name) { int i; png_uint_32 cn=chunk_name; @@ -3151,7 +3150,7 @@ png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) } void /* PRIVATE */ -png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) +png_check_chunk_length(png_const_structrp png_ptr, png_uint_32 length) { png_alloc_size_t limit = PNG_UINT_31_MAX; @@ -3363,7 +3362,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) /* 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] = + static const png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] = { /* Little-endian byte masks for PACKSWAP */ { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) }, @@ -3374,7 +3373,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) /* display_mask has only three entries for the odd passes, so index by * pass>>1. */ - static PNG_CONST png_uint_32 display_mask[2][3][3] = + static const png_uint_32 display_mask[2][3][3] = { /* Little-endian byte masks for PACKSWAP */ { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) }, @@ -3687,7 +3686,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Offset to next interlace block */ - static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_read_interlace"); if (row != NULL && row_info != NULL) @@ -4329,16 +4328,16 @@ png_read_finish_row(png_structrp png_ptr) /* 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}; + static 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}; + static 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}; + static 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}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; png_debug(1, "in png_read_finish_row"); png_ptr->row_number++; @@ -4394,16 +4393,16 @@ png_read_start_row(png_structrp png_ptr) /* 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}; + static 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}; + static 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}; + static 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}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; unsigned int max_pixel_depth; size_t row_bytes; diff --git a/dll/3rdparty/libpng/pngset.c b/dll/3rdparty/libpng/pngset.c index 7cf54d9248d..ec75dbe3690 100644 --- a/dll/3rdparty/libpng/pngset.c +++ b/dll/3rdparty/libpng/pngset.c @@ -1,10 +1,10 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -137,7 +137,7 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #ifdef PNG_eXIf_SUPPORTED void PNGAPI png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, - const png_bytep eXIf_buf) + png_bytep eXIf_buf) { png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1"); PNG_UNUSED(info_ptr) @@ -146,7 +146,7 @@ png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, void PNGAPI png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, - const png_uint_32 num_exif, const png_bytep eXIf_buf) + png_uint_32 num_exif, png_bytep eXIf_buf) { int i; @@ -1399,7 +1399,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, /* Ignore all unknown chunks and all chunks recognized by * libpng except for IHDR, PLTE, tRNS, IDAT, and IEND */ - static PNG_CONST png_byte chunks_to_ignore[] = { + static const png_byte chunks_to_ignore[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ 101, 88, 73, 102, '\0', /* eXIf */ diff --git a/dll/3rdparty/libpng/pngstruct.h b/dll/3rdparty/libpng/pngstruct.h index 699e8ac68a2..94a6d041fff 100644 --- a/dll/3rdparty/libpng/pngstruct.h +++ b/dll/3rdparty/libpng/pngstruct.h @@ -1,10 +1,10 @@ /* pngstruct.h - header file for PNG reference library * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -228,6 +228,10 @@ struct png_struct_def * big_row_buf; while writing it is separately * allocated. */ +#ifdef PNG_READ_EXPAND_SUPPORTED + /* Buffer to accelerate palette transformations. */ + png_bytep riffled_palette; +#endif #ifdef PNG_WRITE_FILTER_SUPPORTED png_bytep try_row; /* buffer to save trial row when filtering */ png_bytep tst_row; /* buffer to save best trial row when filtering */ diff --git a/dll/3rdparty/libpng/pngtrans.c b/dll/3rdparty/libpng/pngtrans.c index de84aa6d6b0..1100f46ebec 100644 --- a/dll/3rdparty/libpng/pngtrans.c +++ b/dll/3rdparty/libpng/pngtrans.c @@ -1,10 +1,10 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -345,7 +345,7 @@ png_do_swap(png_row_infop row_info, png_bytep row) #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) -static PNG_CONST png_byte onebppswaptable[256] = { +static const png_byte onebppswaptable[256] = { 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, @@ -380,7 +380,7 @@ static PNG_CONST png_byte onebppswaptable[256] = { 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF }; -static PNG_CONST png_byte twobppswaptable[256] = { +static const png_byte twobppswaptable[256] = { 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, @@ -415,7 +415,7 @@ static PNG_CONST png_byte twobppswaptable[256] = { 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF }; -static PNG_CONST png_byte fourbppswaptable[256] = { +static const png_byte fourbppswaptable[256] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, diff --git a/dll/3rdparty/libpng/pngwio.c b/dll/3rdparty/libpng/pngwio.c index e5391687a2e..10e919dd038 100644 --- a/dll/3rdparty/libpng/pngwio.c +++ b/dll/3rdparty/libpng/pngwio.c @@ -1,10 +1,10 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2014,2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 diff --git a/dll/3rdparty/libpng/pngwrite.c b/dll/3rdparty/libpng/pngwrite.c index 5bd87f373e4..160c877d385 100644 --- a/dll/3rdparty/libpng/pngwrite.c +++ b/dll/3rdparty/libpng/pngwrite.c @@ -1,10 +1,10 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -469,7 +469,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) #ifdef PNG_CONVERT_tIME_SUPPORTED void PNGAPI -png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime) +png_convert_from_struct_tm(png_timep ptime, const struct tm * ttime) { png_debug(1, "in png_convert_from_struct_tm"); @@ -948,6 +948,10 @@ png_write_destroy(png_structrp png_ptr) png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list); png_free(png_ptr, png_ptr->row_buf); png_ptr->row_buf = NULL; +#ifdef PNG_READ_EXPANDED_SUPPORTED + png_free(png_ptr, png_ptr->riffled_palette); + png_ptr->riffled_palette = NULL; +#endif #ifdef PNG_WRITE_FILTER_SUPPORTED png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->try_row); @@ -1536,7 +1540,7 @@ png_write_image_16bit(png_voidp argument) display->first_row); png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row); png_uint_16p row_end; - const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; int aindex = 0; png_uint_32 y = image->height; @@ -1573,7 +1577,7 @@ png_write_image_16bit(png_voidp argument) while (out_ptr < row_end) { - const png_uint_16 alpha = in_ptr[aindex]; + png_uint_16 alpha = in_ptr[aindex]; png_uint_32 reciprocal = 0; int c; @@ -1695,7 +1699,7 @@ png_write_image_8bit(png_voidp argument) display->first_row); png_bytep output_row = png_voidcast(png_bytep, display->local_row); png_uint_32 y = image->height; - const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0) @@ -1783,25 +1787,25 @@ png_write_image_8bit(png_voidp argument) static void png_image_set_PLTE(png_image_write_control *display) { - const png_imagep image = display->image; + png_imagep image = display->image; const void *cmap = display->colormap; - const int entries = image->colormap_entries > 256 ? 256 : + int entries = image->colormap_entries > 256 ? 256 : (int)image->colormap_entries; /* NOTE: the caller must check for cmap != NULL and entries != 0 */ - const png_uint_32 format = image->format; - const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); + png_uint_32 format = image->format; + unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); # if defined(PNG_FORMAT_BGR_SUPPORTED) &&\ defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED) - const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 && + int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0; # else # define afirst 0 # endif # ifdef PNG_FORMAT_BGR_SUPPORTED - const int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; + int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0; # else # define bgr 0 # endif @@ -1951,12 +1955,12 @@ png_image_write_main(png_voidp argument) * and total image size to ensure that they are within the system limits. */ { - const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); + unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; - const png_uint_32 png_row_stride = image->width * channels; + png_uint_32 png_row_stride = image->width * channels; if (display->row_stride == 0) display->row_stride = (png_int_32)/*SAFE*/png_row_stride; @@ -2052,7 +2056,7 @@ png_image_write_main(png_voidp argument) */ if (write_16bit != 0) { - PNG_CONST png_uint_16 le = 0x0001; + png_uint_16 le = 0x0001; if ((*(png_const_bytep) & le) != 0) png_set_swap(png_ptr); @@ -2166,7 +2170,7 @@ image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data, size_t size) { png_image_write_control *display = png_voidcast(png_image_write_control*, png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/); - const png_alloc_size_t ob = display->output_bytes; + png_alloc_size_t ob = display->output_bytes; /* Check for overflow; this should never happen: */ if (size <= ((png_alloc_size_t)-1) - ob) diff --git a/dll/3rdparty/libpng/pngwtran.c b/dll/3rdparty/libpng/pngwtran.c index 3a1e0a21d25..49a13c1e98d 100644 --- a/dll/3rdparty/libpng/pngwtran.c +++ b/dll/3rdparty/libpng/pngwtran.c @@ -1,10 +1,10 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -254,8 +254,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, for (i = 0; i < istop; i++, bp++) { - - const unsigned int c = i%channels; + unsigned int c = i%channels; int j; unsigned int v, out; @@ -283,7 +282,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, for (bp = row, i = 0; i < istop; i++) { - const unsigned int c = i%channels; + unsigned int c = i%channels; int j; unsigned int value, v; diff --git a/dll/3rdparty/libpng/pngwutil.c b/dll/3rdparty/libpng/pngwutil.c index ab431e712c9..16345e4c0ba 100644 --- a/dll/3rdparty/libpng/pngwutil.c +++ b/dll/3rdparty/libpng/pngwutil.c @@ -1,10 +1,10 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.6.35 [July 15, 2018] + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -1893,16 +1893,16 @@ png_write_start_row(png_structrp png_ptr) /* 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}; + static 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}; + static 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}; + static 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}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif png_alloc_size_t buf_size; @@ -2008,16 +2008,16 @@ png_write_finish_row(png_structrp png_ptr) /* 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}; + static 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}; + static 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}; + static 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}; + static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif png_debug(1, "in png_write_finish_row"); @@ -2098,10 +2098,10 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) /* 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}; + static 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}; + static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_write_interlace"); @@ -2276,7 +2276,7 @@ png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row, #ifdef PNG_WRITE_FILTER_SUPPORTED static size_t /* PRIVATE */ -png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) { png_bytep rp, dp, lp; @@ -2315,7 +2315,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, } static void /* PRIVATE */ -png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_sub_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) { png_bytep rp, dp, lp; @@ -2380,7 +2380,7 @@ png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes) } static size_t /* PRIVATE */ -png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) { png_bytep rp, dp, pp, lp; @@ -2420,7 +2420,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, return (sum); } static void /* PRIVATE */ -png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) { png_bytep rp, dp, pp, lp; @@ -2442,7 +2442,7 @@ png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp, } static size_t /* PRIVATE */ -png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes, size_t lmins) { png_bytep rp, dp, pp, cp, lp; @@ -2503,7 +2503,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, return (sum); } static void /* PRIVATE */ -png_setup_paeth_row_only(png_structrp png_ptr, const png_uint_32 bpp, +png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp, size_t row_bytes) { png_bytep rp, dp, pp, cp, lp; diff --git a/sdk/include/reactos/libs/libpng/png.h b/sdk/include/reactos/libs/libpng/png.h index 19e464cc17e..8e272a05532 100644 --- a/sdk/include/reactos/libs/libpng/png.h +++ b/sdk/include/reactos/libs/libpng/png.h @@ -1,29 +1,65 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.35, July 15, 2018 + * libpng version 1.6.36 - December 1, 2018 * + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * - * This code is released under the libpng license (See LICENSE, below) + * 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.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.35, July 15, 2018: + * libpng versions 0.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson. + * libpng version 1.6.36, December 1, 2018: Cosmin Truta * See also "Contributing Authors", below. */ /* - * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE + * ========================================= + * + * PNG Reference Library License version 2 + * --------------------------------------- + * + * * Copyright (c) 1995-2018 The PNG Reference Library Authors. + * * Copyright (c) 2018 Cosmin Truta. + * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * * Copyright (c) 1996-1997 Andreas Dilger. + * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + * + * The software is supplied "as is", without warranty of any kind, + * express or implied, including, without limitation, the warranties + * of merchantability, fitness for a particular purpose, title, and + * non-infringement. In no even shall the Copyright owners, or + * anyone distributing the software, be liable for any damages or + * other liability, whether in contract, tort or otherwise, arising + * from, out of, or in connection with the software, or the use or + * other dealings in the software, even if advised of the possibility + * of such damage. + * + * Permission is hereby granted to use, copy, modify, and distribute + * this software, or portions hereof, for any purpose, without fee, + * subject to the following restrictions: * - * If you modify libpng you may insert additional notices immediately following - * this sentence. + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you + * use this software in a product, an acknowledgment in the product + * documentation would be appreciated, but is not required. * - * This code is released under the libpng license. + * 2. Altered source versions must be plainly marked as such, and must + * not be misrepresented as being the original software. + * + * 3. This Copyright notice may not be removed or altered from any + * source or altered source distribution. + * + * + * PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) + * ----------------------------------------------------------------------- * * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are @@ -31,38 +67,38 @@ * disclaimer and license as libpng-1.0.6 with the following individuals * added to the list of Contributing Authors: * - * Simon-Pierre Cadieux - * Eric S. Raymond - * Mans Rullgard - * Cosmin Truta - * Gilles Vollant - * James Yu - * Mandar Sahastrabuddhe - * Google Inc. - * Vadim Barkov + * Simon-Pierre Cadieux + * Eric S. Raymond + * Mans Rullgard + * Cosmin Truta + * Gilles Vollant + * James Yu + * Mandar Sahastrabuddhe + * Google Inc. + * Vadim Barkov * * and with the following additions to the disclaimer: * - * There is no warranty against interference with your enjoyment of the - * library or against infringement. There is no warranty that our - * efforts or the library will fulfill any of your particular purposes - * or needs. This library is provided with all faults, and the entire - * risk of satisfactory quality, performance, accuracy, and effort is with - * the user. + * There is no warranty against interference with your enjoyment of + * the library or against infringement. There is no warranty that our + * efforts or the library will fulfill any of your particular purposes + * or needs. This library is provided with all faults, and the entire + * risk of satisfactory quality, performance, accuracy, and effort is + * with the user. * * Some files in the "contrib" directory and some configure-generated - * files that are distributed with libpng have other copyright owners and + * files that are distributed with libpng have other copyright owners, and * are released under other open source licenses. * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from * libpng-0.96, and are distributed according to the same disclaimer and - * license as libpng-0.96, with the following individuals added to the list - * of Contributing Authors: + * license as libpng-0.96, with the following individuals added to the + * list of Contributing Authors: * - * Tom Lane - * Glenn Randers-Pehrson - * Willem van Schaik + * Tom Lane + * Glenn Randers-Pehrson + * Willem van Schaik * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, @@ -70,14 +106,14 @@ * libpng-0.88, with the following individuals added to the list of * Contributing Authors: * - * John Bowler - * Kevin Bracey - * Sam Bushell - * Magnus Holmgren - * Greg Roelofs - * Tom Tanner + * John Bowler + * Kevin Bracey + * Sam Bushell + * Magnus Holmgren + * Greg Roelofs + * Tom Tanner * - * Some files in the "scripts" directory have other copyright owners + * Some files in the "scripts" directory have other copyright owners, * but are released under this license. * * libpng versions 0.5, May 1995, through 0.88, January 1996, are @@ -86,62 +122,49 @@ * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals: * - * Andreas Dilger - * Dave Martindale - * Guy Eric Schalnat - * Paul Schmidt - * Tim Wegner - * - * The PNG Reference Library is supplied "AS IS". The Contributing Authors - * and Group 42, Inc. disclaim all warranties, expressed or implied, - * including, without limitation, the warranties of merchantability and of - * fitness for any purpose. The Contributing Authors and Group 42, Inc. - * assume no liability for direct, indirect, incidental, special, exemplary, - * or consequential damages, which may result from the use of the PNG - * Reference Library, even if advised of the possibility of such damage. + * Andreas Dilger + * Dave Martindale + * Guy Eric Schalnat + * Paul Schmidt + * Tim Wegner + * + * The PNG Reference Library is supplied "AS IS". The Contributing + * Authors and Group 42, Inc. disclaim all warranties, expressed or + * implied, including, without limitation, the warranties of + * merchantability and of fitness for any purpose. The Contributing + * Authors and Group 42, Inc. assume no liability for direct, indirect, + * incidental, special, exemplary, or consequential damages, which may + * result from the use of the PNG Reference Library, even if advised of + * the possibility of such damage. * * Permission is hereby granted to use, copy, modify, and distribute this * source code, or portions hereof, for any purpose, without fee, subject * to the following restrictions: * - * 1. The origin of this source code must not be misrepresented. + * 1. The origin of this source code must not be misrepresented. * - * 2. Altered versions must be plainly marked as such and must not - * be misrepresented as being the original source. + * 2. Altered versions must be plainly marked as such and must not + * be misrepresented as being the original source. * - * 3. This Copyright notice may not be removed or altered from any - * source or altered source distribution. + * 3. This Copyright notice may not be removed or altered from any + * source or altered source distribution. * - * The Contributing Authors and Group 42, Inc. specifically permit, without - * fee, and encourage the use of this source code as a component to - * supporting the PNG file format in commercial products. If you use this - * source code in a product, acknowledgment is not required but would be - * appreciated. + * The Contributing Authors and Group 42, Inc. specifically permit, + * without fee, and encourage the use of this source code as a component + * to supporting the PNG file format in commercial products. If you use + * this source code in a product, acknowledgment is not required but would + * be appreciated. * * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. * - * TRADEMARK: + * TRADEMARK + * ========= * - * The name "libpng" has not been registered by the Copyright owner + * The name "libpng" has not been registered by the Copyright owners * as a trademark in any jurisdiction. However, because libpng has * been distributed and maintained world-wide, continually since 1995, - * the Copyright owner claims "common-law trademark protection" in any + * the Copyright owners claim "common-law trademark protection" in any * jurisdiction where common-law trademark is recognized. - * - * OSI CERTIFICATION: - * - * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is - * a certification mark of the Open Source Initiative. OSI has not addressed - * the additional disclaimers inserted at version 1.0.7. - * - * EXPORT CONTROL: - * - * The Copyright owner believes that the Export Control Classification - * Number (ECCN) for libpng is EAR99, which means not subject to export - * controls or International Traffic in Arms Regulations (ITAR) because - * it is open source, publicly available software, that does not contain - * any encryption software. See the EAR, paragraphs 734.3(b)(3) and - * 734.7(b). */ /* @@ -207,23 +230,25 @@ * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7 1 10007 (still compatible) * ... - * 1.0.19 10 10019 10.so.0.19[.0] + * 1.0.69 10 10069 10.so.0.69[.0] * ... - * 1.2.59 13 10257 12.so.0.59[.0] + * 1.2.59 13 10259 12.so.0.59[.0] * ... - * 1.5.30 15 10527 15.so.15.30[.0] + * 1.4.20 14 10420 14.so.0.20[.0] * ... - * 1.6.35 16 10635 16.so.16.35[.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 - * version 1.0.6j; from then on they were given the upcoming public - * release number plus "betaNN" or "rcNN". + * 1.5.30 15 10530 15.so.15.30[.0] + * ... + * 1.6.36 16 10636 16.so.16.36[.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 version 1.0.6j; from then on they were given the upcoming + * public release number plus "betaNN" or "rcNN". * * Binary incompatibility exists only when applications make direct access * to the info_ptr or png_ptr members through png.h, and the compiled @@ -233,65 +258,8 @@ * in binary compatibility (e.g., when a new feature is added). * * See libpng.txt or libpng.3 for more information. The PNG specification - * is available as a W3C Recommendation and as an ISO Specification, - * */ #ifndef PNG_H @@ -309,8 +277,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.35" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.35 - July 15, 2018\n" +#define PNG_LIBPNG_VER_STRING "1.6.36" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.36 - December 1, 2018\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -318,13 +286,13 @@ /* 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 35 +#define PNG_LIBPNG_VER_RELEASE 36 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ -#define PNG_LIBPNG_VER_BUILD 02 +#define PNG_LIBPNG_VER_BUILD 0 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 @@ -341,15 +309,16 @@ #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with PNG_LIBPNG_BUILD_PRIVATE */ -#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA +#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 +/* 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 is: + * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10635 /* 1.6.35 */ +#define PNG_LIBPNG_VER 10636 /* 1.6.36 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -459,7 +428,7 @@ extern "C" { /* 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_35; +typedef char* png_libpng_version_1_6_36; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -2013,12 +1982,12 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *exif)); PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_bytep exif)); + png_inforp info_ptr, png_bytep exif)); PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif)); PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr, - png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif)); + png_inforp info_ptr, png_uint_32 num_exif, png_bytep exif)); #endif #ifdef PNG_gAMA_SUPPORTED @@ -2764,7 +2733,7 @@ typedef struct * * When the simplified API needs to convert between sRGB and linear colorspaces, * the actual sRGB transfer curve defined in the sRGB specification (see the - * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 + * article at ) is used, not the gamma=1/2.2 * approximation used elsewhere in libpng. * * When an alpha channel is present it is expected to denote pixel coverage @@ -2967,7 +2936,7 @@ typedef struct * 'flags' field of png_image. */ #define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01 - /* This indicates the the RGB values of the in-memory bitmap do not + /* This indicates that the RGB values of the in-memory bitmap do not * correspond to the red, green and blue end-points defined by sRGB. */ diff --git a/sdk/include/reactos/libs/libpng/pngconf.h b/sdk/include/reactos/libs/libpng/pngconf.h index a4646bab858..5e641b25098 100644 --- a/sdk/include/reactos/libs/libpng/pngconf.h +++ b/sdk/include/reactos/libs/libpng/pngconf.h @@ -1,11 +1,12 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.35, July 15, 2018 + * libpng version 1.6.36 * + * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 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.) + * Copyright (c) 1996-1997 Andreas Dilger + * 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 @@ -57,14 +58,13 @@ #endif /* PNG_BUILDING_SYMBOL_TABLE */ -/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using - * PNG_NO_CONST; this is no longer supported except for data declarations which - * apparently still cause problems in 2011 on some compilers. +/* Prior to 1.6.0, it was possible to turn off 'const' in declarations, + * using PNG_NO_CONST. This is no longer supported. */ #define PNG_CONST const /* backward compatibility only */ -/* This controls optimization of the reading of 16-bit and 32-bit values - * from PNG files. It can be set on a per-app-file basis - it +/* This controls optimization of the reading of 16-bit and 32-bit + * values from PNG files. It can be set on a per-app-file basis: it * just changes whether a macro is used when the function is called. * The library builder sets the default; if read functions are not * built into the library the macro implementation is forced on. diff --git a/sdk/include/reactos/libs/libpng/pnglibconf.h b/sdk/include/reactos/libs/libpng/pnglibconf.h index 00acecc69b7..00340c678be 100644 --- a/sdk/include/reactos/libs/libpng/pnglibconf.h +++ b/sdk/include/reactos/libs/libpng/pnglibconf.h @@ -1,10 +1,9 @@ -/* libpng 1.6.35 STANDARD API DEFINITION */ - /* pnglibconf.h - library build configuration */ -/* Libpng version 1.6.35 - July 15, 2018 */ +/* libpng version 1.6.36 */ -/* Copyright (c) 1998-2018 Glenn Randers-Pehrson */ +/* Copyright (c) 2018 Cosmin Truta */ +/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ /* For conditions of distribution and use, see the disclaimer */ @@ -20,8 +19,6 @@ #define PNG_ALIGNED_MEMORY_SUPPORTED /*#undef PNG_ARM_NEON_API_SUPPORTED*/ /*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/ -/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/ -/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/ #define PNG_BENIGN_ERRORS_SUPPORTED #define PNG_BENIGN_READ_ERRORS_SUPPORTED /*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/ @@ -46,6 +43,8 @@ #define PNG_IO_STATE_SUPPORTED #define PNG_MNG_FEATURES_SUPPORTED #define PNG_POINTER_INDEXING_SUPPORTED +/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/ +/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/ #define PNG_PROGRESSIVE_READ_SUPPORTED #define PNG_READ_16BIT_SUPPORTED #define PNG_READ_ALPHA_MODE_SUPPORTED -- 2.17.1