added libpng with simd support
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.2.46 - July 9, 2011
|
Libpng 1.5.10 - March 29, 2012
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
@ -8,58 +8,57 @@ Files available for download:
|
|||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
libpng-1.2.46.tar.xz (LZMA-compressed, recommended)
|
libpng-1.5.10.tar.xz (LZMA-compressed, recommended)
|
||||||
libpng-1.2.46.tar.gz
|
libpng-1.5.10.tar.gz
|
||||||
libpng-1.2.46.tar.bz2
|
libpng-1.5.10.tar.bz2
|
||||||
|
|
||||||
Source files with LF line endings (for Unix/Linux) without the
|
|
||||||
"configure" script
|
|
||||||
|
|
||||||
libpng-1.2.46-no-config.tar.xz (LZMA-compressed, recommended)
|
|
||||||
libpng-1.2.46-no-config.tar.gz
|
|
||||||
libpng-1.2.46-no-config.tar.bz2
|
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
lpng1246.zip
|
lpng1510.7z (LZMA-compressed, recommended)
|
||||||
lpng1246.7z
|
lpng1510.zip
|
||||||
lpng1246.tar.bz2
|
|
||||||
|
|
||||||
Project files
|
|
||||||
|
|
||||||
libpng-1.2.46-project-netware.zip
|
|
||||||
libpng-1.2.46-project-wince.zip
|
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.2.46-README.txt
|
libpng-1.5.10-README.txt
|
||||||
libpng-1.2.46-KNOWNBUGS.txt
|
libpng-1.5.10-LICENSE.txt
|
||||||
libpng-1.2.46-LICENSE.txt
|
|
||||||
libpng-1.2.46-Y2K-compliance.txt
|
|
||||||
libpng-1.2.46-[previous version]-diff.txt
|
|
||||||
|
|
||||||
Changes since the last public release (1.2.43):
|
Changes since the last public release (1.5.9):
|
||||||
|
|
||||||
version 1.2.45 [July 9, 2011]
|
Removed two useless #ifdef directives from pngread.c and one from pngrutil.c
|
||||||
|
Always put the CMAKE_LIBRARY in "lib" (removed special WIN32 case).
|
||||||
Fixed uninitialized memory read in png_format_buffer() (Bug
|
Removed empty vstudio/pngstest directory (Clifford Yapp).
|
||||||
report by Frank Busse, related to CVE-2004-0421).
|
Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
|
||||||
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
|
pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
|
||||||
was introduced in libpng-1.2.20beta01.
|
now that png_ptr->buffer is inaccessible to applications, the special
|
||||||
Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
|
handling is no longer useful.
|
||||||
before IDAT.
|
Fixed bug with png_handle_hIST with odd chunk length (Frank Busse).
|
||||||
Ported bugfix in pngrtran.c from 1.5.3: when expanding a paletted image,
|
Added PNG_SAFE_LIMITS feature to pnglibconf.dfa and code in pngconf.h
|
||||||
always expand to RGBA if transparency is present.
|
to reset the user limits to safe ones if PNG_SAFE_LIMITS is defined.
|
||||||
Check for integer overflow in png_set_rgb_to_gray().
|
To enable, use "CPPFLAGS=-DPNG_SAFE_LIMITS_SUPPORTED" on the configure
|
||||||
Check for sCAL chunk too short.
|
command or put "#define PNG_SAFE_LIMITS_SUPPORTED" in pnglibconf.h.
|
||||||
Added CMakeLists.txt, projects/xcode, and pnggccrd.c to EXTRA_DIST in
|
Revised the SAFE_LIMITS feature to be the same as the feature in libpng16.
|
||||||
Makefile.am and Makefile.in
|
Added information about the new limits in the manual.
|
||||||
Udated copyright year to 2011.
|
Updated Makefile.in
|
||||||
|
Removed unused "current_text" members of png_struct and the png_free()
|
||||||
|
of png_ptr->current_text from pngread.c
|
||||||
|
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
|
||||||
|
Fixed CMF optimization of non-IDAT compressed chunks, which was added at
|
||||||
|
libpng-1.5.4. It sometimes produced too small of a window.
|
||||||
|
Reject all iCCP chunks after the first, even if the first one is invalid.
|
||||||
|
Added palette-index checking. Issue a png_benign_error() if an invalid
|
||||||
|
index is found.
|
||||||
|
Revised example.c to put text strings in a temporary character array
|
||||||
|
instead of directly assigning string constants to png_textp members.
|
||||||
|
This avoids compiler warnings when -Wwrite-strings is enabled.
|
||||||
|
Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
|
||||||
|
Revised png_set_text_2() to avoid potential memory corruption (fixes
|
||||||
|
CVE-2011-3048).
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe) or to glennrp at users.sourceforge.net
|
to subscribe)
|
||||||
|
or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
Glenn R-P
|
Glenn R-P
|
||||||
|
@ -6,7 +6,6 @@ LOCAL_PATH:= $(call my-dir)
|
|||||||
common_SRC_FILES := \
|
common_SRC_FILES := \
|
||||||
png.c \
|
png.c \
|
||||||
pngerror.c \
|
pngerror.c \
|
||||||
pnggccrd.c \
|
|
||||||
pngget.c \
|
pngget.c \
|
||||||
pngmem.c \
|
pngmem.c \
|
||||||
pngpread.c \
|
pngpread.c \
|
||||||
@ -16,12 +15,13 @@ common_SRC_FILES := \
|
|||||||
pngrutil.c \
|
pngrutil.c \
|
||||||
pngset.c \
|
pngset.c \
|
||||||
pngtrans.c \
|
pngtrans.c \
|
||||||
pngvcrd.c \
|
|
||||||
pngwio.c \
|
pngwio.c \
|
||||||
pngwrite.c \
|
pngwrite.c \
|
||||||
pngwtran.c \
|
pngwtran.c \
|
||||||
pngwutil.c
|
pngwutil.c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
common_CFLAGS := -fvisibility=hidden ## -fomit-frame-pointer
|
common_CFLAGS := -fvisibility=hidden ## -fomit-frame-pointer
|
||||||
|
|
||||||
ifeq ($(HOST_OS),windows)
|
ifeq ($(HOST_OS),windows)
|
||||||
@ -35,6 +35,11 @@ endif
|
|||||||
|
|
||||||
common_C_INCLUDES +=
|
common_C_INCLUDES +=
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||||
|
LOCAL_CFLAGS += $(common_CFLAGS) -DPNG_ARM_NEON
|
||||||
|
common_SRC_FILES += arm/filter_neon.S
|
||||||
|
endif
|
||||||
|
|
||||||
#common_COPY_HEADERS_TO := libpng
|
#common_COPY_HEADERS_TO := libpng
|
||||||
#common_COPY_HEADERS := png.h pngconf.h pngusr.h
|
#common_COPY_HEADERS := png.h pngconf.h pngusr.h
|
||||||
|
|
||||||
@ -68,10 +73,10 @@ LOCAL_SHARED_LIBRARIES := \
|
|||||||
libz
|
libz
|
||||||
|
|
||||||
LOCAL_MODULE:= libpng
|
LOCAL_MODULE:= libpng
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
#LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
|
#LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
|
||||||
#LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
|
#LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
|
||||||
|
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
|
||||||
|
|
||||||
|
|
||||||
|
3346
jni/libpng/CHANGES
@ -1,7 +1,17 @@
|
|||||||
cmake_minimum_required(VERSION 2.4.3)
|
# CMakeLists.txt
|
||||||
|
|
||||||
|
# Copyright (C) 2007-2011 Glenn Randers-Pehrson
|
||||||
|
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.4.4)
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||||
|
|
||||||
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
|
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
|
||||||
|
# workaround CMake 2.4.x bug
|
||||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||||
"Choose the type of build, options are:
|
"Choose the type of build, options are:
|
||||||
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
||||||
@ -9,20 +19,23 @@ if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
|
|||||||
Release
|
Release
|
||||||
RelWithDebInfo
|
RelWithDebInfo
|
||||||
MinSizeRel.")
|
MinSizeRel.")
|
||||||
|
else()
|
||||||
|
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||||
|
"Choose the type of build, options are:
|
||||||
|
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
|
||||||
|
Debug
|
||||||
|
Release
|
||||||
|
RelWithDebInfo
|
||||||
|
MinSizeRel.")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(libpng C)
|
project(libpng C)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
# Copyright (C) 2007-2010 Glenn Randers-Pehrson
|
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
|
||||||
# For conditions of distribution and use, see the disclaimer
|
|
||||||
# and license in png.h
|
|
||||||
|
|
||||||
set(PNGLIB_MAJOR 1)
|
set(PNGLIB_MAJOR 1)
|
||||||
set(PNGLIB_MINOR 2)
|
set(PNGLIB_MINOR 5)
|
||||||
set(PNGLIB_RELEASE 46)
|
set(PNGLIB_RELEASE 10)
|
||||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||||
|
|
||||||
@ -56,39 +69,11 @@ else()
|
|||||||
option(PNG_STATIC "Build static lib" ON)
|
option(PNG_STATIC "Build static lib" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MINGW)
|
option(PNG_TESTS "Build libpng tests" YES)
|
||||||
option(PNG_TESTS "Build pngtest" NO)
|
|
||||||
else()
|
|
||||||
option(PNG_TESTS "Build pngtest" YES)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(PNG_NO_CONSOLE_IO "FIXME" YES)
|
# Many more configuration options could be added here
|
||||||
option(PNG_NO_STDIO "FIXME" YES)
|
|
||||||
option(PNG_DEBUG "Build with debug output" NO)
|
option(PNG_DEBUG "Build with debug output" NO)
|
||||||
option(PNGARG "FIXME" YES)
|
option(PNGARG "Disable ANSI-C prototypes" NO)
|
||||||
#TODO:
|
|
||||||
# PNG_CONSOLE_IO_SUPPORTED
|
|
||||||
|
|
||||||
# maybe needs improving, but currently I don't know when we can enable what :)
|
|
||||||
set(png_asm_tmp "OFF")
|
|
||||||
if(NOT WIN32)
|
|
||||||
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
|
|
||||||
if(uname_executable)
|
|
||||||
exec_program(${uname_executable}
|
|
||||||
ARGS --machine OUTPUT_VARIABLE uname_output)
|
|
||||||
if("uname_output" MATCHES "^.*i[1-9]86.*$")
|
|
||||||
set(png_asm_tmp "ON")
|
|
||||||
else("uname_output" MATCHES "^.*i[1-9]86.*$")
|
|
||||||
set(png_asm_tmp "OFF")
|
|
||||||
endif("uname_output" MATCHES "^.*i[1-9]86.*$")
|
|
||||||
endif(uname_executable)
|
|
||||||
else()
|
|
||||||
# this env var is normally only set on win64
|
|
||||||
set(TEXT "ProgramFiles(x86)")
|
|
||||||
if("$ENV{${TEXT}}" STREQUAL "")
|
|
||||||
set(png_asm_tmp "ON")
|
|
||||||
endif("$ENV{${TEXT}}" STREQUAL "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# SET LIBNAME
|
# SET LIBNAME
|
||||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
@ -96,11 +81,26 @@ set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
|||||||
# to distinguish between debug and release lib
|
# to distinguish between debug and release lib
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
|
|
||||||
|
# Use the prebuilt pnglibconf.h file from the scripts folder
|
||||||
|
# TODO: fix this by building with awk; without this no cmake build can be
|
||||||
|
# configured directly (to do so indirectly use your local awk to build a
|
||||||
|
# pnglibconf.h in the build directory.)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
# OUR SOURCES
|
# OUR SOURCES
|
||||||
set(libpng_sources
|
set(libpng_public_hdrs
|
||||||
png.h
|
png.h
|
||||||
pngconf.h
|
pngconf.h
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
|
||||||
|
)
|
||||||
|
set(libpng_sources
|
||||||
|
${libpng_public_hdrs}
|
||||||
|
pngdebug.h
|
||||||
|
pnginfo.h
|
||||||
|
pngpriv.h
|
||||||
|
pngstruct.h
|
||||||
png.c
|
png.c
|
||||||
pngerror.c
|
pngerror.c
|
||||||
pngget.c
|
pngget.c
|
||||||
@ -120,47 +120,21 @@ set(libpng_sources
|
|||||||
set(pngtest_sources
|
set(pngtest_sources
|
||||||
pngtest.c
|
pngtest.c
|
||||||
)
|
)
|
||||||
|
set(pngvalid_sources
|
||||||
|
contrib/libtests/pngvalid.c
|
||||||
|
)
|
||||||
# SOME NEEDED DEFINITIONS
|
# SOME NEEDED DEFINITIONS
|
||||||
|
|
||||||
add_definitions(-DPNG_CONFIGURE_LIBPNG)
|
add_definitions(-DPNG_CONFIGURE_LIBPNG)
|
||||||
|
|
||||||
if(_AIX)
|
|
||||||
add_definitions(-D_ALL_SOURCE)
|
|
||||||
endif(_AIX)
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
if(PNG_SHARED OR NOT MSVC)
|
|
||||||
#if building msvc static this has NOT to be defined
|
|
||||||
add_definitions(-DZLIB_DLL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_definitions(-DLIBPNG_NO_MMX)
|
|
||||||
add_definitions(-DPNG_NO_MMX_CODE)
|
|
||||||
|
|
||||||
|
|
||||||
if(PNG_CONSOLE_IO_SUPPORTED)
|
|
||||||
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_NO_CONSOLE_IO)
|
|
||||||
add_definitions(-DPNG_NO_CONSOLE_IO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_NO_STDIO)
|
|
||||||
add_definitions(-DPNG_NO_STDIO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PNG_DEBUG)
|
if(PNG_DEBUG)
|
||||||
add_definitions(-DPNG_DEBUG)
|
add_definitions(-DPNG_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT M_LIBRARY AND NOT WIN32)
|
|
||||||
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# NOW BUILD OUR TARGET
|
# NOW BUILD OUR TARGET
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
@ -169,6 +143,7 @@ if(PNG_SHARED)
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
|
||||||
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
@ -181,9 +156,9 @@ if(PNG_STATIC)
|
|||||||
# msvc does not append 'lib' - do it here to have consistent name
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
|
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(PNG_SHARED AND WIN32)
|
if(PNG_SHARED AND WIN32)
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
||||||
endif()
|
endif()
|
||||||
@ -192,89 +167,174 @@ if(PNG_TESTS AND PNG_SHARED)
|
|||||||
# does not work with msvc due to png_lib_ver issue
|
# does not work with msvc due to png_lib_ver issue
|
||||||
add_executable(pngtest ${pngtest_sources})
|
add_executable(pngtest ${pngtest_sources})
|
||||||
target_link_libraries(pngtest ${PNG_LIB_NAME})
|
target_link_libraries(pngtest ${PNG_LIB_NAME})
|
||||||
add_test(pngtest pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
|
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
|
||||||
|
#
|
||||||
|
add_executable(pngvalid ${pngvalid_sources})
|
||||||
|
target_link_libraries(pngvalid ${PNG_LIB_NAME})
|
||||||
|
add_test(pngvalid ./pngvalid)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
||||||
|
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||||
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
|
||||||
|
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||||
|
|
||||||
|
# Set a variable with CMake code which:
|
||||||
|
# Creates a symlink from src to dest (if possible) or alternatively
|
||||||
|
# copies if different.
|
||||||
|
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
||||||
|
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||||
|
if(WIN32 AND NOT CYGWIN AND NOT MINGW)
|
||||||
|
ADD_CUSTOM_COMMAND(
|
||||||
|
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||||
|
DEPENDS ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC}
|
||||||
|
)
|
||||||
|
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||||
|
else(WIN32 AND NOT CYGWIN AND NOT MINGW)
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
endif(WIN32 AND NOT CYGWIN AND NOT MINGW)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# libpng is a library so default to 'lib'
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
set(CMAKE_INSTALL_LIBDIR lib)
|
||||||
|
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
|
|
||||||
# CREATE PKGCONFIG FILES
|
# CREATE PKGCONFIG FILES
|
||||||
# we use the same files like ./configure, so we have to set its vars
|
# we use the same files like ./configure, so we have to set its vars
|
||||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
||||||
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
# a UNIX look alike
|
||||||
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||||
|
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
||||||
|
set(LIBS "-lz -lm")
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
||||||
|
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng.pc.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
|
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng-config.in
|
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng.pc.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc)
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng-config.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config)
|
|
||||||
|
|
||||||
# SET UP LINKS
|
# SET UP LINKS
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||||
# VERSION 0.${PNGLIB_RELEASE}.1.2.46
|
# VERSION 15.${PNGLIB_RELEASE}.1.5.10
|
||||||
VERSION 0.${PNGLIB_RELEASE}.0
|
VERSION 15.${PNGLIB_RELEASE}.0
|
||||||
SOVERSION 0
|
SOVERSION 15
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
endif()
|
endif()
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
if(NOT WIN32)
|
# MSVC doesn't use a different file extension for shared vs. static
|
||||||
# that's uncool on win32 - it overwrites our static import lib...
|
# libs. We are able to change OUTPUT_NAME to remove the _static
|
||||||
|
# for all other platforms.
|
||||||
|
if(NOT MSVC)
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
||||||
OUTPUT_NAME ${PNG_LIB_NAME}
|
OUTPUT_NAME ${PNG_LIB_NAME}
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# If CMake > 2.4.x, we set a variable used below to export
|
||||||
|
# targets to an export file.
|
||||||
|
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
|
||||||
|
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
|
||||||
|
set(PNG_EXPORT_RULE EXPORT libpng)
|
||||||
|
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
|
||||||
|
set(PNG_EXPORT_RULE EXPORT libpng)
|
||||||
|
endif()
|
||||||
|
|
||||||
# INSTALL
|
# INSTALL
|
||||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
install(TARGETS ${PNG_LIB_NAME}
|
install(TARGETS ${PNG_LIB_NAME}
|
||||||
|
${PNG_EXPORT_RULE}
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION lib)
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
|
||||||
|
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
|
||||||
|
if(CYGWIN OR MINGW)
|
||||||
|
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
|
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||||
|
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif(CYGWIN OR MINGW)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
|
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||||
|
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif(NOT WIN32)
|
||||||
|
endif(PNG_SHARED)
|
||||||
|
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
install(TARGETS ${PNG_LIB_NAME_STATIC}
|
install(TARGETS ${PNG_LIB_NAME_STATIC}
|
||||||
LIBRARY DESTINATION lib
|
${PNG_EXPORT_RULE}
|
||||||
ARCHIVE DESTINATION lib)
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
|
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
|
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
|
||||||
|
CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
||||||
install(FILES png.h pngconf.h DESTINATION include)
|
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
||||||
install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
|
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
||||||
endif()
|
endif()
|
||||||
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
||||||
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||||
DESTINATION bin)
|
DESTINATION bin)
|
||||||
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||||
# Install man pages
|
# Install man pages
|
||||||
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
|
if(NOT PNG_MAN_DIR)
|
||||||
install(FILES png.5 DESTINATION man/man5)
|
set(PNG_MAN_DIR "share/man")
|
||||||
|
endif()
|
||||||
|
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
||||||
|
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
||||||
# Install pkg-config files
|
# Install pkg-config files
|
||||||
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
||||||
DESTINATION lib/pkgconfig)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
||||||
DESTINATION bin)
|
DESTINATION bin)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
|
||||||
DESTINATION lib/pkgconfig)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||||
DESTINATION bin)
|
DESTINATION bin)
|
||||||
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# what's with libpng.txt and all the extra files?
|
# On versions of CMake that support it, create an export file CMake
|
||||||
|
# users can include() to import our targets
|
||||||
|
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
|
||||||
|
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# what's with libpng-$VER%.txt and all the extra files?
|
||||||
|
|
||||||
# UNINSTALL
|
# UNINSTALL
|
||||||
# do we need this?
|
# do we need this?
|
||||||
|
|
||||||
|
|
||||||
# DIST
|
# DIST
|
||||||
# do we need this?
|
# do we need this?
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.2.46 - July 9, 2011
|
Installing libpng
|
||||||
|
|
||||||
On Unix/Linux and similar systems, you can simply type
|
On Unix/Linux and similar systems, you can simply type
|
||||||
|
|
||||||
@ -13,10 +13,16 @@ If configure does not work on your system and you have a reasonably
|
|||||||
up-to-date set of tools, running ./autogen.sh before running ./configure
|
up-to-date set of tools, running ./autogen.sh before running ./configure
|
||||||
may fix the problem. You can also run the individual commands in
|
may fix the problem. You can also run the individual commands in
|
||||||
autogen.sh with the --force option, if supported by your version of
|
autogen.sh with the --force option, if supported by your version of
|
||||||
the tools. If you run 'libtoolize --force', though, this will replace
|
the tools. To be really sure that you aren't using any of the included
|
||||||
the distributed, patched, version of ltmain.sh with an unpatched version
|
pre-built scripts, you can do this:
|
||||||
and your shared library builds may fail to produce libraries with the
|
|
||||||
correct version numbers.
|
./configure --enable-maintainer-mode
|
||||||
|
make maintainer-clean
|
||||||
|
./autogen.sh
|
||||||
|
./configure [--prefix=/path] [other options]
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
make check
|
||||||
|
|
||||||
Instead, you can use one of the custom-built makefiles in the
|
Instead, you can use one of the custom-built makefiles in the
|
||||||
"scripts" directory
|
"scripts" directory
|
||||||
@ -46,8 +52,8 @@ to have access to the zlib.h and zconf.h include files that
|
|||||||
correspond to the version of zlib that's installed.
|
correspond to the version of zlib that's installed.
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-1.2.46" or "libpng12" and "zlib-1.2.3"
|
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
|
||||||
or "zlib123") so that you have directories called "zlib" and "libpng".
|
or "zlib125") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
@ -60,8 +66,8 @@ Your directory structure should look like this:
|
|||||||
CMakeLists.txt => "cmake" script
|
CMakeLists.txt => "cmake" script
|
||||||
configuration files:
|
configuration files:
|
||||||
configure.ac, configure, Makefile.am, Makefile.in,
|
configure.ac, configure, Makefile.am, Makefile.in,
|
||||||
autogen.sh, config.guess, ltmain.sh, missing,
|
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
||||||
aclocal.m4, config.h.in, config.sub,
|
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
||||||
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
||||||
contrib
|
contrib
|
||||||
gregbook
|
gregbook
|
||||||
@ -70,13 +76,12 @@ Your directory structure should look like this:
|
|||||||
pngsuite
|
pngsuite
|
||||||
visupng
|
visupng
|
||||||
projects
|
projects
|
||||||
cbuilder5 (Borland)
|
|
||||||
visualc6 (msvc)
|
|
||||||
visualc71
|
visualc71
|
||||||
xcode
|
vstudio
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
*.def (module definition files)
|
*.def (module definition files)
|
||||||
|
etc.
|
||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
zlib
|
||||||
@ -107,7 +112,7 @@ scripts directory into this directory, for example
|
|||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
target directories to match your preferences.
|
target directories to match your preferences.
|
||||||
|
|
||||||
Then read pngconf.h to see if you want to make any configuration
|
Then read pnglibconf.dfa to see if you want to make any configuration
|
||||||
changes.
|
changes.
|
||||||
|
|
||||||
Then just run "make" which will create the libpng library in
|
Then just run "make" which will create the libpng library in
|
||||||
@ -125,39 +130,26 @@ do that, run "make install" in the zlib directory first if necessary).
|
|||||||
Some also allow you to run "make test-installed" after you have
|
Some also allow you to run "make test-installed" after you have
|
||||||
run "make install".
|
run "make install".
|
||||||
|
|
||||||
If you encounter a compiler error message complaining about the
|
Further information can be found in the README and libpng-manual.txt
|
||||||
lines
|
|
||||||
|
|
||||||
__png.h__ already includes setjmp.h;
|
|
||||||
__dont__ include it again.;
|
|
||||||
|
|
||||||
this means you have compiled another module that includes setjmp.h,
|
|
||||||
which is hazardous because the two modules might not include exactly
|
|
||||||
the same setjmp.h. If you are sure that you know what you are doing
|
|
||||||
and that they are exactly the same, then you can comment out or
|
|
||||||
delete the two lines. Better yet, use the cexcept interface
|
|
||||||
instead, as demonstrated in contrib/visupng of the libpng distribution.
|
|
||||||
|
|
||||||
Further information can be found in the README and libpng.txt
|
|
||||||
files, in the individual makefiles, in png.h, and the manual pages
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
libpng.3 and png.5.
|
libpng.3 and png.5.
|
||||||
|
|
||||||
|
|
||||||
Using the ./configure script -- 16 December 2002.
|
Using the ./configure script -- 16 December 2002.
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
|
||||||
The ./configure script should work compatibly with what scripts/makefile.*
|
The ./configure script should work compatibly with what scripts/makefile.*
|
||||||
did, however there are some options you need to add to configure explicitly,
|
did, however there are some options you might need to add to configure
|
||||||
which previously was done semi-automatically (if you didn't edit
|
explicitly, which previously was done semi-automatically (if you didn't edit
|
||||||
scripts/makefile.* yourself, that is)
|
scripts/makefile.* yourself, that is)
|
||||||
|
|
||||||
|
|
||||||
CFLAGS="-Wall -O -funroll-loops \
|
CFLAGS="-Wall -O -funroll-loops \
|
||||||
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
||||||
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||||
|
|
||||||
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
||||||
/usr/include/png12, or whatever.
|
/usr/include/libpng%NN%, or whatever.
|
||||||
|
|
||||||
|
If you find that the configure script is out-of-date or is not supporting
|
||||||
|
your platform properly, try running autogen.sh to regenerate "configure",
|
||||||
|
"Makefile.in", and the other configuration files. Then try configure again.
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.2.46, July 9, 2011, are
|
libpng versions 1.2.6, August 15, 2004, through 1.5.10, March 29, 2012, are
|
||||||
Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
|
|
||||||
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
July 9, 2011
|
March 29, 2012
|
||||||
|
@ -1,141 +1,218 @@
|
|||||||
# Makefile.am:
|
# Makefile.am:
|
||||||
# Source file for Makefile.in (and hence Makefile)
|
# Source file for Makefile.in (and hence Makefile)
|
||||||
#
|
#
|
||||||
# Makefile.am need only be changed on a major version number
|
|
||||||
# change (e.g. libpng12 --> libpng14). In that case seach
|
|
||||||
# this file for every instance of the old base name (libpng12)
|
|
||||||
# and change to the new one (libpng14), then change the
|
|
||||||
# -version-number settings below so that the new values have
|
|
||||||
# the correct major part (first field).
|
|
||||||
|
|
||||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
|
||||||
# libpng does not follow GNU file name conventions
|
# libpng does not follow GNU file name conventions
|
||||||
|
|
||||||
|
# "color-tests" requires automake 1.11.1 or later. Enable it if you like,
|
||||||
|
# to get red "FAIL" and green "PASS" notations during tests.
|
||||||
|
# AUTOMAKE_OPTIONS = foreign color-tests
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
# test programs - run on make check, make distcheck
|
# test programs - run on make check, make distcheck
|
||||||
|
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
||||||
check_PROGRAMS= pngtest
|
check_PROGRAMS= pngtest
|
||||||
pngtest_SOURCES = pngtest.c
|
pngtest_SOURCES = pngtest.c
|
||||||
pngtest_LDADD = libpng12.la
|
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
TESTS = test-pngtest.sh
|
TESTS = test-pngtest.sh
|
||||||
TESTS_ENVIRONMENT= srcdir=$(srcdir)
|
|
||||||
|
# Only do the following if the contrib directory is present.
|
||||||
|
check_PROGRAMS+= pngvalid
|
||||||
|
pngvalid_SOURCES = contrib/libtests/pngvalid.c
|
||||||
|
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
TESTS += test-pngvalid-simple.sh test-pngvalid-full.sh
|
||||||
|
|
||||||
# man pages
|
# man pages
|
||||||
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
||||||
|
|
||||||
# generate the -config scripts if required
|
# generate the -config scripts if required
|
||||||
binconfigs= libpng12-config
|
binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
|
||||||
EXTRA_SCRIPTS= libpng-config libpng12-config
|
EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
|
||||||
bin_SCRIPTS= @binconfigs@
|
bin_SCRIPTS= @binconfigs@
|
||||||
|
|
||||||
# rules to build libpng, only build the old library on request
|
# rules to build libpng, only build the old library on request
|
||||||
lib_LTLIBRARIES=libpng12.la @compatlib@
|
lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
EXTRA_LTLIBRARIES= libpng.la
|
# EXTRA_LTLIBRARIES= libpng.la
|
||||||
libpng12_la_SOURCES = png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
||||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
|
||||||
pngwtran.c pngmem.c pngerror.c pngpread.c \
|
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
|
||||||
png.h pngconf.h
|
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
|
||||||
libpng_la_SOURCES = $(libpng12_la_SOURCES)
|
|
||||||
|
|
||||||
libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
|
if PNG_ARM_NEON
|
||||||
libpng12_la_CPPFLAGS = @LIBPNG_DEFINES@
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/filter_neon.S
|
||||||
|
endif
|
||||||
|
|
||||||
# MAJOR UPGRADE: the version-number settings below must be changed.
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||||
libpng12_la_LDFLAGS = -no-undefined -export-dynamic \
|
|
||||||
-version-number 0:@PNGLIB_RELEASE@:0
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
|
||||||
# -rpath is needed as automake doesn't know the directory
|
|
||||||
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||||
-version-number 3:@PNGLIB_RELEASE@:0
|
-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
|
||||||
|
|
||||||
if HAVE_LD_VERSION_SCRIPT
|
if HAVE_LD_VERSION_SCRIPT
|
||||||
# Versioned symbols and restricted exports
|
# Versioned symbols and restricted exports
|
||||||
libpng12_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
if HAVE_SOLARIS_LD
|
||||||
libpng12_la_DEPENDENCIES = libpng.vers
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M -Wl,libpng.vers
|
||||||
else
|
else
|
||||||
# Only restricted exports when possible
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
||||||
libpng12_la_LDFLAGS += -export-symbols libpng.sym
|
|
||||||
libpng12_la_DEPENDENCIES = libpng.sym
|
|
||||||
endif
|
endif
|
||||||
libpng_la_DEPENDENCIES = $(libpng12_la_DEPENDENCIES)
|
|
||||||
|
|
||||||
# Avoid depending upon Character Ranges.
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
||||||
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
|
else
|
||||||
|
# Only restricted exports when possible
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
||||||
|
endif
|
||||||
|
|
||||||
#distribute headers in /usr/include/libpng/*
|
#distribute headers in /usr/include/libpng/*
|
||||||
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
||||||
pkginclude_HEADERS= png.h pngconf.h
|
pkginclude_HEADERS= png.h pngconf.h
|
||||||
|
nodist_pkginclude_HEADERS= pnglibconf.h
|
||||||
|
|
||||||
# pkg-config stuff, note that libpng.pc is always required in order
|
# pkg-config stuff, note that libpng.pc is always required in order
|
||||||
# to get the correct library
|
# to get the correct library
|
||||||
pkgconfigdir = @pkgconfigdir@
|
pkgconfigdir = @pkgconfigdir@
|
||||||
pkgconfig_DATA = libpng12.pc
|
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||||
|
|
||||||
#extra source distribution files.
|
#extra source distribution files.
|
||||||
EXTRA_DIST= \
|
EXTRA_DIST= \
|
||||||
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
|
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
||||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||||
CMakeLists.txt \
|
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||||
${srcdir}/projects/cbuilder5/* \
|
|
||||||
${srcdir}/projects/beos/* \
|
|
||||||
${srcdir}/projects/visualc6/* \
|
|
||||||
${srcdir}/projects/visualc71/* \
|
|
||||||
${srcdir}/projects/wince.txt \
|
|
||||||
${srcdir}/projects/netware.txt \
|
|
||||||
${srcdir}/projects/xcode/* \
|
|
||||||
${srcdir}/scripts/* \
|
|
||||||
${srcdir}/contrib/gregbook/* \
|
|
||||||
${srcdir}/contrib/pngminim/* \
|
|
||||||
${srcdir}/contrib/pngminus/* \
|
|
||||||
${srcdir}/contrib/pngsuite/* \
|
|
||||||
${srcdir}/contrib/visupng/* \
|
|
||||||
$(TESTS) \
|
$(TESTS) \
|
||||||
example.c libpng-1.2.46.txt pnggccrd.c pngvcrd.c
|
CMakeLists.txt example.c libpng-manual.txt
|
||||||
|
|
||||||
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \
|
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
|
||||||
libpng.sym
|
|
||||||
|
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
|
||||||
|
check.new pnglibconf.* symbols.new pngtest-log.txt \
|
||||||
|
$(SCRIPT_CLEANFILES)
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
|
||||||
config.sub configure depcomp install-sh ltmain.sh missing
|
config.sub configure depcomp install-sh ltmain.sh missing
|
||||||
|
|
||||||
|
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
|
||||||
|
# other operating systems (NeXT?) the C preprocessor selected by configure
|
||||||
|
# checks input tokens for validity - effectively it performs part of the ANSI-C
|
||||||
|
# parsing - and therefore fails with the .df files. configure.ac has special
|
||||||
|
# checks for this and sets DFNCPP appropriately.
|
||||||
|
DFNCPP = @DFNCPP@
|
||||||
|
|
||||||
|
SUFFIXES = .chk .dfn .out
|
||||||
|
|
||||||
$(PNGLIB_BASENAME).pc: libpng.pc
|
$(PNGLIB_BASENAME).pc: libpng.pc
|
||||||
cp libpng.pc $@
|
cp libpng.pc $@
|
||||||
|
|
||||||
$(PNGLIB_BASENAME)-config: libpng-config
|
$(PNGLIB_BASENAME)-config: libpng-config
|
||||||
cp libpng-config $@
|
cp libpng-config $@
|
||||||
|
|
||||||
libpng.sym: png.h pngconf.h
|
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
|
||||||
rm -f $@ $@.new
|
scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
|
||||||
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
|
|
||||||
$(SED) -n -e \
|
|
||||||
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
|
|
||||||
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
|
|
||||||
>$@.new
|
|
||||||
mv $@.new $@
|
|
||||||
|
|
||||||
libpng.vers: libpng.sym
|
libpng.sym: scripts/sym.out
|
||||||
rm -f $@ $@.new
|
rm -f $@
|
||||||
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
|
cp $? $@
|
||||||
$(SED) s/$$/\;/ libpng.sym >> $@.new
|
libpng.vers: scripts/vers.out
|
||||||
echo 'local: *; };' >> $@.new
|
rm -f $@
|
||||||
mv $@.new $@
|
cp $? $@
|
||||||
|
pnglibconf.h: pnglibconf.out
|
||||||
|
rm -f $@
|
||||||
|
cp $? $@
|
||||||
|
$(srcdir)/scripts/pnglibconf.h.prebuilt:
|
||||||
|
@echo "Attempting to build $@" >&2
|
||||||
|
@echo "This is a machine generated file, but if you want to make" >&2
|
||||||
|
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
|
||||||
|
@exit 1
|
||||||
|
|
||||||
test: check
|
# The following is necessary to ensure that the local pnglibconf.h is used, not
|
||||||
|
# an installed one (this can happen immediately after on a clean system if
|
||||||
|
# 'make test' is the first thing the user does.)
|
||||||
|
contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
|
||||||
|
|
||||||
|
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
||||||
|
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
||||||
|
# interfering with the symbol file format.
|
||||||
|
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
|
||||||
|
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
|
||||||
|
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
|
||||||
|
-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
|
||||||
|
|
||||||
|
.dfn.out:
|
||||||
|
rm -f $@ dfn.c dfn?.out
|
||||||
|
test -d scripts || mkdir scripts
|
||||||
|
echo '#include "$<"' >dfn.c
|
||||||
|
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
|
||||||
|
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out
|
||||||
|
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
|
||||||
|
dfn1.out >dfn2.out
|
||||||
|
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
|
||||||
|
rm -f dfn.c dfn[12].out
|
||||||
|
mv dfn3.out $@
|
||||||
|
|
||||||
|
# The .dfn file for pnglibconf.h is machine generated
|
||||||
|
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
|
||||||
|
rm -f $@ dfn?.out
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out version=search\
|
||||||
|
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
|
||||||
|
${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
|
||||||
|
rm dfn1.out
|
||||||
|
mv dfn2.out $@
|
||||||
|
|
||||||
|
# Symbol checks (.def and .out files should match)
|
||||||
|
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
|
||||||
|
.out.chk:
|
||||||
|
rm -f $@ symbols.new
|
||||||
|
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
|
||||||
|
$< >&2
|
||||||
|
mv symbols.new $@
|
||||||
|
|
||||||
|
# used on demand to regenerate the standard header, CPPFLAGS should
|
||||||
|
# be empty - no non-standard defines
|
||||||
|
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
|
||||||
|
rm -f $@ dfn?.out
|
||||||
|
test -z "$(CPPFLAGS)"
|
||||||
|
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out logunsupported=1
|
||||||
|
version=search ${srcdir}/pngconf.h -\
|
||||||
|
${srcdir}/scripts/pnglibconf.dfa 1>&2
|
||||||
|
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
|
||||||
|
rm dfn1.out
|
||||||
|
mv dfn2.out $@
|
||||||
|
|
||||||
|
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
|
||||||
|
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
|
||||||
|
|
||||||
|
test: check-am
|
||||||
|
|
||||||
|
# Extra checks
|
||||||
|
check: scripts/symbols.chk
|
||||||
|
|
||||||
|
# Don't distribute the generated script files
|
||||||
|
dist-hook:
|
||||||
|
cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
|
||||||
|
|
||||||
# install the .../include headers as links to the new ones
|
# install the .../include headers as links to the new ones
|
||||||
install-data-hook:
|
install-data-hook:
|
||||||
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
|
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
|
||||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
|
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
|
||||||
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h pngconf.h
|
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
|
||||||
|
pngconf.h
|
||||||
|
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
|
||||||
|
pnglibconf.h
|
||||||
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
|
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
|
||||||
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
|
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
|
||||||
|
|
||||||
# do evil things to libpng to cause libpng12 to be used
|
# do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
cd $(DESTDIR)$(bindir); rm -f libpng-config
|
cd $(DESTDIR)$(bindir); rm -f libpng-config
|
||||||
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
|
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
|
||||||
@set -x;\
|
@set -x;\
|
||||||
cd $(DESTDIR)$(libdir);\
|
cd $(DESTDIR)$(libdir);\
|
||||||
for ext in a la so sl dylib; do\
|
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
|
||||||
rm -f libpng.$$ext;\
|
rm -f libpng.$$ext;\
|
||||||
if test -f $(PNGLIB_BASENAME).$$ext; then\
|
if test -f $(PNGLIB_BASENAME).$$ext; then\
|
||||||
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
|
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
|
||||||
@ -143,13 +220,9 @@ install-exec-hook:
|
|||||||
done
|
done
|
||||||
|
|
||||||
uninstall-hook:
|
uninstall-hook:
|
||||||
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
|
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
|
||||||
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
|
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
|
||||||
rm -f $(DESTDIR)$(bindir)/libpng-config
|
rm -f $(DESTDIR)$(bindir)/libpng-config
|
||||||
@if test -n "@compatlib@"; then\
|
rm -f $(DESTDIR)$(libdir)/libpng.a
|
||||||
set -x;\
|
rm -f $(DESTDIR)$(libdir)/libpng.la
|
||||||
cd $(DESTDIR)$(libdir);\
|
rm -f $(DESTDIR)$(libdir)/libpng.dll.a
|
||||||
for ext in a la so sl dylib; do\
|
|
||||||
rm -f libpng.$$ext;\
|
|
||||||
done;\
|
|
||||||
fi
|
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
README for libpng version 1.2.46 - July 9, 2011 (shared library 12.0)
|
README for libpng version 1.5.10 - March 29, 2012 (shared library 15.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
||||||
libpng-*.tar.xz, or libpng-*.tar.bz2 if you want UNIX-style line
|
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
||||||
endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style
|
in the text files, or lpng*.zip if you want DOS-style line endings.
|
||||||
line endings. You can get UNIX-style line endings from the *.zip file
|
|
||||||
by using "unzip -a" but there seems to be no simple way to recover
|
|
||||||
UNIX-style line endings from the *.7z file. The *.tar.xz file is
|
|
||||||
recommended for *NIX users instead.
|
|
||||||
|
|
||||||
Version 0.89 was the first official release of libpng. Don't let the
|
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
|
fact that it's the first release fool you. The libpng library has been in
|
||||||
@ -58,11 +54,11 @@ to set different actions based on whether the CRC error occurred in a
|
|||||||
critical or an ancillary chunk.
|
critical or an ancillary chunk.
|
||||||
|
|
||||||
The changes made to the library, and bugs fixed are based on discussions
|
The changes made to the library, and bugs fixed are based on discussions
|
||||||
on the png-mng-implement mailing list and not on material submitted
|
on the PNG-implement mailing list and not on material submitted
|
||||||
privately to Guy, Andreas, or Glenn. They will forward any good
|
privately to Guy, Andreas, or Glenn. They will forward any good
|
||||||
suggestions to the list.
|
suggestions to the list.
|
||||||
|
|
||||||
For a detailed description on using libpng, read libpng.txt. For
|
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
|
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||||
information and restrictions (what little they are) on libpng, see
|
information and restrictions (what little they are) on libpng, see
|
||||||
png.h. For a description on using zlib (the compression library used by
|
png.h. For a description on using zlib (the compression library used by
|
||||||
@ -81,12 +77,12 @@ 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 can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||||
you are so inclined.
|
you are so inclined.
|
||||||
|
|
||||||
zlib should be available at the same place that libpng is, or at
|
zlib should be available at the same place that libpng is, or at.
|
||||||
ftp://ftp.simplesystems.org/pub/png/src/
|
ftp://ftp.info-zip.org/pub/infozip/zlib
|
||||||
|
|
||||||
You may also want a copy of the PNG specification. It is available
|
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
|
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||||
these at http://www.libpng.org/pub/png/pngdocs.html
|
these at http://www.libpng.org/pub/png/documents/
|
||||||
|
|
||||||
This code is currently being archived at libpng.sf.net in the
|
This code is currently being archived at libpng.sf.net in the
|
||||||
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
||||||
@ -108,28 +104,26 @@ 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
|
based in a large way on Guy's and Andreas' earlier work), and the PNG
|
||||||
development group.
|
development group.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at
|
||||||
(subscription required; visit
|
lists.sourceforge.net (subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe) or to glennrp at users.sourceforge.net
|
to subscribe) or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
You can't reach Guy, the original libpng author, at the addresses
|
You can't reach Guy, the original libpng author, at the addresses
|
||||||
given in previous versions of this document. He and Andreas will
|
given in previous versions of this document. He and Andreas will
|
||||||
read mail addressed to the png-mng-implement list, however.
|
read mail addressed to the png-implement list, however.
|
||||||
|
|
||||||
Please do not send general questions about PNG. Send them to
|
Please do not send general questions about PNG. Send them to
|
||||||
the (png-mng-misc at lists.sourceforge.net, subscription required, visit
|
png-mng-misc at lists.sf.net (subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
||||||
subscribe). On the other hand, please do not send libpng questions to
|
subscribe). If you have a question about something
|
||||||
that address, send them to me or to the png-mng-implement list. I'll
|
|
||||||
get them in the end anyway. If you have a question about something
|
|
||||||
in the PNG specification that is related to using libpng, send it
|
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,
|
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
|
and ...". If in doubt, send questions to me. I'll bounce them
|
||||||
to others, if necessary.
|
to others, if necessary.
|
||||||
|
|
||||||
Please do not send suggestions on how to change PNG. We have
|
Please do not send suggestions on how to change PNG. We have
|
||||||
been discussing PNG for twelve years now, and it is official and
|
been discussing PNG for sixteen years now, and it is official and
|
||||||
finished. If you have suggestions for libpng, however, I'll
|
finished. If you have suggestions for libpng, however, I'll
|
||||||
gladly listen. Even if your suggestion is not used immediately,
|
gladly listen. Even if your suggestion is not used immediately,
|
||||||
it may be used later.
|
it may be used later.
|
||||||
@ -144,14 +138,17 @@ Files in this distribution:
|
|||||||
TODO => Things not implemented in the current library
|
TODO => Things not implemented in the current library
|
||||||
Y2KINFO => Statement of Y2K compliance
|
Y2KINFO => Statement of Y2K compliance
|
||||||
example.c => Example code for using libpng functions
|
example.c => Example code for using libpng functions
|
||||||
libpng-*-*-diff.txt => Diff from previous release
|
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||||
libpng.3 => manual page for libpng (includes libpng.txt)
|
libpng-manual.txt => Description of libpng and its functions
|
||||||
libpng.txt => Description of libpng and its functions
|
|
||||||
libpngpf.3 => manual page for libpng's private functions
|
libpngpf.3 => manual page for libpng's private functions
|
||||||
png.5 => manual page for the PNG format
|
png.5 => manual page for the PNG format
|
||||||
png.c => Basic interface functions common to library
|
png.c => Basic interface functions common to library
|
||||||
png.h => Library function and interface declarations
|
png.h => Library function and interface declarations (public)
|
||||||
pngconf.h => System specific library configuration
|
pngpriv.h => Library function and interface declarations (private)
|
||||||
|
pngconf.h => System specific library configuration (public)
|
||||||
|
pngstruct.h => png_struct declaration (private)
|
||||||
|
pnginfo.h => png_info struct declaration (private)
|
||||||
|
pngdebug.h => debugging macros (private)
|
||||||
pngerror.c => Error/warning message I/O functions
|
pngerror.c => Error/warning message I/O functions
|
||||||
pngget.c => Functions for retrieving info from struct
|
pngget.c => Functions for retrieving info from struct
|
||||||
pngmem.c => Memory handling functions
|
pngmem.c => Memory handling functions
|
||||||
@ -175,91 +172,21 @@ Files in this distribution:
|
|||||||
Greg Roelofs' "PNG: The Definitive Guide",
|
Greg Roelofs' "PNG: The Definitive Guide",
|
||||||
O'Reilly, 1999
|
O'Reilly, 1999
|
||||||
msvctest => Builds and runs pngtest using a MSVC workspace
|
msvctest => Builds and runs pngtest using a MSVC workspace
|
||||||
pngminim => Simple pnm2pngm and png2pnmm programs
|
|
||||||
pngminus => Simple pnm2png and png2pnm programs
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for
|
projects => Contains project files and workspaces for
|
||||||
building a DLL
|
building a DLL
|
||||||
beos => Contains a Beos workspace for building libpng
|
cbuilder5 => Contains a Borland workspace for building
|
||||||
c5builder => Contains a Borland workspace for building
|
|
||||||
libpng and zlib
|
libpng and zlib
|
||||||
netware.txt => Contains instructions for downloading a set
|
|
||||||
of project files for building libpng and
|
|
||||||
zlib on Netware.
|
|
||||||
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
workspace for building libpng and zlib
|
workspace for building libpng and zlib
|
||||||
wince.txt => Contains instructions for downloading a
|
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
Microsoft Visual C++ (Windows CD Toolkit)
|
workspace for building libpng and zlib
|
||||||
workspace for building libpng and zlib on
|
xcode => Contains an Apple xcode
|
||||||
WindowsCE
|
workspace for building libpng and zlib
|
||||||
xcode => Contains xcode project files
|
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
descrip.mms => VMS makefile for MMS or MMK
|
(see scripts/README.txt for the list of scripts)
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static
|
|
||||||
libpng.a)
|
|
||||||
makefile.elf => Linux/ELF gcc makefile symbol versioning,
|
|
||||||
creates libpng12.so.0.1.2.46)
|
|
||||||
makefile.linux => Linux/ELF makefile (gcc, creates
|
|
||||||
libpng12.so.0.1.2.46)
|
|
||||||
makefile.gcmmx => Linux/ELF makefile (gcc, creates
|
|
||||||
libpng12.so.0.1.2.46, previously
|
|
||||||
used assembler code tuned for Intel MMX
|
|
||||||
platform)
|
|
||||||
makefile.gcc => Generic makefile (gcc, creates static
|
|
||||||
libpng.a)
|
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files
|
|
||||||
with ansi2knr (Requires ansi2knr.c from
|
|
||||||
ftp://ftp.cs.wisc.edu/ghost)
|
|
||||||
makefile.aix => AIX makefile
|
|
||||||
makefile.cygwin => Cygwin/gcc makefile
|
|
||||||
makefile.darwin => Darwin makefile
|
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
|
||||||
makefile.freebsd => FreeBSD makefile
|
|
||||||
makefile.hpgcc => HPUX makefile using gcc
|
|
||||||
makefile.hpux => HPUX (10.20 and 11.00) makefile
|
|
||||||
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
|
|
||||||
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2
|
|
||||||
(static)
|
|
||||||
makefile.intel => Intel C/C++ version 4.0 and later
|
|
||||||
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
|
|
||||||
makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
|
|
||||||
makefile.ne12bsd => NetBSD/cc makefile, makes libpng12.so
|
|
||||||
makefile.openbsd => OpenBSD makefile
|
|
||||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
|
||||||
makefile.sggcc => Silicon Graphics
|
|
||||||
(gcc, creates libpng12.so.0.1.2.46)
|
|
||||||
makefile.sunos => Sun makefile
|
|
||||||
makefile.solaris => Solaris 2.X makefile
|
|
||||||
(gcc, creates libpng12.so.0.1.2.46)
|
|
||||||
makefile.so9 => Solaris 9 makefile
|
|
||||||
(gcc, creates libpng12.so.0.1.2.46)
|
|
||||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
|
||||||
makefile.64sunu => Sun Ultra 64-bit makefile
|
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
|
||||||
makefile.mips => MIPS makefile
|
|
||||||
makefile.acorn => Acorn makefile
|
|
||||||
makefile.amiga => Amiga makefile
|
|
||||||
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC
|
|
||||||
compiler (Requires SCOPTIONS, copied from
|
|
||||||
scripts/SCOPTIONS.ppc)
|
|
||||||
makefile.atari => Atari makefile
|
|
||||||
makefile.beos => BEOS makefile for X86
|
|
||||||
makefile.bor => Borland makefile (uses bcc)
|
|
||||||
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
|
|
||||||
makefile.tc3 => Turbo C 3.0 makefile
|
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
|
||||||
makefile.msc => Microsoft C makefile
|
|
||||||
makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and
|
|
||||||
later (previously used assembler code tuned
|
|
||||||
for Intel MMX platform)
|
|
||||||
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
|
|
||||||
later (does not use assembler code)
|
|
||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
|
||||||
pngos2.def => OS/2 module definition file used by makefile.os2
|
|
||||||
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
|
|
||||||
makevms.com => VMS build script
|
|
||||||
SCOPTIONS.ppc => Used with smakefile.ppc
|
|
||||||
|
|
||||||
Good luck, and happy coding.
|
Good luck, and happy coding.
|
||||||
|
|
||||||
@ -268,7 +195,7 @@ Good luck, and happy coding.
|
|||||||
|
|
||||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||||
Internet: adilger at enel.ucalgary.ca
|
Internet: adilger at enel.ucalgary.ca
|
||||||
Web: http://members.shaw.ca/adilger/
|
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||||
|
|
||||||
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||||
(formerly of Group 42, Inc)
|
(formerly of Group 42, Inc)
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
/*
|
||||||
TODO - list of things to do for libpng:
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
Final bug fixes.
|
Final bug fixes.
|
||||||
Improve API by hiding the png_struct and png_info structs.
|
|
||||||
Finish work on the no-floating-point version (including gamma compensation)
|
|
||||||
Better C++ wrapper/full C++ implementation?
|
Better C++ wrapper/full C++ implementation?
|
||||||
Fix problem with C++ and EXTERN "C".
|
Fix problem with C++ and EXTERN "C".
|
||||||
cHRM transformation.
|
cHRM transformation.
|
||||||
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
|
Remove setjmp/longjmp usage in favor of returning error codes.
|
||||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
Improved dithering.
|
Improved dithering.
|
||||||
Multi-lingual error and warning message support.
|
Multi-lingual error and warning message support.
|
||||||
@ -17,9 +16,12 @@ Better filter selection
|
|||||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||||
Histogram creation.
|
Histogram creation.
|
||||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||||
Should we always malloc 2^bit_depth PLTE/tRNS/hIST entries for safety?
|
Avoid building gamma tables whenever possible.
|
||||||
Build gamma tables using fixed point (and do away with floating point entirely).
|
|
||||||
Use greater precision when changing to linear gamma for compositing against
|
Use greater precision when changing to linear gamma for compositing against
|
||||||
background and doing rgb-to-gray transformation.
|
background and doing rgb-to-gray transformation.
|
||||||
Investigate pre-incremented loop counters and other loop constructions.
|
Investigate pre-incremented loop counters and other loop constructions.
|
||||||
Add interpolated method of handling interlacing.
|
Add interpolated method of handling interlacing.
|
||||||
|
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
||||||
|
Extend pngvalid.c to validate more of the libpng transformations.
|
||||||
|
|
||||||
|
*/
|
||||||
|
2216
jni/libpng/aclocal.m4
vendored
225
jni/libpng/arm/filter_neon.S
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
|
||||||
|
/* filter_neon.S - NEON optimised filter functions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 Glenn Randers-Pehrson
|
||||||
|
* Written by Mans Rullgard, 2011.
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ELF__
|
||||||
|
# define ELF
|
||||||
|
#else
|
||||||
|
# define ELF @
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.arch armv7-a
|
||||||
|
.fpu neon
|
||||||
|
|
||||||
|
.macro func name, export=0
|
||||||
|
.macro endfunc
|
||||||
|
ELF .size \name, . - \name
|
||||||
|
.endfunc
|
||||||
|
.purgem endfunc
|
||||||
|
.endm
|
||||||
|
.text
|
||||||
|
.if \export
|
||||||
|
.global \name
|
||||||
|
.endif
|
||||||
|
ELF .type \name, STT_FUNC
|
||||||
|
.func \name
|
||||||
|
\name:
|
||||||
|
.endm
|
||||||
|
|
||||||
|
func png_read_filter_row_sub4_neon, export=1
|
||||||
|
ldr r3, [r0, #4] @ rowbytes
|
||||||
|
vmov.i8 d3, #0
|
||||||
|
1:
|
||||||
|
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||||
|
vadd.u8 d0, d3, d4
|
||||||
|
vadd.u8 d1, d0, d5
|
||||||
|
vadd.u8 d2, d1, d6
|
||||||
|
vadd.u8 d3, d2, d7
|
||||||
|
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||||
|
subs r3, r3, #16
|
||||||
|
bgt 1b
|
||||||
|
|
||||||
|
bx lr
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func png_read_filter_row_sub3_neon, export=1
|
||||||
|
ldr r3, [r0, #4] @ rowbytes
|
||||||
|
vmov.i8 d3, #0
|
||||||
|
mov r0, r1
|
||||||
|
mov r2, #3
|
||||||
|
mov r12, #12
|
||||||
|
vld1.8 {q11}, [r0], r12
|
||||||
|
1:
|
||||||
|
vext.8 d5, d22, d23, #3
|
||||||
|
vadd.u8 d0, d3, d22
|
||||||
|
vext.8 d6, d22, d23, #6
|
||||||
|
vadd.u8 d1, d0, d5
|
||||||
|
vext.8 d7, d23, d23, #1
|
||||||
|
vld1.8 {q11}, [r0], r12
|
||||||
|
vst1.32 {d0[0]}, [r1,:32], r2
|
||||||
|
vadd.u8 d2, d1, d6
|
||||||
|
vst1.32 {d1[0]}, [r1], r2
|
||||||
|
vadd.u8 d3, d2, d7
|
||||||
|
vst1.32 {d2[0]}, [r1], r2
|
||||||
|
vst1.32 {d3[0]}, [r1], r2
|
||||||
|
subs r3, r3, #12
|
||||||
|
bgt 1b
|
||||||
|
|
||||||
|
bx lr
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func png_read_filter_row_up_neon, export=1
|
||||||
|
ldr r3, [r0, #4] @ rowbytes
|
||||||
|
1:
|
||||||
|
vld1.8 {q0}, [r1,:128]
|
||||||
|
vld1.8 {q1}, [r2,:128]!
|
||||||
|
vadd.u8 q0, q0, q1
|
||||||
|
vst1.8 {q0}, [r1,:128]!
|
||||||
|
subs r3, r3, #16
|
||||||
|
bgt 1b
|
||||||
|
|
||||||
|
bx lr
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func png_read_filter_row_avg4_neon, export=1
|
||||||
|
ldr r12, [r0, #4] @ rowbytes
|
||||||
|
vmov.i8 d3, #0
|
||||||
|
1:
|
||||||
|
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||||
|
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||||
|
vhadd.u8 d0, d3, d16
|
||||||
|
vadd.u8 d0, d0, d4
|
||||||
|
vhadd.u8 d1, d0, d17
|
||||||
|
vadd.u8 d1, d1, d5
|
||||||
|
vhadd.u8 d2, d1, d18
|
||||||
|
vadd.u8 d2, d2, d6
|
||||||
|
vhadd.u8 d3, d2, d19
|
||||||
|
vadd.u8 d3, d3, d7
|
||||||
|
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||||
|
subs r12, r12, #16
|
||||||
|
bgt 1b
|
||||||
|
|
||||||
|
bx lr
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func png_read_filter_row_avg3_neon, export=1
|
||||||
|
push {r4,lr}
|
||||||
|
ldr r12, [r0, #4] @ rowbytes
|
||||||
|
vmov.i8 d3, #0
|
||||||
|
mov r0, r1
|
||||||
|
mov r4, #3
|
||||||
|
mov lr, #12
|
||||||
|
vld1.8 {q11}, [r0], lr
|
||||||
|
1:
|
||||||
|
vld1.8 {q10}, [r2], lr
|
||||||
|
vext.8 d5, d22, d23, #3
|
||||||
|
vhadd.u8 d0, d3, d20
|
||||||
|
vext.8 d17, d20, d21, #3
|
||||||
|
vadd.u8 d0, d0, d22
|
||||||
|
vext.8 d6, d22, d23, #6
|
||||||
|
vhadd.u8 d1, d0, d17
|
||||||
|
vext.8 d18, d20, d21, #6
|
||||||
|
vadd.u8 d1, d1, d5
|
||||||
|
vext.8 d7, d23, d23, #1
|
||||||
|
vld1.8 {q11}, [r0], lr
|
||||||
|
vst1.32 {d0[0]}, [r1,:32], r4
|
||||||
|
vhadd.u8 d2, d1, d18
|
||||||
|
vst1.32 {d1[0]}, [r1], r4
|
||||||
|
vext.8 d19, d21, d21, #1
|
||||||
|
vadd.u8 d2, d2, d6
|
||||||
|
vhadd.u8 d3, d2, d19
|
||||||
|
vst1.32 {d2[0]}, [r1], r4
|
||||||
|
vadd.u8 d3, d3, d7
|
||||||
|
vst1.32 {d3[0]}, [r1], r4
|
||||||
|
subs r12, r12, #12
|
||||||
|
bgt 1b
|
||||||
|
|
||||||
|
pop {r4,pc}
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
.macro paeth rx, ra, rb, rc
|
||||||
|
vaddl.u8 q12, \ra, \rb @ a + b
|
||||||
|
vaddl.u8 q15, \rc, \rc @ 2*c
|
||||||
|
vabdl.u8 q13, \rb, \rc @ pa
|
||||||
|
vabdl.u8 q14, \ra, \rc @ pb
|
||||||
|
vabd.u16 q15, q12, q15 @ pc
|
||||||
|
vcle.u16 q12, q13, q14 @ pa <= pb
|
||||||
|
vcle.u16 q13, q13, q15 @ pa <= pc
|
||||||
|
vcle.u16 q14, q14, q15 @ pb <= pc
|
||||||
|
vand q12, q12, q13 @ pa <= pb && pa <= pc
|
||||||
|
vmovn.u16 d28, q14
|
||||||
|
vmovn.u16 \rx, q12
|
||||||
|
vbsl d28, \rb, \rc
|
||||||
|
vbsl \rx, \ra, d28
|
||||||
|
.endm
|
||||||
|
|
||||||
|
func png_read_filter_row_paeth4_neon, export=1
|
||||||
|
ldr r12, [r0, #4] @ rowbytes
|
||||||
|
vmov.i8 d3, #0
|
||||||
|
vmov.i8 d20, #0
|
||||||
|
1:
|
||||||
|
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||||
|
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||||
|
paeth d0, d3, d16, d20
|
||||||
|
vadd.u8 d0, d0, d4
|
||||||
|
paeth d1, d0, d17, d16
|
||||||
|
vadd.u8 d1, d1, d5
|
||||||
|
paeth d2, d1, d18, d17
|
||||||
|
vadd.u8 d2, d2, d6
|
||||||
|
paeth d3, d2, d19, d18
|
||||||
|
vmov d20, d19
|
||||||
|
vadd.u8 d3, d3, d7
|
||||||
|
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||||
|
subs r12, r12, #16
|
||||||
|
bgt 1b
|
||||||
|
|
||||||
|
bx lr
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func png_read_filter_row_paeth3_neon, export=1
|
||||||
|
push {r4,lr}
|
||||||
|
ldr r12, [r0, #4] @ rowbytes
|
||||||
|
vmov.i8 d3, #0
|
||||||
|
vmov.i8 d4, #0
|
||||||
|
mov r0, r1
|
||||||
|
mov r4, #3
|
||||||
|
mov lr, #12
|
||||||
|
vld1.8 {q11}, [r0], lr
|
||||||
|
1:
|
||||||
|
vld1.8 {q10}, [r2], lr
|
||||||
|
paeth d0, d3, d20, d4
|
||||||
|
vext.8 d5, d22, d23, #3
|
||||||
|
vadd.u8 d0, d0, d22
|
||||||
|
vext.8 d17, d20, d21, #3
|
||||||
|
paeth d1, d0, d17, d20
|
||||||
|
vst1.32 {d0[0]}, [r1,:32], r4
|
||||||
|
vext.8 d6, d22, d23, #6
|
||||||
|
vadd.u8 d1, d1, d5
|
||||||
|
vext.8 d18, d20, d21, #6
|
||||||
|
paeth d2, d1, d18, d17
|
||||||
|
vext.8 d7, d23, d23, #1
|
||||||
|
vld1.8 {q11}, [r0], lr
|
||||||
|
vst1.32 {d1[0]}, [r1], r4
|
||||||
|
vadd.u8 d2, d2, d6
|
||||||
|
vext.8 d19, d21, d21, #1
|
||||||
|
paeth d3, d2, d19, d18
|
||||||
|
vst1.32 {d2[0]}, [r1], r4
|
||||||
|
vmov d4, d19
|
||||||
|
vadd.u8 d3, d3, d7
|
||||||
|
vst1.32 {d3[0]}, [r1], r4
|
||||||
|
subs r12, r12, #12
|
||||||
|
bgt 1b
|
||||||
|
|
||||||
|
pop {r4,pc}
|
||||||
|
endfunc
|
@ -4,22 +4,31 @@
|
|||||||
#
|
#
|
||||||
# WARNING: if you run this you will change the versions
|
# WARNING: if you run this you will change the versions
|
||||||
# of the tools which are used and, maybe, required!
|
# of the tools which are used and, maybe, required!
|
||||||
touch Makefile.am configure.ac
|
|
||||||
|
# You can define your own replacements in your environment.
|
||||||
|
# $AUTOCONF, $AUTOMAKE, $AUTOHEADER, $AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
|
||||||
|
|
||||||
|
touch Makefile.am configure.ac
|
||||||
{
|
{
|
||||||
echo "running libtoolize" >&2
|
LT=${LIBTOOLIZE-libtoolize}
|
||||||
libtoolize --force --copy --automake
|
echo "running $LT" >&2
|
||||||
|
$LT --force --copy --automake
|
||||||
} && {
|
} && {
|
||||||
echo "running aclocal" >&2
|
AL=${ACLOCAL-aclocal}
|
||||||
aclocal
|
echo "running $AL" >&2
|
||||||
|
$AL
|
||||||
} && {
|
} && {
|
||||||
echo "running autoheader [ignore the warnings]" >&2
|
AH=${AUTOHEADER-autoheader}
|
||||||
autoheader
|
echo "running $AH [ignore the warnings]" >&2
|
||||||
|
$AH
|
||||||
} && {
|
} && {
|
||||||
echo "running automake" >&2
|
AM=${AUTOMAKE-automake}
|
||||||
automake --force-missing --foreign -a -c
|
echo "running $AM" >&2
|
||||||
|
$AM --force-missing --foreign -a -c
|
||||||
} && {
|
} && {
|
||||||
echo "running autoconf" >&2
|
AC=${AUTOCONF-autoconf}
|
||||||
autoconf
|
echo "running $AC" >&2
|
||||||
|
$AC
|
||||||
} &&
|
} &&
|
||||||
echo "autogen complete" >&2 ||
|
echo "autogen complete" >&2 ||
|
||||||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2
|
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2
|
||||||
|
235
jni/libpng/config.guess
vendored
Executable file → Normal file
@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Attempt to guess a canonical system name.
|
# Attempt to guess a canonical system name.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# Free Software Foundation, Inc.
|
# 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2009-04-27'
|
timestamp='2011-11-11'
|
||||||
|
|
||||||
# This file is free software; you can redistribute it and/or modify it
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by
|
# under the terms of the GNU General Public License as published by
|
||||||
@ -27,16 +27,16 @@ timestamp='2009-04-27'
|
|||||||
# the same distribution terms that you use for the rest of that program.
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
|
||||||
# Originally written by Per Bothner <per@bothner.com>.
|
# Originally written by Per Bothner. Please send patches (context
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
||||||
# diff and a properly formatted ChangeLog entry.
|
# entry.
|
||||||
#
|
#
|
||||||
# This script attempts to guess a canonical system name similar to
|
# This script attempts to guess a canonical system name similar to
|
||||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||||
# exits with 0. Otherwise, it exits with 1.
|
# exits with 0. Otherwise, it exits with 1.
|
||||||
#
|
#
|
||||||
# The plan is that this can be called by configure scripts if you
|
# You can get the latest version of this script from:
|
||||||
# don't specify an explicit build system type.
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||||
|
|
||||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||||
|
|
||||||
@ -56,8 +56,9 @@ version="\
|
|||||||
GNU config.guess ($timestamp)
|
GNU config.guess ($timestamp)
|
||||||
|
|
||||||
Originally written by Per Bothner.
|
Originally written by Per Bothner.
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
|
||||||
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@ -170,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
| grep __ELF__ >/dev/null
|
| grep -q __ELF__
|
||||||
then
|
then
|
||||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||||
# Return netbsd for either. FIX?
|
# Return netbsd for either. FIX?
|
||||||
@ -269,7 +270,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
# A Xn.n version is an unreleased experimental baselevel.
|
# A Xn.n version is an unreleased experimental baselevel.
|
||||||
# 1.2 uses "1.2" for uname -r.
|
# 1.2 uses "1.2" for uname -r.
|
||||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
exit ;;
|
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||||
|
exitcode=$?
|
||||||
|
trap '' 0
|
||||||
|
exit $exitcode ;;
|
||||||
Alpha\ *:Windows_NT*:*)
|
Alpha\ *:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||||
@ -333,6 +337,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
exit ;;
|
exit ;;
|
||||||
|
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
||||||
|
echo i386-pc-auroraux${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
SUN_ARCH="i386"
|
SUN_ARCH="i386"
|
||||||
@ -548,7 +555,7 @@ EOF
|
|||||||
echo rs6000-ibm-aix3.2
|
echo rs6000-ibm-aix3.2
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
*:AIX:*:[456])
|
*:AIX:*:[4567])
|
||||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||||
IBM_ARCH=rs6000
|
IBM_ARCH=rs6000
|
||||||
@ -656,7 +663,7 @@ EOF
|
|||||||
# => hppa64-hp-hpux11.23
|
# => hppa64-hp-hpux11.23
|
||||||
|
|
||||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||||
grep __LP64__ >/dev/null
|
grep -q __LP64__
|
||||||
then
|
then
|
||||||
HP_ARCH="hppa2.0w"
|
HP_ARCH="hppa2.0w"
|
||||||
else
|
else
|
||||||
@ -785,13 +792,12 @@ EOF
|
|||||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
*:FreeBSD:*:*)
|
*:FreeBSD:*:*)
|
||||||
case ${UNAME_MACHINE} in
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
pc98)
|
case ${UNAME_PROCESSOR} in
|
||||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
|
||||||
amd64)
|
amd64)
|
||||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
*)
|
*)
|
||||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
i*:CYGWIN*:*)
|
i*:CYGWIN*:*)
|
||||||
@ -800,6 +806,9 @@ EOF
|
|||||||
*:MINGW*:*)
|
*:MINGW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-mingw32
|
echo ${UNAME_MACHINE}-pc-mingw32
|
||||||
exit ;;
|
exit ;;
|
||||||
|
i*:MSYS*:*)
|
||||||
|
echo ${UNAME_MACHINE}-pc-msys
|
||||||
|
exit ;;
|
||||||
i*:windows32*:*)
|
i*:windows32*:*)
|
||||||
# uname -m includes "-pc" on this system.
|
# uname -m includes "-pc" on this system.
|
||||||
echo ${UNAME_MACHINE}-mingw32
|
echo ${UNAME_MACHINE}-mingw32
|
||||||
@ -807,12 +816,12 @@ EOF
|
|||||||
i*:PW*:*)
|
i*:PW*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-pw32
|
echo ${UNAME_MACHINE}-pc-pw32
|
||||||
exit ;;
|
exit ;;
|
||||||
*:Interix*:[3456]*)
|
*:Interix*:*)
|
||||||
case ${UNAME_MACHINE} in
|
case ${UNAME_MACHINE} in
|
||||||
x86)
|
x86)
|
||||||
echo i586-pc-interix${UNAME_RELEASE}
|
echo i586-pc-interix${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
EM64T | authenticamd | genuineintel)
|
authenticamd | genuineintel | EM64T)
|
||||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
IA64)
|
IA64)
|
||||||
@ -822,6 +831,9 @@ EOF
|
|||||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||||
echo i${UNAME_MACHINE}-pc-mks
|
echo i${UNAME_MACHINE}-pc-mks
|
||||||
exit ;;
|
exit ;;
|
||||||
|
8664:Windows_NT:*)
|
||||||
|
echo x86_64-pc-mks
|
||||||
|
exit ;;
|
||||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||||
@ -851,6 +863,20 @@ EOF
|
|||||||
i*86:Minix:*:*)
|
i*86:Minix:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-minix
|
echo ${UNAME_MACHINE}-pc-minix
|
||||||
exit ;;
|
exit ;;
|
||||||
|
alpha:Linux:*:*)
|
||||||
|
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||||
|
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||||
|
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||||
|
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||||
|
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||||
|
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||||
|
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||||
|
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||||
|
esac
|
||||||
|
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||||
|
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||||
|
exit ;;
|
||||||
arm*:Linux:*:*)
|
arm*:Linux:*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
@ -858,7 +884,13 @@ EOF
|
|||||||
then
|
then
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
else
|
else
|
||||||
|
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||||
|
| grep -q __ARM_PCS_VFP
|
||||||
|
then
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||||
|
else
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
exit ;;
|
exit ;;
|
||||||
avr32*:Linux:*:*)
|
avr32*:Linux:*:*)
|
||||||
@ -873,6 +905,20 @@ EOF
|
|||||||
frv:Linux:*:*)
|
frv:Linux:*:*)
|
||||||
echo frv-unknown-linux-gnu
|
echo frv-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
|
hexagon:Linux:*:*)
|
||||||
|
echo hexagon-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
i*86:Linux:*:*)
|
||||||
|
LIBC=gnu
|
||||||
|
eval $set_cc_for_build
|
||||||
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
#ifdef __dietlibc__
|
||||||
|
LIBC=dietlibc
|
||||||
|
#endif
|
||||||
|
EOF
|
||||||
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||||
|
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||||
|
exit ;;
|
||||||
ia64:Linux:*:*)
|
ia64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
@ -882,78 +928,34 @@ EOF
|
|||||||
m68*:Linux:*:*)
|
m68*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
mips:Linux:*:*)
|
mips:Linux:*:* | mips64:Linux:*:*)
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
#undef CPU
|
#undef CPU
|
||||||
#undef mips
|
#undef ${UNAME_MACHINE}
|
||||||
#undef mipsel
|
#undef ${UNAME_MACHINE}el
|
||||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||||
CPU=mipsel
|
CPU=${UNAME_MACHINE}el
|
||||||
#else
|
#else
|
||||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||||
CPU=mips
|
CPU=${UNAME_MACHINE}
|
||||||
#else
|
#else
|
||||||
CPU=
|
CPU=
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||||
/^CPU/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
|
||||||
;;
|
|
||||||
mips64:Linux:*:*)
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#undef CPU
|
|
||||||
#undef mips64
|
|
||||||
#undef mips64el
|
|
||||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
|
||||||
CPU=mips64el
|
|
||||||
#else
|
|
||||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
|
||||||
CPU=mips64
|
|
||||||
#else
|
|
||||||
CPU=
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
|
||||||
/^CPU/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||||
;;
|
;;
|
||||||
or32:Linux:*:*)
|
or32:Linux:*:*)
|
||||||
echo or32-unknown-linux-gnu
|
echo or32-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
ppc:Linux:*:*)
|
|
||||||
echo powerpc-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
ppc64:Linux:*:*)
|
|
||||||
echo powerpc64-unknown-linux-gnu
|
|
||||||
exit ;;
|
|
||||||
alpha:Linux:*:*)
|
|
||||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
|
||||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
|
||||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
|
||||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
|
||||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
|
||||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
|
||||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
|
||||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
|
||||||
esac
|
|
||||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
|
||||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
|
||||||
exit ;;
|
|
||||||
padre:Linux:*:*)
|
padre:Linux:*:*)
|
||||||
echo sparc-unknown-linux-gnu
|
echo sparc-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
|
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||||
|
echo hppa64-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||||
# Look for CPU level
|
# Look for CPU level
|
||||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||||
@ -962,8 +964,11 @@ EOF
|
|||||||
*) echo hppa-unknown-linux-gnu ;;
|
*) echo hppa-unknown-linux-gnu ;;
|
||||||
esac
|
esac
|
||||||
exit ;;
|
exit ;;
|
||||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
ppc64:Linux:*:*)
|
||||||
echo hppa64-unknown-linux-gnu
|
echo powerpc64-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
|
ppc:Linux:*:*)
|
||||||
|
echo powerpc-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
s390:Linux:*:* | s390x:Linux:*:*)
|
s390:Linux:*:* | s390x:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-ibm-linux
|
echo ${UNAME_MACHINE}-ibm-linux
|
||||||
@ -977,6 +982,9 @@ EOF
|
|||||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
|
tile*:Linux:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
|
exit ;;
|
||||||
vax:Linux:*:*)
|
vax:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
@ -986,66 +994,6 @@ EOF
|
|||||||
xtensa*:Linux:*:*)
|
xtensa*:Linux:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:Linux:*:*)
|
|
||||||
# The BFD linker knows what the default object file format is, so
|
|
||||||
# first see if it will tell us. cd to the root directory to prevent
|
|
||||||
# problems with other programs or directories called `ld' in the path.
|
|
||||||
# Set LC_ALL=C to ensure ld outputs messages in English.
|
|
||||||
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
|
||||||
| sed -ne '/supported targets:/!d
|
|
||||||
s/[ ][ ]*/ /g
|
|
||||||
s/.*supported targets: *//
|
|
||||||
s/ .*//
|
|
||||||
p'`
|
|
||||||
case "$ld_supported_targets" in
|
|
||||||
elf32-i386)
|
|
||||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
|
||||||
;;
|
|
||||||
a.out-i386-linux)
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
|
||||||
exit ;;
|
|
||||||
"")
|
|
||||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
|
||||||
# one that does not give us useful --help.
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
|
||||||
exit ;;
|
|
||||||
esac
|
|
||||||
# Determine whether the default compiler is a.out or elf
|
|
||||||
eval $set_cc_for_build
|
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
|
||||||
#include <features.h>
|
|
||||||
#ifdef __ELF__
|
|
||||||
# ifdef __GLIBC__
|
|
||||||
# if __GLIBC__ >= 2
|
|
||||||
LIBC=gnu
|
|
||||||
# else
|
|
||||||
LIBC=gnulibc1
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
LIBC=gnulibc1
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
|
||||||
LIBC=gnu
|
|
||||||
#else
|
|
||||||
LIBC=gnuaout
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef __dietlibc__
|
|
||||||
LIBC=dietlibc
|
|
||||||
#endif
|
|
||||||
EOF
|
|
||||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
|
||||||
/^LIBC/{
|
|
||||||
s: ::g
|
|
||||||
p
|
|
||||||
}'`"
|
|
||||||
test x"${LIBC}" != x && {
|
|
||||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
|
|
||||||
;;
|
|
||||||
i*86:DYNIX/ptx:4*:*)
|
i*86:DYNIX/ptx:4*:*)
|
||||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||||
# earlier versions are messed up and put the nodename in both
|
# earlier versions are messed up and put the nodename in both
|
||||||
@ -1074,7 +1022,7 @@ EOF
|
|||||||
i*86:syllable:*:*)
|
i*86:syllable:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-syllable
|
echo ${UNAME_MACHINE}-pc-syllable
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
||||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
i*86:*DOS:*:*)
|
i*86:*DOS:*:*)
|
||||||
@ -1182,7 +1130,7 @@ EOF
|
|||||||
rs6000:LynxOS:2.*:*)
|
rs6000:LynxOS:2.*:*)
|
||||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
||||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
SM[BE]S:UNIX_SV:*:*)
|
SM[BE]S:UNIX_SV:*:*)
|
||||||
@ -1275,6 +1223,16 @@ EOF
|
|||||||
*:Darwin:*:*)
|
*:Darwin:*:*)
|
||||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||||
case $UNAME_PROCESSOR in
|
case $UNAME_PROCESSOR in
|
||||||
|
i386)
|
||||||
|
eval $set_cc_for_build
|
||||||
|
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||||
|
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||||
|
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||||
|
grep IS_64BIT_ARCH >/dev/null
|
||||||
|
then
|
||||||
|
UNAME_PROCESSOR="x86_64"
|
||||||
|
fi
|
||||||
|
fi ;;
|
||||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||||
esac
|
esac
|
||||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||||
@ -1290,6 +1248,9 @@ EOF
|
|||||||
*:QNX:*:4*)
|
*:QNX:*:4*)
|
||||||
echo i386-pc-qnx
|
echo i386-pc-qnx
|
||||||
exit ;;
|
exit ;;
|
||||||
|
NEO-?:NONSTOP_KERNEL:*:*)
|
||||||
|
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||||
|
exit ;;
|
||||||
NSE-?:NONSTOP_KERNEL:*:*)
|
NSE-?:NONSTOP_KERNEL:*:*)
|
||||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||||
exit ;;
|
exit ;;
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
#undef HAVE_DLFCN_H
|
#undef HAVE_DLFCN_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `feenableexcept' function. */
|
||||||
|
#undef HAVE_FEENABLEEXCEPT
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
@ -70,6 +73,12 @@
|
|||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#undef PACKAGE_VERSION
|
#undef PACKAGE_VERSION
|
||||||
|
|
||||||
|
/* Align row buffers */
|
||||||
|
#undef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||||
|
|
||||||
|
/* Enable ARM NEON optimizations */
|
||||||
|
#undef PNG_ARM_NEON
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#undef STDC_HEADERS
|
#undef STDC_HEADERS
|
||||||
|
|
||||||
@ -82,5 +91,19 @@
|
|||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
#undef const
|
#undef const
|
||||||
|
|
||||||
|
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||||
|
nothing if this is not supported. Do not define if restrict is
|
||||||
|
supported directly. */
|
||||||
|
#undef restrict
|
||||||
|
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||||
|
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||||
|
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||||
|
previous line. Perhaps some future version of Sun C++ will work with
|
||||||
|
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||||
|
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||||
|
# define _Restrict
|
||||||
|
# define __restrict__
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
#undef size_t
|
#undef size_t
|
||||||
|
179
jni/libpng/config.sub
vendored
Executable file → Normal file
@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Configuration validation subroutine script.
|
# Configuration validation subroutine script.
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# Free Software Foundation, Inc.
|
# 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
timestamp='2009-04-17'
|
timestamp='2011-11-11'
|
||||||
|
|
||||||
# This file is (in principle) common to ALL GNU software.
|
# This file is (in principle) common to ALL GNU software.
|
||||||
# The presence of a machine in this file suggests that SOME GNU software
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
@ -32,13 +32,16 @@ timestamp='2009-04-17'
|
|||||||
|
|
||||||
|
|
||||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||||
# diff and a properly formatted ChangeLog entry.
|
# diff and a properly formatted GNU ChangeLog entry.
|
||||||
#
|
#
|
||||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||||
# Supply the specified configuration type as an argument.
|
# Supply the specified configuration type as an argument.
|
||||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||||
|
|
||||||
|
# You can get the latest version of this script from:
|
||||||
|
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||||
|
|
||||||
# This file is supposed to be the same for all GNU packages
|
# This file is supposed to be the same for all GNU packages
|
||||||
# and recognize all the CPU types, system types and aliases
|
# and recognize all the CPU types, system types and aliases
|
||||||
# that are meaningful with *any* GNU software.
|
# that are meaningful with *any* GNU software.
|
||||||
@ -72,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||||||
version="\
|
version="\
|
||||||
GNU config.sub ($timestamp)
|
GNU config.sub ($timestamp)
|
||||||
|
|
||||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
|
||||||
|
Software Foundation, Inc.
|
||||||
|
|
||||||
This is free software; see the source for copying conditions. There is NO
|
This is free software; see the source for copying conditions. There is NO
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||||
@ -120,8 +124,9 @@ esac
|
|||||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||||
case $maybe_os in
|
case $maybe_os in
|
||||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||||
|
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||||
kopensolaris*-gnu* | \
|
kopensolaris*-gnu* | \
|
||||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||||
os=-$maybe_os
|
os=-$maybe_os
|
||||||
@ -149,10 +154,13 @@ case $os in
|
|||||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||||
-apple | -axis | -knuth | -cray)
|
-apple | -axis | -knuth | -cray | -microblaze)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
;;
|
;;
|
||||||
|
-bluegene*)
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
-sim | -cisco | -oki | -wec | -winbond)
|
-sim | -cisco | -oki | -wec | -winbond)
|
||||||
os=
|
os=
|
||||||
basic_machine=$1
|
basic_machine=$1
|
||||||
@ -243,13 +251,17 @@ case $basic_machine in
|
|||||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||||
| am33_2.0 \
|
| am33_2.0 \
|
||||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||||
|
| be32 | be64 \
|
||||||
| bfin \
|
| bfin \
|
||||||
| c4x | clipper \
|
| c4x | clipper \
|
||||||
| d10v | d30v | dlx | dsp16xx \
|
| d10v | d30v | dlx | dsp16xx \
|
||||||
|
| epiphany \
|
||||||
| fido | fr30 | frv \
|
| fido | fr30 | frv \
|
||||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||||
|
| hexagon \
|
||||||
| i370 | i860 | i960 | ia64 \
|
| i370 | i860 | i960 | ia64 \
|
||||||
| ip2k | iq2000 \
|
| ip2k | iq2000 \
|
||||||
|
| le32 | le64 \
|
||||||
| lm32 \
|
| lm32 \
|
||||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||||
| maxq | mb | microblaze | mcore | mep | metag \
|
| maxq | mb | microblaze | mcore | mep | metag \
|
||||||
@ -275,26 +287,39 @@ case $basic_machine in
|
|||||||
| moxie \
|
| moxie \
|
||||||
| mt \
|
| mt \
|
||||||
| msp430 \
|
| msp430 \
|
||||||
|
| nds32 | nds32le | nds32be \
|
||||||
| nios | nios2 \
|
| nios | nios2 \
|
||||||
| ns16k | ns32k \
|
| ns16k | ns32k \
|
||||||
|
| open8 \
|
||||||
| or32 \
|
| or32 \
|
||||||
| pdp10 | pdp11 | pj | pjl \
|
| pdp10 | pdp11 | pj | pjl \
|
||||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||||
| pyramid \
|
| pyramid \
|
||||||
|
| rl78 | rx \
|
||||||
| score \
|
| score \
|
||||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||||
| sh64 | sh64le \
|
| sh64 | sh64le \
|
||||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||||
| spu | strongarm \
|
| spu \
|
||||||
| tahoe | thumb | tic4x | tic80 | tron \
|
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||||
| v850 | v850e \
|
| ubicom32 \
|
||||||
|
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||||
| we32k \
|
| we32k \
|
||||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
| x86 | xc16x | xstormy16 | xtensa \
|
||||||
| z8k | z80)
|
| z8k | z80)
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
;;
|
;;
|
||||||
m6811 | m68hc11 | m6812 | m68hc12)
|
c54x)
|
||||||
|
basic_machine=tic54x-unknown
|
||||||
|
;;
|
||||||
|
c55x)
|
||||||
|
basic_machine=tic55x-unknown
|
||||||
|
;;
|
||||||
|
c6x)
|
||||||
|
basic_machine=tic6x-unknown
|
||||||
|
;;
|
||||||
|
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||||
# Motorola 68HC11/12.
|
# Motorola 68HC11/12.
|
||||||
basic_machine=$basic_machine-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-none
|
os=-none
|
||||||
@ -305,6 +330,18 @@ case $basic_machine in
|
|||||||
basic_machine=mt-unknown
|
basic_machine=mt-unknown
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
strongarm | thumb | xscale)
|
||||||
|
basic_machine=arm-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
|
xscaleeb)
|
||||||
|
basic_machine=armeb-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
|
xscaleel)
|
||||||
|
basic_machine=armel-unknown
|
||||||
|
;;
|
||||||
|
|
||||||
# We use `pc' rather than `unknown'
|
# We use `pc' rather than `unknown'
|
||||||
# because (1) that's what they normally are, and
|
# because (1) that's what they normally are, and
|
||||||
# (2) the word "unknown" tends to confuse beginning users.
|
# (2) the word "unknown" tends to confuse beginning users.
|
||||||
@ -324,20 +361,23 @@ case $basic_machine in
|
|||||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||||
| avr-* | avr32-* \
|
| avr-* | avr32-* \
|
||||||
|
| be32-* | be64-* \
|
||||||
| bfin-* | bs2000-* \
|
| bfin-* | bs2000-* \
|
||||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||||
| clipper-* | craynv-* | cydra-* \
|
| clipper-* | craynv-* | cydra-* \
|
||||||
| d10v-* | d30v-* | dlx-* \
|
| d10v-* | d30v-* | dlx-* \
|
||||||
| elxsi-* \
|
| elxsi-* \
|
||||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||||
| h8300-* | h8500-* \
|
| h8300-* | h8500-* \
|
||||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||||
|
| hexagon-* \
|
||||||
| i*86-* | i860-* | i960-* | ia64-* \
|
| i*86-* | i860-* | i960-* | ia64-* \
|
||||||
| ip2k-* | iq2000-* \
|
| ip2k-* | iq2000-* \
|
||||||
|
| le32-* | le64-* \
|
||||||
| lm32-* \
|
| lm32-* \
|
||||||
| m32c-* | m32r-* | m32rle-* \
|
| m32c-* | m32r-* | m32rle-* \
|
||||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||||
| mips16-* \
|
| mips16-* \
|
||||||
| mips64-* | mips64el-* \
|
| mips64-* | mips64el-* \
|
||||||
@ -359,24 +399,29 @@ case $basic_machine in
|
|||||||
| mmix-* \
|
| mmix-* \
|
||||||
| mt-* \
|
| mt-* \
|
||||||
| msp430-* \
|
| msp430-* \
|
||||||
|
| nds32-* | nds32le-* | nds32be-* \
|
||||||
| nios-* | nios2-* \
|
| nios-* | nios2-* \
|
||||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||||
|
| open8-* \
|
||||||
| orion-* \
|
| orion-* \
|
||||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||||
| pyramid-* \
|
| pyramid-* \
|
||||||
| romp-* | rs6000-* \
|
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||||
| sparclite-* \
|
| sparclite-* \
|
||||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||||
| tahoe-* | thumb-* \
|
| tahoe-* \
|
||||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||||
|
| tile*-* \
|
||||||
| tron-* \
|
| tron-* \
|
||||||
| v850-* | v850e-* | vax-* \
|
| ubicom32-* \
|
||||||
|
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||||
|
| vax-* \
|
||||||
| we32k-* \
|
| we32k-* \
|
||||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||||
| xstormy16-* | xtensa*-* \
|
| xstormy16-* | xtensa*-* \
|
||||||
| ymp-* \
|
| ymp-* \
|
||||||
| z8k-* | z80-*)
|
| z8k-* | z80-*)
|
||||||
@ -467,6 +512,19 @@ case $basic_machine in
|
|||||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
os=-linux
|
os=-linux
|
||||||
;;
|
;;
|
||||||
|
bluegene*)
|
||||||
|
basic_machine=powerpc-ibm
|
||||||
|
os=-cnk
|
||||||
|
;;
|
||||||
|
c54x-*)
|
||||||
|
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c55x-*)
|
||||||
|
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
c6x-*)
|
||||||
|
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
c90)
|
c90)
|
||||||
basic_machine=c90-cray
|
basic_machine=c90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
@ -503,7 +561,7 @@ case $basic_machine in
|
|||||||
basic_machine=craynv-cray
|
basic_machine=craynv-cray
|
||||||
os=-unicosmp
|
os=-unicosmp
|
||||||
;;
|
;;
|
||||||
cr16)
|
cr16 | cr16-*)
|
||||||
basic_machine=cr16-unknown
|
basic_machine=cr16-unknown
|
||||||
os=-elf
|
os=-elf
|
||||||
;;
|
;;
|
||||||
@ -719,6 +777,9 @@ case $basic_machine in
|
|||||||
basic_machine=ns32k-utek
|
basic_machine=ns32k-utek
|
||||||
os=-sysv
|
os=-sysv
|
||||||
;;
|
;;
|
||||||
|
microblaze)
|
||||||
|
basic_machine=microblaze-xilinx
|
||||||
|
;;
|
||||||
mingw32)
|
mingw32)
|
||||||
basic_machine=i386-pc
|
basic_machine=i386-pc
|
||||||
os=-mingw32
|
os=-mingw32
|
||||||
@ -755,10 +816,18 @@ case $basic_machine in
|
|||||||
ms1-*)
|
ms1-*)
|
||||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||||
;;
|
;;
|
||||||
|
msys)
|
||||||
|
basic_machine=i386-pc
|
||||||
|
os=-msys
|
||||||
|
;;
|
||||||
mvs)
|
mvs)
|
||||||
basic_machine=i370-ibm
|
basic_machine=i370-ibm
|
||||||
os=-mvs
|
os=-mvs
|
||||||
;;
|
;;
|
||||||
|
nacl)
|
||||||
|
basic_machine=le32-unknown
|
||||||
|
os=-nacl
|
||||||
|
;;
|
||||||
ncr3000)
|
ncr3000)
|
||||||
basic_machine=i486-ncr
|
basic_machine=i486-ncr
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
@ -823,6 +892,12 @@ case $basic_machine in
|
|||||||
np1)
|
np1)
|
||||||
basic_machine=np1-gould
|
basic_machine=np1-gould
|
||||||
;;
|
;;
|
||||||
|
neo-tandem)
|
||||||
|
basic_machine=neo-tandem
|
||||||
|
;;
|
||||||
|
nse-tandem)
|
||||||
|
basic_machine=nse-tandem
|
||||||
|
;;
|
||||||
nsr-tandem)
|
nsr-tandem)
|
||||||
basic_machine=nsr-tandem
|
basic_machine=nsr-tandem
|
||||||
;;
|
;;
|
||||||
@ -905,9 +980,10 @@ case $basic_machine in
|
|||||||
;;
|
;;
|
||||||
power) basic_machine=power-ibm
|
power) basic_machine=power-ibm
|
||||||
;;
|
;;
|
||||||
ppc) basic_machine=powerpc-unknown
|
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||||
;;
|
;;
|
||||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
ppc-* | ppcbe-*)
|
||||||
|
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
;;
|
;;
|
||||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||||
basic_machine=powerpcle-unknown
|
basic_machine=powerpcle-unknown
|
||||||
@ -1001,6 +1077,9 @@ case $basic_machine in
|
|||||||
basic_machine=i860-stratus
|
basic_machine=i860-stratus
|
||||||
os=-sysv4
|
os=-sysv4
|
||||||
;;
|
;;
|
||||||
|
strongarm-* | thumb-*)
|
||||||
|
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
sun2)
|
sun2)
|
||||||
basic_machine=m68000-sun
|
basic_machine=m68000-sun
|
||||||
;;
|
;;
|
||||||
@ -1057,20 +1136,8 @@ case $basic_machine in
|
|||||||
basic_machine=t90-cray
|
basic_machine=t90-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
;;
|
;;
|
||||||
tic54x | c54x*)
|
|
||||||
basic_machine=tic54x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic55x | c55x*)
|
|
||||||
basic_machine=tic55x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tic6x | c6x*)
|
|
||||||
basic_machine=tic6x-unknown
|
|
||||||
os=-coff
|
|
||||||
;;
|
|
||||||
tile*)
|
tile*)
|
||||||
basic_machine=tile-unknown
|
basic_machine=$basic_machine-unknown
|
||||||
os=-linux-gnu
|
os=-linux-gnu
|
||||||
;;
|
;;
|
||||||
tx39)
|
tx39)
|
||||||
@ -1140,6 +1207,9 @@ case $basic_machine in
|
|||||||
xps | xps100)
|
xps | xps100)
|
||||||
basic_machine=xps100-honeywell
|
basic_machine=xps100-honeywell
|
||||||
;;
|
;;
|
||||||
|
xscale-* | xscalee[bl]-*)
|
||||||
|
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||||
|
;;
|
||||||
ymp)
|
ymp)
|
||||||
basic_machine=ymp-cray
|
basic_machine=ymp-cray
|
||||||
os=-unicos
|
os=-unicos
|
||||||
@ -1240,6 +1310,9 @@ case $os in
|
|||||||
# First match some system type aliases
|
# First match some system type aliases
|
||||||
# that might get confused with valid system types.
|
# that might get confused with valid system types.
|
||||||
# -solaris* is a basic system type, with this one exception.
|
# -solaris* is a basic system type, with this one exception.
|
||||||
|
-auroraux)
|
||||||
|
os=-auroraux
|
||||||
|
;;
|
||||||
-solaris1 | -solaris1.*)
|
-solaris1 | -solaris1.*)
|
||||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||||
;;
|
;;
|
||||||
@ -1260,9 +1333,9 @@ case $os in
|
|||||||
# Each alternative MUST END IN A *, to match a version number.
|
# Each alternative MUST END IN A *, to match a version number.
|
||||||
# -sysv* is not here because it comes later, after sysvr4.
|
# -sysv* is not here because it comes later, after sysvr4.
|
||||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||||
| -kopensolaris* \
|
| -sym* | -kopensolaris* \
|
||||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||||
| -aos* | -aros* \
|
| -aos* | -aros* \
|
||||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||||
@ -1274,8 +1347,9 @@ case $os in
|
|||||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
| -mingw32* | -linux-gnu* | -linux-android* \
|
||||||
|
| -linux-newlib* | -linux-uclibc* \
|
||||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||||
@ -1283,7 +1357,7 @@ case $os in
|
|||||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||||
# Remember, each alternative MUST END IN *, to match a version number.
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
;;
|
;;
|
||||||
-qnx*)
|
-qnx*)
|
||||||
@ -1416,6 +1490,8 @@ case $os in
|
|||||||
-dicos*)
|
-dicos*)
|
||||||
os=-dicos
|
os=-dicos
|
||||||
;;
|
;;
|
||||||
|
-nacl*)
|
||||||
|
;;
|
||||||
-none)
|
-none)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -1456,6 +1532,15 @@ case $basic_machine in
|
|||||||
c4x-* | tic4x-*)
|
c4x-* | tic4x-*)
|
||||||
os=-coff
|
os=-coff
|
||||||
;;
|
;;
|
||||||
|
tic54x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic55x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
|
tic6x-*)
|
||||||
|
os=-coff
|
||||||
|
;;
|
||||||
# This must come before the *-dec entry.
|
# This must come before the *-dec entry.
|
||||||
pdp10-*)
|
pdp10-*)
|
||||||
os=-tops20
|
os=-tops20
|
||||||
@ -1613,7 +1698,7 @@ case $basic_machine in
|
|||||||
-sunos*)
|
-sunos*)
|
||||||
vendor=sun
|
vendor=sun
|
||||||
;;
|
;;
|
||||||
-aix*)
|
-cnk*|-aix*)
|
||||||
vendor=ibm
|
vendor=ibm
|
||||||
;;
|
;;
|
||||||
-beos*)
|
-beos*)
|
||||||
|
4060
jni/libpng/configure
vendored
@ -18,15 +18,15 @@ AC_PREREQ(2.59)
|
|||||||
|
|
||||||
dnl Version number stuff here:
|
dnl Version number stuff here:
|
||||||
|
|
||||||
AC_INIT([libpng], [1.2.46], [png-mng-implement@lists.sourceforge.net])
|
AC_INIT([libpng], [1.5.10], [png-mng-implement@lists.sourceforge.net])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
dnl stop configure from automagically running automake
|
dnl stop configure from automagically running automake
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
PNGLIB_VERSION=1.2.46
|
PNGLIB_VERSION=1.5.10
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=2
|
PNGLIB_MINOR=5
|
||||||
PNGLIB_RELEASE=46
|
PNGLIB_RELEASE=10
|
||||||
|
|
||||||
dnl End of version number stuff
|
dnl End of version number stuff
|
||||||
|
|
||||||
@ -34,15 +34,39 @@ AC_CONFIG_SRCDIR([pngget.c])
|
|||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
|
AC_LANG([C])
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
AM_PROG_AS
|
||||||
AC_PROG_LD
|
AC_PROG_LD
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_CHECK_TOOL(SED, sed, :)
|
AC_CHECK_TOOL(SED, sed, :)
|
||||||
AC_LIBTOOL_WIN32_DLL
|
AC_CHECK_TOOL(AWK, awk, :)
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_LIBTOOL
|
LT_INIT([win32-dll])
|
||||||
|
|
||||||
|
# On Solaris 10 and 12 CPP gets set to cc -E, however this still
|
||||||
|
# does some input parsing. We need strict ANSI-C style tokenization,
|
||||||
|
# check this:
|
||||||
|
AC_REQUIRE_CPP
|
||||||
|
AC_MSG_CHECKING([for a C preprocessor that does not parse its input])
|
||||||
|
AC_TRY_CPP([1.5.0 16BIT],
|
||||||
|
[DFNCPP="$CPP"],
|
||||||
|
[DFNCPP=""
|
||||||
|
sav_CPP="$CPP"
|
||||||
|
for CPP in "${CC-cc} -E" "${CC-cc} -E -traditional-cpp" "/lib/cpp" "cpp"; do
|
||||||
|
AC_TRY_CPP([1.5.0 16BIT],
|
||||||
|
[DFNCPP="$CPP"]
|
||||||
|
[break],,)
|
||||||
|
done
|
||||||
|
CPP="$sav_CPP"])
|
||||||
|
if test -n "$DFNCPP"; then
|
||||||
|
AC_MSG_RESULT([$DFNCPP])
|
||||||
|
AC_SUBST(DFNCPP)
|
||||||
|
else
|
||||||
|
AC_MSG_FAILURE([not found], 1)
|
||||||
|
fi
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
@ -52,34 +76,59 @@ AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
|
|||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
|
AC_C_RESTRICT
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_STRTOD
|
AC_FUNC_STRTOD
|
||||||
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
|
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
|
||||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
|
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
|
||||||
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
|
AC_ARG_WITH(zlib-prefix,
|
||||||
|
AC_HELP_STRING([--with-zlib-prefix],
|
||||||
|
[prefix that may have been used in installed zlib]),
|
||||||
|
[ZPREFIX=${withval}],
|
||||||
|
[ZPREFIX='z_'])
|
||||||
|
AC_CHECK_LIB(z, zlibVersion, ,
|
||||||
|
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, ,
|
||||||
|
AC_ERROR([zlib not installed])))
|
||||||
|
|
||||||
case $host_os in
|
# The following is for pngvalid, to ensure it catches FP errors even on
|
||||||
aix*)
|
# platforms that don't enable FP exceptions, the function appears in the math
|
||||||
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG -D_ALL_SOURCE;;
|
# library (typically), it's not an error if it is not found.
|
||||||
*)
|
AC_CHECK_LIB([m], [feenableexcept])
|
||||||
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG;;
|
AC_CHECK_FUNCS([feenableexcept])
|
||||||
esac
|
|
||||||
AC_MSG_CHECKING(
|
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
|
||||||
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
|
LIBPNG_DEFINES=$LIBPNG_DEFINES
|
||||||
AC_TRY_COMPILE(
|
|
||||||
[#include "$srcdir/pnggccrd.c"],
|
|
||||||
[return 0;],
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
LIBPNG_NO_MMX="",
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
LIBPNG_NO_MMX=-DPNG_NO_MMX_CODE)
|
|
||||||
LIBPNG_DEFINES=$LIBPNG_DEFINES\ $LIBPNG_NO_MMX
|
|
||||||
AC_SUBST(LIBPNG_DEFINES)
|
AC_SUBST(LIBPNG_DEFINES)
|
||||||
AC_SUBST(LIBPNG_NO_MMX)
|
|
||||||
|
AC_MSG_CHECKING([if using Solaris linker])
|
||||||
|
SLD=`$LD --version 2>&1 | grep Solaris`
|
||||||
|
if test "$SLD"; then
|
||||||
|
have_solaris_ld=yes
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
else
|
||||||
|
have_solaris_ld=no
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
fi
|
||||||
|
AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
|
||||||
|
|
||||||
AC_MSG_CHECKING([if libraries can be versioned])
|
AC_MSG_CHECKING([if libraries can be versioned])
|
||||||
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
# Special case for PE/COFF platforms: ld reports
|
||||||
|
# support for version-script, but doesn't actually
|
||||||
|
# DO anything with it.
|
||||||
|
case $host in
|
||||||
|
*cygwin* | *mingw32* | *interix* )
|
||||||
|
have_ld_version_script=no
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
|
||||||
|
if test "$have_solaris_ld" = "yes"; then
|
||||||
|
GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
|
||||||
|
else
|
||||||
|
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$GLD"; then
|
if test "$GLD"; then
|
||||||
have_ld_version_script=yes
|
have_ld_version_script=yes
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
@ -88,6 +137,9 @@ else
|
|||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
AC_MSG_WARN(*** You have not enabled versioned symbols.)
|
AC_MSG_WARN(*** You have not enabled versioned symbols.)
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
|
||||||
|
|
||||||
if test "$have_ld_version_script" = "yes"; then
|
if test "$have_ld_version_script" = "yes"; then
|
||||||
@ -131,23 +183,22 @@ AC_ARG_WITH(binconfigs,
|
|||||||
[binconfigs='${binconfigs}'])
|
[binconfigs='${binconfigs}'])
|
||||||
AC_SUBST([binconfigs])
|
AC_SUBST([binconfigs])
|
||||||
|
|
||||||
# Allow the old version number library, libpng.so, to be removed from
|
# Because GCC by default assembles code with an executable stack, even though it
|
||||||
# the build
|
# compiles C code with a non-executable stack, it is necessary to do a fixup
|
||||||
AC_ARG_WITH(libpng-compat,
|
# here (this may by GCC specific)
|
||||||
AC_HELP_STRING([--with-libpng-compat],
|
AC_SUBST([AM_CCASFLAGS], [-Wa,--noexecstack])
|
||||||
[Generate the obsolete libpng.so library @<:@default=yes@:>@]),
|
|
||||||
[if test "${withval}" = no; then
|
AC_ARG_ENABLE([arm-neon],
|
||||||
compatlib=
|
AC_HELP_STRING([--enable-arm-neon], [Enable ARM NEON optimizations]),
|
||||||
AC_MSG_NOTICE([libpng.so will not be built])
|
[if test "${enableval}" = yes; then
|
||||||
else
|
AC_DEFINE([PNG_ARM_NEON], [1], [Enable ARM NEON optimizations])
|
||||||
compatlib=libpng.la
|
AC_DEFINE([PNG_ALIGNED_MEMORY_SUPPORTED], [1], [Align row buffers])
|
||||||
fi],
|
fi])
|
||||||
[compatlib=libpng.la])
|
AM_CONDITIONAL([PNG_ARM_NEON], [test "${enable_arm_neon:-no}" = yes])
|
||||||
AC_SUBST([compatlib])
|
|
||||||
|
|
||||||
# Config files, substituting as above
|
# Config files, substituting as above
|
||||||
AC_CONFIG_FILES([Makefile libpng.pc:scripts/libpng.pc-configure.in])
|
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
|
||||||
AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in],
|
AC_CONFIG_FILES([libpng-config:libpng-config.in],
|
||||||
[chmod +x libpng-config])
|
[chmod +x libpng-config])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
4
jni/libpng/contrib/README.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
This "contrib" directory contains contributions which are not necessarily under
|
||||||
|
the libpng license, although all are open source. They are not part of
|
||||||
|
libpng proper and are not used for building the library.
|
@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
PNGINC = -I/usr/local/include/libpng12
|
PNGINC = -I/usr/local/include/libpng15
|
||||||
PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng
|
PNGLIB = -L/usr/local/lib -lpng15 # dynamically linked against libpng
|
||||||
#PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng
|
#PNGLIB = /usr/local/lib/libpng15.a # statically linked against libpng
|
||||||
# or:
|
# or:
|
||||||
#PNGINC = -I../..
|
#PNGINC = -I../..
|
||||||
#PNGLIB = -L../.. -lpng
|
#PNGLIB = -L../.. -lpng
|
||||||
|
@ -26,14 +26,14 @@
|
|||||||
# macros --------------------------------------------------------------------
|
# macros --------------------------------------------------------------------
|
||||||
|
|
||||||
#PNGDIR = /usr/local/lib
|
#PNGDIR = /usr/local/lib
|
||||||
#PNGINC = -I/usr/local/include/libpng12
|
#PNGINC = -I/usr/local/include/libpng15
|
||||||
#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
|
#PNGLIBd = -L$(PNGDIR) -lpng15 # dynamically linked, installed libpng
|
||||||
#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng
|
#PNGLIBs = $(PNGDIR)/libpng15.a # statically linked, installed libpng
|
||||||
# or:
|
# or:
|
||||||
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
|
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
|
||||||
#PNGDIR = ../libpng
|
#PNGDIR = ../libpng
|
||||||
PNGINC = -I$(PNGDIR)
|
PNGINC = -I$(PNGDIR)
|
||||||
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked
|
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng15 # dynamically linked
|
||||||
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
||||||
|
|
||||||
ZDIR = /usr/local/lib
|
ZDIR = /usr/local/lib
|
||||||
|
@ -165,7 +165,7 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
|
|||||||
rpng is a simple PNG viewer that can display transparent PNGs with a
|
rpng is a simple PNG viewer that can display transparent PNGs with a
|
||||||
specified background color; for example,
|
specified background color; for example,
|
||||||
|
|
||||||
rpng -bgcolor #ff0000 toucan.png
|
rpng -bgcolor \#ff0000 toucan.png
|
||||||
|
|
||||||
would display the image with a red background. rpng2 is a progressive
|
would display the image with a red background. rpng2 is a progressive
|
||||||
viewer that simulates a web browser in some respects; it can display
|
viewer that simulates a web browser in some respects; it can display
|
||||||
|
@ -229,8 +229,14 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
|||||||
png_set_expand(png_ptr);
|
png_set_expand(png_ptr);
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
png_set_expand(png_ptr);
|
png_set_expand(png_ptr);
|
||||||
|
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
|
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||||
|
png_set_scale_16(png_ptr);
|
||||||
|
# else
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
png_set_gray_to_rgb(png_ptr);
|
png_set_gray_to_rgb(png_ptr);
|
||||||
@ -263,7 +269,8 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height));
|
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n",
|
||||||
|
*pChannels, rowbytes, height));
|
||||||
|
|
||||||
|
|
||||||
/* set the individual row_pointers to point at the correct offsets */
|
/* set the individual row_pointers to point at the correct offsets */
|
||||||
|
@ -55,8 +55,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdlib.h> /* for exit() prototype */
|
#include <stdlib.h> /* for exit() prototype */
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
|
#include <zlib.h>
|
||||||
|
#include "png.h" /* libpng header from the local directory */
|
||||||
#include "readpng2.h" /* typedefs, common macros, public prototypes */
|
#include "readpng2.h" /* typedefs, common macros, public prototypes */
|
||||||
|
|
||||||
|
|
||||||
@ -73,84 +75,10 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
|
|||||||
|
|
||||||
void readpng2_version_info(void)
|
void readpng2_version_info(void)
|
||||||
{
|
{
|
||||||
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
|
fprintf(stderr, " Compiled with libpng %s; using libpng %s\n",
|
||||||
(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
||||||
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
/*
|
|
||||||
* WARNING: This preprocessor approach means that the following code
|
|
||||||
* cannot be used with a libpng DLL older than 1.2.0--the
|
|
||||||
* compiled-in symbols for the new functions will not exist.
|
|
||||||
* (Could use dlopen() and dlsym() on Unix and corresponding
|
|
||||||
* calls for Windows, but not portable...)
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
int mmxsupport = png_mmx_support();
|
|
||||||
if (mmxsupport < 0)
|
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
|
||||||
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
|
||||||
else {
|
|
||||||
int compilerID;
|
|
||||||
png_uint_32 mmx_mask = png_get_mmx_flagmask(
|
|
||||||
PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
|
||||||
|
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
fprintf(stderr, " and with zlib %s; using zlib %s.\n",
|
||||||
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
|
|
||||||
png_libpng_ver, compilerID == 1? "MSVC++" :
|
|
||||||
(compilerID == 2? "GNU C" : "unknown"));
|
|
||||||
fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
|
|
||||||
#if defined(__x86_64__)
|
|
||||||
"_64",
|
|
||||||
#else
|
|
||||||
"",
|
|
||||||
#endif
|
|
||||||
mmxsupport? "supports" : "does not support");
|
|
||||||
if (mmxsupport > 0) {
|
|
||||||
int num_optims = 0;
|
|
||||||
|
|
||||||
fprintf(stderr,
|
|
||||||
" Potential MMX optimizations supported by libpng:\n");
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)
|
|
||||||
++num_optims;
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_UP)
|
|
||||||
++num_optims;
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)
|
|
||||||
++num_optims;
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)
|
|
||||||
++num_optims;
|
|
||||||
if (num_optims)
|
|
||||||
fprintf(stderr,
|
|
||||||
" decoding %s row filters (reading)\n",
|
|
||||||
(num_optims == 4)? "all non-trivial" : "some");
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) {
|
|
||||||
fprintf(stderr, " combining rows (reading)\n");
|
|
||||||
++num_optims;
|
|
||||||
}
|
|
||||||
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_INTERLACE) {
|
|
||||||
fprintf(stderr,
|
|
||||||
" expanding interlacing (reading)\n");
|
|
||||||
++num_optims;
|
|
||||||
}
|
|
||||||
mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
|
||||||
if (mmx_mask) {
|
|
||||||
fprintf(stderr, " other (unknown)\n");
|
|
||||||
++num_optims;
|
|
||||||
}
|
|
||||||
if (num_optims == 0)
|
|
||||||
fprintf(stderr, " (none)\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
|
|
||||||
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
|
|
||||||
ZLIB_VERSION, zlib_version);
|
ZLIB_VERSION, zlib_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +131,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
/* prepare the reader to ignore all recognized chunks whose data won't be
|
/* prepare the reader to ignore all recognized chunks whose data won't be
|
||||||
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
|
* used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT,
|
||||||
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
|
* IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */
|
||||||
@ -212,7 +140,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
* version recognizes more chunks, add them to this list. If a
|
* version recognizes more chunks, add them to this list. If a
|
||||||
* future version of readpng2.c recognizes more chunks, delete them
|
* future version of readpng2.c recognizes more chunks, delete them
|
||||||
* from this list. */
|
* from this list. */
|
||||||
static const png_byte chunks_to_ignore[] = {
|
static /* const */ png_byte chunks_to_ignore[] = {
|
||||||
99, 72, 82, 77, '\0', /* cHRM */
|
99, 72, 82, 77, '\0', /* cHRM */
|
||||||
104, 73, 83, 84, '\0', /* hIST */
|
104, 73, 83, 84, '\0', /* hIST */
|
||||||
105, 67, 67, 80, '\0', /* iCCP */
|
105, 67, 67, 80, '\0', /* iCCP */
|
||||||
@ -232,7 +160,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
|
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
|
||||||
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
|
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
|
||||||
}
|
}
|
||||||
#endif /* PNG_UNKNOWN_CHUNKS_SUPPORTED */
|
#endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
/* instead of doing png_init_io() here, now we set up our callback
|
/* instead of doing png_init_io() here, now we set up our callback
|
||||||
@ -242,96 +170,6 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
|||||||
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* may as well enable or disable MMX routines here, if supported;
|
|
||||||
*
|
|
||||||
* to enable all: mask = png_get_mmx_flagmask (
|
|
||||||
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
|
||||||
* flags = png_get_asm_flags (png_ptr);
|
|
||||||
* flags |= mask;
|
|
||||||
* png_set_asm_flags (png_ptr, flags);
|
|
||||||
*
|
|
||||||
* to disable all: mask = png_get_mmx_flagmask (
|
|
||||||
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
|
|
||||||
* flags = png_get_asm_flags (png_ptr);
|
|
||||||
* flags &= ~mask;
|
|
||||||
* png_set_asm_flags (png_ptr, flags);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
|
||||||
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
|
|
||||||
/*
|
|
||||||
* WARNING: This preprocessor approach means that the following code
|
|
||||||
* cannot be used with a libpng DLL older than 1.2.0--the
|
|
||||||
* compiled-in symbols for the new functions will not exist.
|
|
||||||
* (Could use dlopen() and dlsym() on Unix and corresponding
|
|
||||||
* calls for Windows, but not portable...)
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
|
||||||
png_uint_32 mmx_disable_mask = 0;
|
|
||||||
png_uint_32 asm_flags, mmx_mask;
|
|
||||||
int compilerID;
|
|
||||||
|
|
||||||
if (mainprog_ptr->nommxfilters)
|
|
||||||
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
|
|
||||||
if (mainprog_ptr->nommxcombine)
|
|
||||||
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW;
|
|
||||||
if (mainprog_ptr->nommxinterlace)
|
|
||||||
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_INTERLACE;
|
|
||||||
asm_flags = png_get_asm_flags(png_ptr);
|
|
||||||
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
|
|
||||||
|
|
||||||
|
|
||||||
/* Now query libpng's asm settings, just for yuks. Note that this
|
|
||||||
* differs from the querying of its *potential* MMX capabilities
|
|
||||||
* in readpng2_version_info(); this is true runtime verification. */
|
|
||||||
|
|
||||||
asm_flags = png_get_asm_flags(png_ptr);
|
|
||||||
mmx_mask = png_get_mmx_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE,
|
|
||||||
&compilerID);
|
|
||||||
if (asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED)
|
|
||||||
fprintf(stderr,
|
|
||||||
" MMX support (%s version) is compiled into libpng\n",
|
|
||||||
compilerID == 1? "MSVC++" :
|
|
||||||
(compilerID == 2? "GNU C" : "unknown"));
|
|
||||||
else
|
|
||||||
fprintf(stderr, " MMX support is not compiled into libpng\n");
|
|
||||||
fprintf(stderr, " MMX instructions are %ssupported by CPU\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)? "" : "not ");
|
|
||||||
fprintf(stderr, " MMX read support for combining rows is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)? "en" : "dis");
|
|
||||||
fprintf(stderr,
|
|
||||||
" MMX read support for expanding interlacing is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"sub\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"up\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"avg\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "en" : "dis");
|
|
||||||
fprintf(stderr, " MMX read support for \"Paeth\" filter is %sabled\n",
|
|
||||||
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "en" : "dis");
|
|
||||||
asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
|
|
||||||
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ));
|
|
||||||
if (asm_flags)
|
|
||||||
fprintf(stderr,
|
|
||||||
" additional MMX support is also enabled (0x%02lx)\n",
|
|
||||||
asm_flags);
|
|
||||||
#else /* !PNG_ASSEMBLER_CODE_SUPPORTED */
|
|
||||||
fprintf(stderr, " MMX querying is disabled in libpng.\n");
|
|
||||||
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* make sure we save our pointers for use in readpng2_decode_data() */
|
/* make sure we save our pointers for use in readpng2_decode_data() */
|
||||||
|
|
||||||
mainprog_ptr->png_ptr = png_ptr;
|
mainprog_ptr->png_ptr = png_ptr;
|
||||||
@ -380,7 +218,11 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
mainprog_info *mainprog_ptr;
|
mainprog_info *mainprog_ptr;
|
||||||
int color_type, bit_depth;
|
int color_type, bit_depth;
|
||||||
png_uint_32 width, height;
|
png_uint_32 width, height;
|
||||||
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
double gamma;
|
double gamma;
|
||||||
|
#else
|
||||||
|
png_fixed_point gamma;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
/* setjmp() doesn't make sense here, because we'd either have to exit(),
|
||||||
@ -469,8 +311,14 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_set_expand(png_ptr);
|
png_set_expand(png_ptr);
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
png_set_expand(png_ptr);
|
png_set_expand(png_ptr);
|
||||||
|
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
|
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||||
|
png_set_scale_16(png_ptr);
|
||||||
|
# else
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
png_set_gray_to_rgb(png_ptr);
|
png_set_gray_to_rgb(png_ptr);
|
||||||
@ -491,11 +339,19 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
|
|||||||
* "gamma" value for the entire display system, i.e., the product of
|
* "gamma" value for the entire display system, i.e., the product of
|
||||||
* LUT_exponent and CRT_exponent. */
|
* LUT_exponent and CRT_exponent. */
|
||||||
|
|
||||||
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &gamma))
|
||||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, gamma);
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
|
png_set_gamma(png_ptr, mainprog_ptr->display_exponent, 0.45455);
|
||||||
|
#else
|
||||||
|
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
|
||||||
|
png_set_gamma_fixed(png_ptr,
|
||||||
|
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
|
||||||
|
else
|
||||||
|
png_set_gamma_fixed(png_ptr,
|
||||||
|
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* we'll let libpng expand interlaced images, too */
|
/* we'll let libpng expand interlaced images, too */
|
||||||
|
|
||||||
@ -644,5 +500,12 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)
|
|||||||
exit(99);
|
exit(99);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now we have our data structure we can use the information in it
|
||||||
|
* to return control to our own higher level code (all the points
|
||||||
|
* where 'setjmp' is called in this file.) This will work with other
|
||||||
|
* error handling mechanisms as well - libpng always calls png_error
|
||||||
|
* when it can proceed no further, thus, so long as the error handler
|
||||||
|
* is intercepted, application code can do its own error recovery.
|
||||||
|
*/
|
||||||
longjmp(mainprog_ptr->jmpbuf, 1);
|
longjmp(mainprog_ptr->jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
@ -96,11 +96,6 @@ typedef struct _mainprog_info {
|
|||||||
int rowbytes;
|
int rowbytes;
|
||||||
int channels;
|
int channels;
|
||||||
int need_bgcolor;
|
int need_bgcolor;
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
int nommxfilters;
|
|
||||||
int nommxcombine;
|
|
||||||
int nommxinterlace;
|
|
||||||
#endif
|
|
||||||
int state;
|
int state;
|
||||||
uch bg_red;
|
uch bg_red;
|
||||||
uch bg_green;
|
uch bg_green;
|
||||||
|
@ -85,7 +85,33 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
/* getch replacement. Turns out, we don't really need this,
|
||||||
|
* but leave it here if we ever enable any of the uses of
|
||||||
|
* _getch in the main code
|
||||||
|
*/
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <termio.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
int repl_getch( void )
|
||||||
|
{
|
||||||
|
char ch;
|
||||||
|
int fd = fileno(stdin);
|
||||||
|
struct termio old_tty, new_tty;
|
||||||
|
|
||||||
|
ioctl(fd, TCGETA, &old_tty);
|
||||||
|
new_tty = old_tty;
|
||||||
|
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
|
||||||
|
ioctl(fd, TCSETA, &new_tty);
|
||||||
|
fread(&ch, 1, sizeof(ch), stdin);
|
||||||
|
ioctl(fd, TCSETA, &old_tty);
|
||||||
|
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
#define _getch repl_getch
|
||||||
|
#else
|
||||||
#include <conio.h> /* only for _getch() */
|
#include <conio.h> /* only for _getch() */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* #define DEBUG : this enables the Trace() macros */
|
/* #define DEBUG : this enables the Trace() macros */
|
||||||
|
|
||||||
@ -153,7 +179,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
|
|
||||||
filename = (char *)NULL;
|
filename = (char *)NULL;
|
||||||
|
|
||||||
|
#ifndef __CYGWIN__
|
||||||
/* First reenable console output, which normally goes to the bit bucket
|
/* First reenable console output, which normally goes to the bit bucket
|
||||||
* for windowed apps. Closing the console window will terminate the
|
* for windowed apps. Closing the console window will terminate the
|
||||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||||
@ -162,6 +188,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
AllocConsole();
|
AllocConsole();
|
||||||
freopen("CONOUT$", "a", stderr);
|
freopen("CONOUT$", "a", stderr);
|
||||||
freopen("CONOUT$", "a", stdout);
|
freopen("CONOUT$", "a", stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Next set the default value for our display-system exponent, i.e.,
|
/* Next set the default value for our display-system exponent, i.e.,
|
||||||
@ -279,7 +306,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
/* print usage screen if any errors up to this point */
|
/* print usage screen if any errors up to this point */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
#ifndef __CYGWIN__
|
||||||
int ch;
|
int ch;
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
readpng_version_info();
|
readpng_version_info();
|
||||||
@ -293,11 +322,15 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||||
"\t\t used with transparent images\n"
|
"\t\t used with transparent images\n"
|
||||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||||
|
#ifndef __CYGWIN__
|
||||||
"Press Q or Esc to quit this usage screen.\n"
|
"Press Q or Esc to quit this usage screen.\n"
|
||||||
|
#endif
|
||||||
"\n", PROGNAME, default_display_exponent);
|
"\n", PROGNAME, default_display_exponent);
|
||||||
|
#ifndef __CYGWIN__
|
||||||
do
|
do
|
||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,18 +366,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
#ifndef __CYGWIN__
|
||||||
int ch;
|
int ch;
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||||
|
#ifndef __CYGWIN__
|
||||||
do
|
do
|
||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
|
#endif
|
||||||
exit(2);
|
exit(2);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
|
#ifndef __CYGWIN__
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\n [console window: closing this window will terminate %s]\n\n",
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
PROGNAME);
|
PROGNAME);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -417,7 +456,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
/* wait for the user to tell us when to quit */
|
/* wait for the user to tell us when to quit */
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
#ifndef __CYGWIN__
|
||||||
|
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
|
||||||
|
#else
|
||||||
|
"Done. Press mouse button 1 (within image window) to quit.\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
- 2.01: fixed 64-bit typo in readpng2.c
|
- 2.01: fixed 64-bit typo in readpng2.c
|
||||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
||||||
unexpected-EOF and file-read-error cases
|
unexpected-EOF and file-read-error cases
|
||||||
|
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -95,7 +96,33 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <math.h> /* only for PvdM background code */
|
#include <math.h> /* only for PvdM background code */
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
/* getch replacement. Turns out, we don't really need this,
|
||||||
|
* but leave it here if we ever enable any of the uses of
|
||||||
|
* _getch in the main code
|
||||||
|
*/
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <termio.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
int repl_getch( void )
|
||||||
|
{
|
||||||
|
char ch;
|
||||||
|
int fd = fileno(stdin);
|
||||||
|
struct termio old_tty, new_tty;
|
||||||
|
|
||||||
|
ioctl(fd, TCGETA, &old_tty);
|
||||||
|
new_tty = old_tty;
|
||||||
|
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
|
||||||
|
ioctl(fd, TCSETA, &new_tty);
|
||||||
|
fread(&ch, 1, sizeof(ch), stdin);
|
||||||
|
ioctl(fd, TCSETA, &old_tty);
|
||||||
|
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
#define _getch repl_getch
|
||||||
|
#else
|
||||||
#include <conio.h> /* only for _getch() */
|
#include <conio.h> /* only for _getch() */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* all for PvdM background code: */
|
/* all for PvdM background code: */
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
@ -269,7 +296,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
filename = (char *)NULL;
|
filename = (char *)NULL;
|
||||||
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
memset(&rpng2_info, 0, sizeof(mainprog_info));
|
||||||
|
|
||||||
|
#ifndef __CYGWIN__
|
||||||
/* Next reenable console output, which normally goes to the bit bucket
|
/* Next reenable console output, which normally goes to the bit bucket
|
||||||
* for windowed apps. Closing the console window will terminate the
|
* for windowed apps. Closing the console window will terminate the
|
||||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||||
@ -278,7 +305,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
AllocConsole();
|
AllocConsole();
|
||||||
freopen("CONOUT$", "a", stderr);
|
freopen("CONOUT$", "a", stderr);
|
||||||
freopen("CONOUT$", "a", stdout);
|
freopen("CONOUT$", "a", stdout);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the default value for our display-system exponent, i.e., the
|
/* Set the default value for our display-system exponent, i.e., the
|
||||||
* product of the CRT exponent and the exponent corresponding to
|
* product of the CRT exponent and the exponent corresponding to
|
||||||
@ -395,18 +422,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
}
|
}
|
||||||
} else if (!strncmp(*argv, "-timing", 2)) {
|
} else if (!strncmp(*argv, "-timing", 2)) {
|
||||||
timing = TRUE;
|
timing = TRUE;
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
} else if (!strcmp(*argv, "-nommx")) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
filename = *argv;
|
filename = *argv;
|
||||||
@ -424,15 +439,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
/* print usage screen if any errors up to this point */
|
/* print usage screen if any errors up to this point */
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
#ifndef __CYGWIN__
|
||||||
int ch;
|
int ch;
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
|
||||||
#endif
|
|
||||||
" %*s file.png\n\n"
|
" %*s file.png\n\n"
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||||
@ -445,21 +459,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
"\t\t transparent images; overrides -bgcolor option\n"
|
"\t\t transparent images; overrides -bgcolor option\n"
|
||||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||||
"\t\t download of image (~36 Kbps)\n"
|
"\t\t download of image (~36 Kbps)\n"
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
|
||||||
"\t\t combining rows, and expanding interlacing, respectively\n"
|
|
||||||
#endif
|
|
||||||
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
|
||||||
|
#ifndef __CYGWIN__
|
||||||
"Press Q or Esc to quit this usage screen. ",
|
"Press Q or Esc to quit this usage screen. ",
|
||||||
|
#else
|
||||||
|
,
|
||||||
|
#endif
|
||||||
PROGNAME,
|
PROGNAME,
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
|
||||||
|
!(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||||
(int)strlen(PROGNAME), " ",
|
(int)strlen(PROGNAME), " ",
|
||||||
#endif
|
#endif
|
||||||
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
#ifndef __CYGWIN__
|
||||||
do
|
do
|
||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,18 +513,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
#ifndef __CYGWIN__
|
||||||
int ch;
|
int ch;
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, PROGNAME ": aborting.\n");
|
fprintf(stderr, PROGNAME ": aborting.\n");
|
||||||
|
#ifndef __CYGWIN__
|
||||||
do
|
do
|
||||||
ch = _getch();
|
ch = _getch();
|
||||||
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
|
||||||
|
#endif
|
||||||
exit(2);
|
exit(2);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
|
||||||
|
#ifndef __CYGWIN__
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"\n [console window: closing this window will terminate %s]\n\n",
|
"\n [console window: closing this window will terminate %s]\n\n",
|
||||||
PROGNAME);
|
PROGNAME);
|
||||||
|
#endif
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +590,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
|||||||
"(unexpectedly) while reading PNG image file\n");
|
"(unexpectedly) while reading PNG image file\n");
|
||||||
exit(3);
|
exit(3);
|
||||||
} else /* if (error) */ {
|
} else /* if (error) */ {
|
||||||
// will print error message below
|
/* will print error message below */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1150,7 +1173,12 @@ static void rpng2_win_finish_display()
|
|||||||
|
|
||||||
rpng2_info.state = kDone;
|
rpng2_info.state = kDone;
|
||||||
printf(
|
printf(
|
||||||
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
|
#ifndef __CYGWIN__
|
||||||
|
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
|
||||||
|
#else
|
||||||
|
"Done. Press mouse button 1 (within image window) to quit.\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
||||||
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
||||||
paste bugs
|
paste bugs
|
||||||
|
- 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -94,7 +95,7 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng2-x"
|
#define PROGNAME "rpng2-x"
|
||||||
#define LONGNAME "Progressive PNG Viewer for X"
|
#define LONGNAME "Progressive PNG Viewer for X"
|
||||||
#define VERSION "2.02 of 16 March 2008"
|
#define VERSION "2.03 of 25 February 2010"
|
||||||
#define RESNAME "rpng2" /* our X resource application name */
|
#define RESNAME "rpng2" /* our X resource application name */
|
||||||
#define RESCLASS "Rpng" /* our X resource class name */
|
#define RESCLASS "Rpng" /* our X resource class name */
|
||||||
|
|
||||||
@ -434,18 +435,6 @@ int main(int argc, char **argv)
|
|||||||
else if (loop_interval > 100000) /* bit more than one day */
|
else if (loop_interval > 100000) /* bit more than one day */
|
||||||
loop_interval = 100000;
|
loop_interval = 100000;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
} else if (!strcmp(*argv, "-nommx")) {
|
|
||||||
rpng2_info.nommxfilters = TRUE;
|
|
||||||
rpng2_info.nommxcombine = TRUE;
|
|
||||||
rpng2_info.nommxinterlace = TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (**argv != '-') {
|
if (**argv != '-') {
|
||||||
@ -468,9 +457,6 @@ int main(int argc, char **argv)
|
|||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
fprintf(stderr, "\n"
|
||||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
|
|
||||||
#endif
|
|
||||||
#ifdef FEATURE_LOOP
|
#ifdef FEATURE_LOOP
|
||||||
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
||||||
#else
|
#else
|
||||||
@ -490,10 +476,6 @@ int main(int argc, char **argv)
|
|||||||
" -loop\tloops through background images after initial display\n"
|
" -loop\tloops through background images after initial display\n"
|
||||||
"\t\t is complete (depends on -bgpat)\n"
|
"\t\t is complete (depends on -bgpat)\n"
|
||||||
" sec \tseconds to display each background image (default = 2)\n"
|
" sec \tseconds to display each background image (default = 2)\n"
|
||||||
#endif
|
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
|
|
||||||
"\t\t combining rows, and expanding interlacing, respectively\n"
|
|
||||||
#endif
|
#endif
|
||||||
" dur \tduration in microseconds to wait after displaying each\n"
|
" dur \tduration in microseconds to wait after displaying each\n"
|
||||||
"\t\t row (for demo purposes)\n"
|
"\t\t row (for demo purposes)\n"
|
||||||
@ -503,9 +485,6 @@ int main(int argc, char **argv)
|
|||||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||||
"is displayed) to quit.\n"
|
"is displayed) to quit.\n"
|
||||||
"\n", PROGNAME,
|
"\n", PROGNAME,
|
||||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
|
||||||
(int)strlen(PROGNAME), " ",
|
|
||||||
#endif
|
|
||||||
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
|
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -612,7 +591,7 @@ int main(int argc, char **argv)
|
|||||||
"(unexpectedly) while reading PNG image file\n");
|
"(unexpectedly) while reading PNG image file\n");
|
||||||
exit(3);
|
exit(3);
|
||||||
} else /* if (error) */ {
|
} else /* if (error) */ {
|
||||||
// will print error message below
|
/* will print error message below */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -802,8 +781,9 @@ static void rpng2_x_init(void)
|
|||||||
if (rpng2_x_create_window()) {
|
if (rpng2_x_create_window()) {
|
||||||
|
|
||||||
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
||||||
* above; libpng should longjmp() back to us when png_ptr goes away.
|
* above; libpng should call our error handler to longjmp() back to us
|
||||||
* If we/it segfault instead, seems like a libpng bug... */
|
* when png_ptr goes away. If we/it segfault instead, seems like a
|
||||||
|
* libpng bug... */
|
||||||
|
|
||||||
/* we're here via libpng callback, so if window fails, clean and bail */
|
/* we're here via libpng callback, so if window fails, clean and bail */
|
||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
|
@ -104,7 +104,8 @@ int writepng_init(mainprog_info *mainprog_ptr)
|
|||||||
/* setjmp() must be called in every function that calls a PNG-writing
|
/* setjmp() must be called in every function that calls a PNG-writing
|
||||||
* libpng function, unless an alternate error handler was installed--
|
* libpng function, unless an alternate error handler was installed--
|
||||||
* but compatible error handlers must either use longjmp() themselves
|
* but compatible error handlers must either use longjmp() themselves
|
||||||
* (as in this program) or exit immediately, so here we go: */
|
* (as in this program) or some other method to return control to
|
||||||
|
* application code, so here we go: */
|
||||||
|
|
||||||
if (setjmp(mainprog_ptr->jmpbuf)) {
|
if (setjmp(mainprog_ptr->jmpbuf)) {
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
@ -388,5 +389,12 @@ static void writepng_error_handler(png_structp png_ptr, png_const_charp msg)
|
|||||||
exit(99);
|
exit(99);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now we have our data structure we can use the information in it
|
||||||
|
* to return control to our own higher level code (all the points
|
||||||
|
* where 'setjmp' is called in this file.) This will work with other
|
||||||
|
* error handling mechanisms as well - libpng always calls png_error
|
||||||
|
* when it can proceed no further, thus, so long as the error handler
|
||||||
|
* is intercepted, application code can do its own error recovery.
|
||||||
|
*/
|
||||||
longjmp(mainprog_ptr->jmpbuf, 1);
|
longjmp(mainprog_ptr->jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
9837
jni/libpng/contrib/libtests/pngvalid.c
Normal file
4
jni/libpng/contrib/pngminim/README
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
|
||||||
|
to build minimal decoder, encoder, and progressive reader applications.
|
||||||
|
|
||||||
|
See the individual README and pngusr.dfa files for more explanation.
|
@ -1,9 +1,10 @@
|
|||||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
|
||||||
|
|
||||||
To build a minimal read-only decoder with embedded libpng and zlib, run
|
The makefile builds a minimal read-only decoder with embedded libpng
|
||||||
|
and zlib.
|
||||||
|
|
||||||
gather.sh # to collect needed files from pngminus, libpng, and zlib
|
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
||||||
make
|
on the make command line.
|
||||||
|
|
||||||
If you prefer to use the shared libraries, go to contrib/pngminus
|
If you prefer to use the shared libraries, go to contrib/pngminus
|
||||||
and build the png2pnm application there.
|
and build the png2pnm application there.
|
||||||
|
@ -5,27 +5,82 @@
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
LD=$(CC)
|
LD=$(CC)
|
||||||
|
|
||||||
RM=rm -f
|
# If awk fails try
|
||||||
|
# make AWK=nawk
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
|
# If cpp fails try
|
||||||
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1
|
# make CPP=/lib/cpp
|
||||||
|
|
||||||
|
RM=rm -f
|
||||||
|
COPY=cp
|
||||||
|
|
||||||
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
|
||||||
|
|
||||||
C=.c
|
C=.c
|
||||||
O=.o
|
O=.o
|
||||||
L=.a
|
L=.a
|
||||||
E=
|
E=
|
||||||
|
|
||||||
ZOBJS = adler32$(O) crc32$(O) \
|
# Where to find the source code:
|
||||||
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
|
PNGSRC =../../..
|
||||||
trees$(O) uncompr$(O) zutil$(O)
|
ZLIBSRC=$(PNGSRC)/../zlib
|
||||||
|
PROGSRC=$(PNGSRC)/contrib/pngminus
|
||||||
|
|
||||||
OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
# Zlib (minimal inflate requirements - crc32 is used by libpng)
|
||||||
|
# zutil can be eliminated if you provide your own zcalloc and zcfree
|
||||||
|
ZSRCS = adler32$(C) crc32$(C) \
|
||||||
|
inffast$(C) inflate$(C) inftrees$(C) \
|
||||||
|
zutil$(C)
|
||||||
|
|
||||||
|
# Standard headers
|
||||||
|
ZH = zlib.h crc32.h inffast.h inffixed.h \
|
||||||
|
inflate.h inftrees.h zutil.h
|
||||||
|
|
||||||
|
# Machine generated headers
|
||||||
|
ZCONF = zconf.h
|
||||||
|
|
||||||
|
# Headers callers use
|
||||||
|
ZINC = zlib.h $(ZCONF)
|
||||||
|
|
||||||
|
# Headers the Zlib source uses
|
||||||
|
ZHDRS = $(ZH) $(ZCONF)
|
||||||
|
|
||||||
|
ZOBJS = adler32$(O) crc32$(O) \
|
||||||
|
inffast$(O) inflate$(O) inftrees$(O) \
|
||||||
|
zutil$(O)
|
||||||
|
|
||||||
|
# libpng
|
||||||
|
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
||||||
|
pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
|
||||||
|
pngset$(C) pngtrans$(C)
|
||||||
|
|
||||||
|
# Standard headers
|
||||||
|
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
||||||
|
|
||||||
|
# Machine generated headers
|
||||||
|
PNGCONF=pnglibconf.h
|
||||||
|
|
||||||
|
# Headers callers use
|
||||||
|
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
||||||
|
|
||||||
|
# Headers the PNG library uses
|
||||||
|
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
||||||
|
|
||||||
|
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||||
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
||||||
pngset$(O) pngtrans$(O) $(ZOBJS)
|
pngset$(O) pngtrans$(O)
|
||||||
|
|
||||||
|
PROGSRCS= pngm2pnm$(C)
|
||||||
|
PROGHDRS=
|
||||||
|
PROGDOCS=
|
||||||
|
PROGOBJS= pngm2pnm$(O)
|
||||||
|
|
||||||
|
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
.c$(O): png.h pngconf.h pngusr.h zlib.h
|
# note: dependencies do not work on implicit rule lines
|
||||||
|
.c$(O):
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
@ -34,11 +89,62 @@ all: pngm2pnm$(E)
|
|||||||
|
|
||||||
pngm2pnm$(E): $(OBJS)
|
pngm2pnm$(E): $(OBJS)
|
||||||
$(LD) -o pngm2pnm$(E) $(OBJS)
|
$(LD) -o pngm2pnm$(E) $(OBJS)
|
||||||
strip pngm2pnm$(E)
|
|
||||||
|
# The DFA_XTRA setting turns all libpng options off then
|
||||||
|
# turns on those required for this minimal build.
|
||||||
|
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||||
|
# both the build of pnglibconf.h and, subsequently, when
|
||||||
|
# building libpng itself.
|
||||||
|
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||||
|
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||||
|
$(RM) pnglibconf.h pnglibconf.dfn
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||||
|
DFA_XTRA="pngusr.dfa" $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
srcdir=$(PNGSRC) clean
|
||||||
$(RM) pngm2pnm$(O)
|
$(RM) pngm2pnm$(O)
|
||||||
$(RM) pngm2pnm$(E)
|
$(RM) pngm2pnm$(E)
|
||||||
$(RM) $(OBJS)
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
# distclean also removes the copied source and headers
|
||||||
|
distclean: clean
|
||||||
|
$(RM) -r scripts # historical reasons
|
||||||
|
$(RM) $(PNGSRCS) $(PNGH)
|
||||||
|
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
||||||
|
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
||||||
|
|
||||||
|
# Header file dependencies:
|
||||||
|
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
||||||
|
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
||||||
|
$(ZOBJS): $(ZHDRS)
|
||||||
|
|
||||||
|
# Gather the source code from the respective directories
|
||||||
|
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(PNGSRC)/$@ $@
|
||||||
|
|
||||||
|
# No dependency on the ZLIBSRC target so that it only needs
|
||||||
|
# to be specified once.
|
||||||
|
$(ZSRCS) $(ZH):
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(ZLIBSRC)/$@ $@
|
||||||
|
|
||||||
|
# The unconfigured zconf.h varies in name according to the
|
||||||
|
# zlib release
|
||||||
|
$(ZCONF):
|
||||||
|
$(RM) $@
|
||||||
|
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
||||||
|
test -r $(ZLIBSRC)/$$f &&\
|
||||||
|
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
||||||
|
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
||||||
|
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
||||||
|
|
||||||
|
pngm2pnm.c: $(PROGSRC)/png2pnm.c
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(PROGSRC)/png2pnm.c $@
|
||||||
|
|
||||||
# End of makefile for pngm2pnm
|
# End of makefile for pngm2pnm
|
||||||
|
39
jni/libpng/contrib/pngminim/decoder/pngusr.dfa
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# pngminim/decoder/pngusr.dfa
|
||||||
|
#
|
||||||
|
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
# First all the build options off:
|
||||||
|
|
||||||
|
everything = off
|
||||||
|
|
||||||
|
# All that is required is some read code. This example switches
|
||||||
|
# on the sequential read code (see ../preader for a progressive
|
||||||
|
# read example).
|
||||||
|
|
||||||
|
option SEQUENTIAL_READ on
|
||||||
|
|
||||||
|
# You must choose fixed or floating point arithmetic:
|
||||||
|
# option FLOATING_POINT on
|
||||||
|
|
||||||
|
option FIXED_POINT on
|
||||||
|
|
||||||
|
# You must chose the internal fixed point implementation or to
|
||||||
|
# use the system floating point. The latter is considerably
|
||||||
|
# smaller (by about 1kbyte on an x86 system):
|
||||||
|
# option FLOATING_ARITHMETIC on
|
||||||
|
|
||||||
|
option FLOATING_ARITHMETIC off
|
||||||
|
|
||||||
|
# Your program will probably need other options. The example
|
||||||
|
# program here, pngm2pnm, requires the following. Take a look
|
||||||
|
# at pnglibconf.h to find out the full set of what has to be
|
||||||
|
# enabled to make the following work.
|
||||||
|
|
||||||
|
option SETJMP on
|
||||||
|
option STDIO on
|
||||||
|
option READ_EXPAND on
|
||||||
|
option READ_STRIP_16_TO_8 on
|
@ -1,6 +1,6 @@
|
|||||||
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson
|
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@ -12,67 +12,13 @@
|
|||||||
#ifndef MINRDPNGCONF_H
|
#ifndef MINRDPNGCONF_H
|
||||||
#define MINRDPNGCONF_H
|
#define MINRDPNGCONF_H
|
||||||
|
|
||||||
#ifdef NJET
|
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
||||||
/* No 16-bit support beyond reading with strip_16 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PNG_NO_GLOBAL_ARRAYS
|
/* List options to turn off features of the build that do not
|
||||||
|
* affect the API (so are not recorded in pnglibconf.h)
|
||||||
|
*/
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
#define PNG_NO_WARNINGS
|
||||||
#define png_warning(s1,s2) ""
|
#define PNG_ALIGN_TYPE PNG_ALIGN_NONE
|
||||||
#define png_chunk_warning(s1,s2) ""
|
|
||||||
#define PNG_NO_ERROR_TEXT
|
|
||||||
#define png_error(s1,s2) png_err(s1)
|
|
||||||
#define png_chunk_error(s1,s2) png_err(s1)
|
|
||||||
|
|
||||||
#define PNG_NO_ASSEMBLER_CODE
|
|
||||||
#define PNG_NO_OPTIMIZED_CODE
|
|
||||||
#define PNG_NO_READ_GAMMA
|
|
||||||
#define PNG_NO_READ_BACKGROUND
|
|
||||||
#define PNG_NO_READ_DITHER
|
|
||||||
#define PNG_NO_READ_INVERT
|
|
||||||
#define PNG_NO_READ_SHIFT
|
|
||||||
#define PNG_NO_READ_PACK
|
|
||||||
#define PNG_NO_READ_PACKSWAP
|
|
||||||
#define PNG_NO_READ_FILLER
|
|
||||||
#define PNG_NO_READ_SWAP
|
|
||||||
#define PNG_NO_READ_SWAP_ALPHA
|
|
||||||
#define PNG_NO_READ_INVERT_ALPHA
|
|
||||||
#define PNG_NO_READ_RGB_TO_GRAY
|
|
||||||
#define PNG_NO_READ_USER_TRANSFORM
|
|
||||||
#define PNG_NO_READ_bKGD
|
|
||||||
#define PNG_NO_READ_cHRM
|
|
||||||
#define PNG_NO_READ_gAMA
|
|
||||||
#define PNG_NO_READ_hIST
|
|
||||||
#define PNG_NO_READ_iCCP
|
|
||||||
#define PNG_NO_READ_pCAL
|
|
||||||
#define PNG_NO_READ_pHYs
|
|
||||||
#define PNG_NO_READ_sBIT
|
|
||||||
#define PNG_NO_READ_sCAL
|
|
||||||
#define PNG_NO_READ_sPLT
|
|
||||||
#define PNG_NO_READ_sRGB
|
|
||||||
#define PNG_NO_READ_TEXT
|
|
||||||
#define PNG_NO_READ_tIME
|
|
||||||
#define PNG_NO_READ_UNKNOWN_CHUNKS
|
|
||||||
#define PNG_NO_READ_USER_CHUNKS
|
|
||||||
#define PNG_NO_READ_EMPTY_PLTE
|
|
||||||
#define PNG_NO_READ_OPT_PLTE
|
|
||||||
#define PNG_NO_READ_STRIP_ALPHA
|
|
||||||
#define PNG_NO_READ_oFFs
|
|
||||||
#define PNG_NO_WARN_UNINITIALIZED_ROW
|
|
||||||
|
|
||||||
#define PNG_NO_WRITE_SUPPORTED
|
|
||||||
|
|
||||||
#define PNG_NO_INFO_IMAGE
|
|
||||||
#define PNG_NO_USER_MEM
|
|
||||||
#define PNG_NO_FIXED_POINT_SUPPORTED
|
|
||||||
#define PNG_NO_MNG_FEATURES
|
|
||||||
#define PNG_NO_USER_TRANSFORM_PTR
|
|
||||||
#define PNG_NO_HANDLE_AS_UNKNOWN
|
|
||||||
#define PNG_NO_CONSOLE_IO
|
|
||||||
#define PNG_NO_ZALLOC_ZERO
|
|
||||||
#define PNG_NO_ERROR_NUMBERS
|
|
||||||
#define PNG_NO_EASY_ACCESS
|
|
||||||
#define PNG_NO_PROGRESSIVE_READ
|
|
||||||
|
|
||||||
#endif /* MINRDPNGCONF_H */
|
#endif /* MINRDPNGCONF_H */
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||||
|
|
||||||
To build a minimal write-only decoder with embedded libpng and zlib, run
|
The makefile builds a minimal write-only decoder with embedded libpng
|
||||||
|
and zlib.
|
||||||
|
|
||||||
gather.sh # to collect needed files from pngminus, libpng, and zlib
|
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
||||||
make
|
on the make command line.
|
||||||
|
|
||||||
If you prefer to use the shared libraries, go to contrib/pngminus
|
If you prefer to use the shared libraries, go to contrib/pngminus
|
||||||
and build the pnm2png application there.
|
and build the pnm2png application there.
|
||||||
|
@ -5,7 +5,14 @@
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
LD=$(CC)
|
LD=$(CC)
|
||||||
|
|
||||||
|
# If awk fails try
|
||||||
|
# make AWK=nawk
|
||||||
|
|
||||||
|
# If cpp fails try
|
||||||
|
# make CPP=/lib/cpp
|
||||||
|
|
||||||
RM=rm -f
|
RM=rm -f
|
||||||
|
COPY=cp
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
||||||
|
|
||||||
@ -14,17 +21,65 @@ O=.o
|
|||||||
L=.a
|
L=.a
|
||||||
E=
|
E=
|
||||||
|
|
||||||
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
|
# Where to find the source code:
|
||||||
dummy_inflate$(O) \
|
PNGSRC =../../..
|
||||||
trees$(O) uncompr$(O) zutil$(O)
|
ZLIBSRC=$(PNGSRC)/../zlib
|
||||||
|
PROGSRC=$(PNGSRC)/contrib/pngminus
|
||||||
|
|
||||||
OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
# Zlib
|
||||||
|
ZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \
|
||||||
|
trees$(C) zutil$(C)
|
||||||
|
|
||||||
|
# Standard headers
|
||||||
|
#ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
||||||
|
ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
||||||
|
|
||||||
|
# Machine generated headers
|
||||||
|
ZCONF = zconf.h
|
||||||
|
|
||||||
|
# Headers callers use
|
||||||
|
ZINC = zlib.h $(ZCONF)
|
||||||
|
|
||||||
|
# Headers the Zlib source uses
|
||||||
|
ZHDRS = $(ZH) $(ZCONF)
|
||||||
|
|
||||||
|
# compress is not required; it is needed to link the zlib
|
||||||
|
# code because deflate defines an unused API function deflateBound
|
||||||
|
# which itself calls compressBound from compress.
|
||||||
|
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
|
||||||
|
trees$(O) zutil$(O)
|
||||||
|
|
||||||
|
# libpng
|
||||||
|
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
||||||
|
pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \
|
||||||
|
pngwtran$(C) pngwutil$(C)
|
||||||
|
|
||||||
|
# Standard headers
|
||||||
|
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
||||||
|
|
||||||
|
# Machine generated headers
|
||||||
|
PNGCONF=pnglibconf.h
|
||||||
|
|
||||||
|
# Headers callers use
|
||||||
|
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
||||||
|
|
||||||
|
# Headers the PNG library uses
|
||||||
|
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
||||||
|
|
||||||
|
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||||
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
|
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
|
||||||
pngwtran$(O) pngwutil$(O) $(ZOBJS)
|
pngwtran$(O) pngwutil$(O)
|
||||||
|
|
||||||
|
PROGSRCS= pnm2pngm$(C)
|
||||||
|
PROGHDRS=
|
||||||
|
PROGDOCS=
|
||||||
|
PROGOBJS= pnm2pngm$(O)
|
||||||
|
|
||||||
|
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
.c$(O): png.h pngconf.h pngusr.h zlib.h
|
.c$(O):
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
@ -33,11 +88,62 @@ all: pnm2pngm$(E)
|
|||||||
|
|
||||||
pnm2pngm$(E): $(OBJS)
|
pnm2pngm$(E): $(OBJS)
|
||||||
$(LD) -o pnm2pngm$(E) $(OBJS)
|
$(LD) -o pnm2pngm$(E) $(OBJS)
|
||||||
strip pnm2pngm$(E)
|
|
||||||
|
# The DFA_XTRA setting turns all libpng options off then
|
||||||
|
# turns on those required for this minimal build.
|
||||||
|
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||||
|
# both the build of pnglibconf.h and, subsequently, when
|
||||||
|
# building libpng itself.
|
||||||
|
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||||
|
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||||
|
$(RM) pnglibconf.h pnglibconf.dfn
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||||
|
DFA_XTRA="pngusr.dfa" $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
srcdir=$(PNGSRC) clean
|
||||||
$(RM) pnm2pngm$(O)
|
$(RM) pnm2pngm$(O)
|
||||||
$(RM) pnm2pngm$(E)
|
$(RM) pnm2pngm$(E)
|
||||||
$(RM) $(OBJS)
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
# distclean also removes the copied source and headers
|
||||||
|
distclean: clean
|
||||||
|
$(RM) -r scripts # historical reasons
|
||||||
|
$(RM) $(PNGSRCS) $(PNGH)
|
||||||
|
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
||||||
|
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
||||||
|
|
||||||
|
# Header file dependencies:
|
||||||
|
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
||||||
|
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
||||||
|
$(ZOBJS): $(ZHDRS)
|
||||||
|
|
||||||
|
# Gather the source code from the respective directories
|
||||||
|
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(PNGSRC)/$@ $@
|
||||||
|
|
||||||
|
# No dependency on the ZLIBSRC target so that it only needs
|
||||||
|
# to be specified once.
|
||||||
|
$(ZSRCS) $(ZH):
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(ZLIBSRC)/$@ $@
|
||||||
|
|
||||||
|
# The unconfigured zconf.h varies in name according to the
|
||||||
|
# zlib release
|
||||||
|
$(ZCONF):
|
||||||
|
$(RM) $@
|
||||||
|
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
||||||
|
test -r $(ZLIBSRC)/$$f &&\
|
||||||
|
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
||||||
|
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
||||||
|
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
||||||
|
|
||||||
|
pnm2pngm.c: $(PROGSRC)/pnm2png.c
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(PROGSRC)/pnm2png.c $@
|
||||||
|
|
||||||
# End of makefile for pnm2pngm
|
# End of makefile for pnm2pngm
|
||||||
|
35
jni/libpng/contrib/pngminim/encoder/pngusr.dfa
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# pngminim/encoder/pngusr.dfa
|
||||||
|
#
|
||||||
|
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
# First all the build options off:
|
||||||
|
|
||||||
|
everything = off
|
||||||
|
|
||||||
|
# Switch on the write code - this makes a minimalist encoder
|
||||||
|
|
||||||
|
option WRITE on
|
||||||
|
|
||||||
|
# You must choose fixed or floating point arithmetic:
|
||||||
|
# option FLOATING_POINT on
|
||||||
|
|
||||||
|
option FIXED_POINT on
|
||||||
|
|
||||||
|
# You must chose the internal fixed point implementation or to
|
||||||
|
# use the system floating point. The latter is considerably
|
||||||
|
# smaller (by about 1kbyte on an x86 system):
|
||||||
|
# option FLOATING_ARITHMETIC on
|
||||||
|
|
||||||
|
option FLOATING_ARITHMETIC off
|
||||||
|
|
||||||
|
# Your program will probably need other options. The example
|
||||||
|
# program here, pnm2pngm, requires the following. Take a look
|
||||||
|
# at pnglibconf.h to find out the full set of what has to be
|
||||||
|
# enabled to make the following work.
|
||||||
|
|
||||||
|
option SETJMP on
|
||||||
|
option STDIO on
|
@ -1,6 +1,6 @@
|
|||||||
/* minwrpngconf.h: headers to make a minimal png-write-only library
|
/* minwrpngconf.h: headers to make a minimal png-write-only library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson
|
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@ -12,62 +12,13 @@
|
|||||||
#ifndef MINWRPNGCONF_H
|
#ifndef MINWRPNGCONF_H
|
||||||
#define MINWRPNGCONF_H
|
#define MINWRPNGCONF_H
|
||||||
|
|
||||||
#define PNG_NO_GLOBAL_ARRAYS
|
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
||||||
|
|
||||||
#define PNG_NO_READ_SUPPORTED
|
/* List options to turn off features of the build that do not
|
||||||
|
* affect the API (so are not recorded in pnglibconf.h)
|
||||||
|
*/
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
#define PNG_NO_WARNINGS
|
||||||
#define png_warning(s1,s2) ""
|
#define PNG_ALIGN_TYPE PNG_ALIGN_NONE
|
||||||
#define png_chunk_warning(s1,s2) ""
|
|
||||||
#define PNG_NO_ERROR_TEXT
|
|
||||||
#define png_error(s1,s2) png_err(s1)
|
|
||||||
#define png_chunk_error(s1,s2) png_err(s1)
|
|
||||||
|
|
||||||
#define PNG_NO_WRITE_BACKGROUND
|
|
||||||
#define PNG_NO_WRITE_GAMMA
|
|
||||||
#define PNG_NO_WRITE_DITHER
|
|
||||||
#define PNG_NO_WRITE_INVERT
|
|
||||||
#define PNG_NO_WRITE_SHIFT
|
|
||||||
#define PNG_NO_WRITE_PACK
|
|
||||||
#define PNG_NO_WRITE_PACKSWAP
|
|
||||||
#define PNG_NO_WRITE_FILLER
|
|
||||||
#define PNG_NO_WRITE_SWAP
|
|
||||||
#define PNG_NO_WRITE_SWAP_ALPHA
|
|
||||||
#define PNG_NO_WRITE_INVERT_ALPHA
|
|
||||||
#define PNG_NO_WRITE_RGB_TO_GRAY
|
|
||||||
#define PNG_NO_WRITE_USER_TRANSFORM
|
|
||||||
#define PNG_NO_WRITE_bKGD
|
|
||||||
#define PNG_NO_WRITE_cHRM
|
|
||||||
#define PNG_NO_WRITE_gAMA
|
|
||||||
#define PNG_NO_WRITE_hIST
|
|
||||||
#define PNG_NO_WRITE_iCCP
|
|
||||||
#define PNG_NO_WRITE_oFFs
|
|
||||||
#define PNG_NO_WRITE_pCAL
|
|
||||||
#define PNG_NO_WRITE_pHYs
|
|
||||||
#define PNG_NO_WRITE_sBIT
|
|
||||||
#define PNG_NO_WRITE_sCAL
|
|
||||||
#define PNG_NO_WRITE_sPLT
|
|
||||||
#define PNG_NO_WRITE_sRGB
|
|
||||||
#define PNG_NO_WRITE_TEXT
|
|
||||||
#define PNG_NO_WRITE_tIME
|
|
||||||
#define PNG_NO_WRITE_UNKNOWN_CHUNKS
|
|
||||||
#define PNG_NO_WRITE_USER_CHUNKS
|
|
||||||
#define PNG_NO_WRITE_EMPTY_PLTE
|
|
||||||
#define PNG_NO_WRITE_OPT_PLTE
|
|
||||||
#define PNG_NO_WRITE_FILTER
|
|
||||||
#define PNG_NO_WRITE_WEIGHTED_FILTER
|
|
||||||
#define PNG_NO_WRITE_INTERLACING_SUPPORTED
|
|
||||||
#define PNG_NO_WRITE_FLUSH
|
|
||||||
|
|
||||||
#define PNG_NO_INFO_IMAGE
|
|
||||||
#define PNG_NO_USER_MEM
|
|
||||||
#define PNG_NO_FIXED_POINT_SUPPORTED
|
|
||||||
#define PNG_NO_MNG_FEATURES
|
|
||||||
#define PNG_NO_USER_TRANSFORM_PTR
|
|
||||||
#define PNG_NO_HANDLE_AS_UNKNOWN
|
|
||||||
#define PNG_NO_CONSOLE_IO
|
|
||||||
#define PNG_NO_ZALLOC_ZERO
|
|
||||||
#define PNG_NO_ERROR_NUMBERS
|
|
||||||
#define PNG_NO_EASY_ACCESS
|
|
||||||
|
|
||||||
#endif /* MINWRPNGCONF_H */
|
#endif /* MINWRPNGCONF_H */
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||||
|
|
||||||
To build a minimal read-only progressive decoder embedded libpng and
|
The makefile builds a minimal read-only progressive decoder with
|
||||||
zlib and with your system's X library, run
|
embedded libpng, zlib and your system's X library.
|
||||||
|
|
||||||
gather.sh # to collect needed files from gregbook, libpng, and zlib
|
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
||||||
|
on the make command line.
|
||||||
|
|
||||||
Edit makefile if required, to find your X library and include files,
|
Edit makefile if required, to find your X library and include files,
|
||||||
then
|
then
|
||||||
|
|
||||||
make
|
make ZLIBSRC=directory
|
||||||
|
|
||||||
If you prefer to use the shared libraries, go to contrib/gregbook
|
If you prefer to use the shared libraries, go to contrib/gregbook
|
||||||
and build the rpng2-x application there.
|
and build the rpng2-x application there.
|
||||||
|
@ -5,7 +5,14 @@
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
LD=$(CC)
|
LD=$(CC)
|
||||||
|
|
||||||
|
# If awk fails try
|
||||||
|
# make AWK=nawk
|
||||||
|
|
||||||
|
# If cpp fails try
|
||||||
|
# make CPP=/lib/cpp
|
||||||
|
|
||||||
RM=rm -f
|
RM=rm -f
|
||||||
|
COPY=cp
|
||||||
|
|
||||||
#XINC = -I/usr/include # old-style, stock X distributions
|
#XINC = -I/usr/include # old-style, stock X distributions
|
||||||
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
|
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
|
||||||
@ -23,38 +30,136 @@ XLIB = -L/usr/X11R6/lib -lX11
|
|||||||
#LIBS = $(XLIB)
|
#LIBS = $(XLIB)
|
||||||
LIBS = $(XLIB) -lm #platforms that need libm
|
LIBS = $(XLIB) -lm #platforms that need libm
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. $(XINC) -O1
|
||||||
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
|
|
||||||
|
|
||||||
C=.c
|
C=.c
|
||||||
O=.o
|
O=.o
|
||||||
L=.a
|
L=.a
|
||||||
E=
|
E=
|
||||||
|
|
||||||
ZOBJS = adler32$(O) crc32$(O) \
|
# Where to find the source code:
|
||||||
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
|
PNGSRC =../../..
|
||||||
trees$(O) uncompr$(O) zutil$(O)
|
ZLIBSRC=$(PNGSRC)/../zlib
|
||||||
|
PROGSRC=$(PNGSRC)/contrib/gregbook
|
||||||
|
|
||||||
OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
# Zlib (minimal inflate requirements - crc32 is used by libpng)
|
||||||
|
# zutil can be eliminated if you provide your own zcalloc and zcfree
|
||||||
|
ZSRCS = adler32$(C) crc32$(C) \
|
||||||
|
inffast$(C) inflate$(C) inftrees$(C) \
|
||||||
|
zutil$(C)
|
||||||
|
|
||||||
|
# Standard headers
|
||||||
|
ZH = zlib.h crc32.h inffast.h inffixed.h \
|
||||||
|
inflate.h inftrees.h zutil.h
|
||||||
|
|
||||||
|
# Machine generated headers
|
||||||
|
ZCONF = zconf.h
|
||||||
|
|
||||||
|
# Headers callers use
|
||||||
|
ZINC = zlib.h $(ZCONF)
|
||||||
|
|
||||||
|
# Headers the Zlib source uses
|
||||||
|
ZHDRS = $(ZH) $(ZCONF)
|
||||||
|
|
||||||
|
ZOBJS = adler32$(O) crc32$(O) \
|
||||||
|
inffast$(O) inflate$(O) inftrees$(O) \
|
||||||
|
zutil$(O)
|
||||||
|
|
||||||
|
# libpng
|
||||||
|
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
||||||
|
pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
|
||||||
|
pngset$(C) pngtrans$(C)
|
||||||
|
|
||||||
|
# Standard headers
|
||||||
|
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
||||||
|
|
||||||
|
# Machine generated headers
|
||||||
|
PNGCONF=pnglibconf.h
|
||||||
|
|
||||||
|
# Headers callers use
|
||||||
|
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
||||||
|
|
||||||
|
# Headers the PNG library uses
|
||||||
|
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
||||||
|
|
||||||
|
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||||
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
|
||||||
pngset$(O) pngtrans$(O) $(ZOBJS)
|
pngset$(O) pngtrans$(O)
|
||||||
|
|
||||||
|
PROGSRCS= rpng2-x$(C) readpng2$(C)
|
||||||
|
PROGHDRS= readpng2.h
|
||||||
|
PROGDOCS= COPYING LICENSE
|
||||||
|
PROGOBJS= rpng2-x$(O) readpng2$(O)
|
||||||
|
|
||||||
|
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
||||||
|
|
||||||
# implicit make rules -------------------------------------------------------
|
# implicit make rules -------------------------------------------------------
|
||||||
|
|
||||||
.c$(O): png.h pngconf.h readpng2.h pngusr.h zlib.h
|
.c$(O):
|
||||||
$(CC) -c $(CFLAGS) $<
|
$(CC) -c $(CFLAGS) $<
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
|
|
||||||
all: rpng2-x$(E)
|
all: $(PROGDOCS) rpng2-x$(E)
|
||||||
|
|
||||||
rpng2-x$(E): $(OBJS)
|
rpng2-x$(E): $(OBJS)
|
||||||
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
|
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
|
||||||
strip rpng2-x$(E)
|
|
||||||
|
# The DFA_XTRA setting turns all libpng options off then
|
||||||
|
# turns on those required for this minimal build.
|
||||||
|
# The CPP_FLAGS setting causes pngusr.h to be included in
|
||||||
|
# both the build of pnglibconf.h and, subsequently, when
|
||||||
|
# building libpng itself.
|
||||||
|
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
$(PNGSRC)/scripts/pnglibconf.dfa \
|
||||||
|
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
||||||
|
$(RM) pnglibconf.h pnglibconf.dfn
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
||||||
|
DFA_XTRA="pngusr.dfa" $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
||||||
|
srcdir=$(PNGSRC) clean
|
||||||
$(RM) rpng2-x$(O)
|
$(RM) rpng2-x$(O)
|
||||||
$(RM) rpng2-x$(E)
|
$(RM) rpng2-x$(E)
|
||||||
$(RM) $(OBJS)
|
$(RM) $(OBJS)
|
||||||
|
|
||||||
|
# distclean also removes the copied source and headers
|
||||||
|
distclean: clean
|
||||||
|
$(RM) -r scripts # historical reasons
|
||||||
|
$(RM) $(PNGSRCS) $(PNGH)
|
||||||
|
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
||||||
|
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
||||||
|
|
||||||
|
# Header file dependencies:
|
||||||
|
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
||||||
|
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
||||||
|
$(ZOBJS): $(ZHDRS)
|
||||||
|
|
||||||
|
# Gather the source code from the respective directories
|
||||||
|
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(PNGSRC)/$@ $@
|
||||||
|
|
||||||
|
# No dependency on the ZLIBSRC target so that it only needs
|
||||||
|
# to be specified once.
|
||||||
|
$(ZSRCS) $(ZH):
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(ZLIBSRC)/$@ $@
|
||||||
|
|
||||||
|
# The unconfigured zconf.h varies in name according to the
|
||||||
|
# zlib release
|
||||||
|
$(ZCONF):
|
||||||
|
$(RM) $@
|
||||||
|
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
||||||
|
test -r $(ZLIBSRC)/$$f &&\
|
||||||
|
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
||||||
|
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
||||||
|
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
||||||
|
|
||||||
|
$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
|
||||||
|
$(RM) $@
|
||||||
|
$(COPY) $(PROGSRC)/$@ $@
|
||||||
|
|
||||||
# End of makefile for rpng2-x
|
# End of makefile for rpng2-x
|
||||||
|
40
jni/libpng/contrib/pngminim/preader/pngusr.dfa
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# pngminim/preader/pngusr.dfa
|
||||||
|
#
|
||||||
|
# Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
# First all the build options off:
|
||||||
|
|
||||||
|
everything = off
|
||||||
|
|
||||||
|
# Just switch on the progressive read code
|
||||||
|
|
||||||
|
option PROGRESSIVE_READ on
|
||||||
|
|
||||||
|
# You may choose fixed or floating point APIs:
|
||||||
|
# option FLOATING_POINT on
|
||||||
|
|
||||||
|
option FIXED_POINT on
|
||||||
|
|
||||||
|
# You must chose the internal fixed point implementation or to
|
||||||
|
# use the system floating point. The latter is considerably
|
||||||
|
# smaller (by about 1kbyte on an x86 system):
|
||||||
|
|
||||||
|
option FLOATING_ARITHMETIC on
|
||||||
|
# option FLOATING_ARITHMETIC off
|
||||||
|
|
||||||
|
# Your program will probably need other options. The example
|
||||||
|
# program here, rpng2-x, requires the following. Take a look
|
||||||
|
# at pnglibconf.h to find out the full set of what has to be
|
||||||
|
# enabled to make the following work.
|
||||||
|
|
||||||
|
option SETJMP on
|
||||||
|
option STDIO on
|
||||||
|
option READ_bKGD on
|
||||||
|
option READ_GAMMA on
|
||||||
|
option READ_EXPAND on
|
||||||
|
option READ_STRIP_16_TO_8 on
|
||||||
|
option READ_GRAY_TO_RGB on
|
@ -1,6 +1,6 @@
|
|||||||
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
/* minrdpngconf.h: headers to make a minimal png-read-only library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009 Glenn Randers-Pehrson
|
* Copyright (c) 2009, 2010-2011 Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@ -12,57 +12,13 @@
|
|||||||
#ifndef MINPRDPNGCONF_H
|
#ifndef MINPRDPNGCONF_H
|
||||||
#define MINPRDPNGCONF_H
|
#define MINPRDPNGCONF_H
|
||||||
|
|
||||||
#define PNG_NO_GLOBAL_ARRAYS
|
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
|
||||||
|
|
||||||
|
/* List options to turn off features of the build that do not
|
||||||
|
* affect the API (so are not recorded in pnglibconf.h)
|
||||||
|
*/
|
||||||
|
|
||||||
#define PNG_NO_WARNINGS
|
#define PNG_NO_WARNINGS
|
||||||
#define png_warning(s1,s2) ""
|
#define PNG_ALIGN_TYPE PNG_ALIGN_NONE
|
||||||
#define png_chunk_warning(s1,s2) ""
|
|
||||||
#define PNG_NO_ERROR_TEXT
|
|
||||||
#define png_error(s1,s2) png_err(s1)
|
|
||||||
#define png_chunk_error(s1,s2) png_err(s1)
|
|
||||||
|
|
||||||
#define PNG_NO_ASSEMBLER_CODE
|
|
||||||
#define PNG_NO_OPTIMIZED_CODE
|
|
||||||
#define PNG_NO_READ_DITHER
|
|
||||||
#define PNG_NO_READ_INVERT
|
|
||||||
#define PNG_NO_READ_SHIFT
|
|
||||||
#define PNG_NO_READ_PACK
|
|
||||||
#define PNG_NO_READ_PACKSWAP
|
|
||||||
#define PNG_NO_READ_FILLER
|
|
||||||
#define PNG_NO_READ_SWAP
|
|
||||||
#define PNG_NO_READ_SWAP_ALPHA
|
|
||||||
#define PNG_NO_READ_INVERT_ALPHA
|
|
||||||
#define PNG_NO_READ_RGB_TO_GRAY
|
|
||||||
#define PNG_NO_READ_USER_TRANSFORM
|
|
||||||
#define PNG_NO_READ_cHRM
|
|
||||||
#define PNG_NO_READ_hIST
|
|
||||||
#define PNG_NO_READ_iCCP
|
|
||||||
#define PNG_NO_READ_pCAL
|
|
||||||
#define PNG_NO_READ_pHYs
|
|
||||||
#define PNG_NO_READ_sBIT
|
|
||||||
#define PNG_NO_READ_sCAL
|
|
||||||
#define PNG_NO_READ_sPLT
|
|
||||||
#define PNG_NO_READ_TEXT
|
|
||||||
#define PNG_NO_READ_tIME
|
|
||||||
#define PNG_NO_READ_UNKNOWN_CHUNKS
|
|
||||||
#define PNG_NO_READ_USER_CHUNKS
|
|
||||||
#define PNG_NO_READ_EMPTY_PLTE
|
|
||||||
#define PNG_NO_READ_OPT_PLTE
|
|
||||||
#define PNG_NO_READ_STRIP_ALPHA
|
|
||||||
#define PNG_NO_READ_oFFs
|
|
||||||
#define PNG_NO_WARN_UNINITIALIZED_ROW
|
|
||||||
|
|
||||||
#define PNG_NO_WRITE_SUPPORTED
|
|
||||||
|
|
||||||
#define PNG_NO_INFO_IMAGE
|
|
||||||
#define PNG_NO_USER_MEM
|
|
||||||
#define PNG_NO_FIXED_POINT_SUPPORTED
|
|
||||||
#define PNG_NO_MNG_FEATURES
|
|
||||||
#define PNG_NO_USER_TRANSFORM_PTR
|
|
||||||
#define PNG_NO_HANDLE_AS_UNKNOWN
|
|
||||||
#define PNG_NO_CONSOLE_IO
|
|
||||||
#define PNG_NO_ZALLOC_ZERO
|
|
||||||
#define PNG_NO_ERROR_NUMBERS
|
|
||||||
#define PNG_NO_EASY_ACCESS
|
|
||||||
|
|
||||||
#endif /* MINPRDPNGCONF_H */
|
#endif /* MINPRDPNGCONF_H */
|
||||||
|
@ -8,9 +8,9 @@ LD=$(CC)
|
|||||||
RM=rm -f
|
RM=rm -f
|
||||||
|
|
||||||
#PNGPATH = /usr/local
|
#PNGPATH = /usr/local
|
||||||
#PNGINC = -I$(PNGPATH)/include/libpng12
|
#PNGINC = -I$(PNGPATH)/include/libpng15
|
||||||
#PNGLIB = -L$(PNGPATH)/lib -lpng12
|
#PNGLIB = -L$(PNGPATH)/lib -lpng15
|
||||||
#PNGLIBS = $(PNGPATH)/lib/libpng12.a
|
#PNGLIBS = $(PNGPATH)/lib/libpng15.a
|
||||||
PNGINC = -I../..
|
PNGINC = -I../..
|
||||||
PNGLIB = -L../.. -lpng
|
PNGLIB = -L../.. -lpng
|
||||||
PNGLIBS = ../../libpng.a
|
PNGLIBS = ../../libpng.a
|
||||||
@ -23,9 +23,9 @@ ZINC = -I../../../zlib
|
|||||||
ZLIB = -L../../../zlib -lz
|
ZLIB = -L../../../zlib -lz
|
||||||
ZLIBS = ../../../zlib/libz.a
|
ZLIBS = ../../../zlib/libz.a
|
||||||
|
|
||||||
CFLAGS=-O3 $(PNGINC) $(ZINC)
|
CFLAGS=$(PNGINC) $(ZINC)
|
||||||
LDFLAGS=$(PNGLIB) $(ZLIB)
|
LDLIBS=$(PNGLIB) $(ZLIB)
|
||||||
LDFLAGSS=$(PNGLIBS) $(ZLIBS)
|
LDLIBSS=$(PNGLIBS) $(ZLIBS)
|
||||||
C=.c
|
C=.c
|
||||||
O=.o
|
O=.o
|
||||||
L=.a
|
L=.a
|
||||||
@ -40,19 +40,19 @@ png2pnm$(O): png2pnm$(C)
|
|||||||
$(CC) -c $(CFLAGS) png2pnm$(C)
|
$(CC) -c $(CFLAGS) png2pnm$(C)
|
||||||
|
|
||||||
png2pnm$(E): png2pnm$(O)
|
png2pnm$(E): png2pnm$(O)
|
||||||
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lm
|
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
|
||||||
|
|
||||||
png2pnm-static$(E): png2pnm$(O)
|
png2pnm-static$(E): png2pnm$(O)
|
||||||
$(LD) -o png2pnm-static$(E) png2pnm$(O) $(LDFLAGSS) -lm
|
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
|
||||||
|
|
||||||
pnm2png$(O): pnm2png$(C)
|
pnm2png$(O): pnm2png$(C)
|
||||||
$(CC) -c $(CFLAGS) pnm2png$(C)
|
$(CC) -c $(CFLAGS) pnm2png$(C)
|
||||||
|
|
||||||
pnm2png$(E): pnm2png$(O)
|
pnm2png$(E): pnm2png$(O)
|
||||||
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lm
|
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
|
||||||
|
|
||||||
pnm2png-static$(E): pnm2png$(O)
|
pnm2png-static$(E): pnm2png$(O)
|
||||||
$(LD) -o pnm2png-static$(E) pnm2png$(O) $(LDFLAGSS) -lm
|
$(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) png2pnm$(O)
|
$(RM) png2pnm$(O)
|
||||||
|
@ -144,7 +144,7 @@ int main(int argc, char *argv[])
|
|||||||
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n");
|
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,8 +211,8 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
if (ret != 8)
|
if (ret != 8)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ret = !png_sig_cmp (buf, 0, 8);
|
ret = png_sig_cmp (buf, 0, 8);
|
||||||
if (!ret)
|
if (ret)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* create png and info structures */
|
/* create png and info structures */
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
|
|
||||||
pngsuite
|
pngsuite
|
||||||
--------
|
--------
|
||||||
(c) Willem van Schaik, 1999
|
(c) Willem van Schaik, 1999, 2011
|
||||||
|
|
||||||
Permission to use, copy, and distribute these images for any purpose and
|
Permission to use, copy, modify, and distribute these images for any
|
||||||
without fee is hereby granted.
|
purpose and without fee is hereby granted.
|
||||||
|
|
||||||
These 15 images are part of the much larger PngSuite test-set of
|
The 15 "bas*.png" images are part of the much larger PngSuite test-set of
|
||||||
images, available for developers of PNG supporting software. The
|
images, available for developers of PNG supporting software. The
|
||||||
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
||||||
a variety of images to test interlacing, gamma settings, ancillary
|
a variety of images to test interlacing, gamma settings, ancillary
|
||||||
chunks, etc.
|
chunks, etc.
|
||||||
|
|
||||||
|
The "ft*.png" images are "free/libre" replacements for the transparent
|
||||||
|
corresponding t*.png images in the PngSuite.
|
||||||
|
|
||||||
The images in this directory represent the basic PNG color-types:
|
The images in this directory represent the basic PNG color-types:
|
||||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||||
@ -35,7 +38,21 @@ can use them to test the proper functioning of PNG software.
|
|||||||
basn6a08.png 8-bit RGBA
|
basn6a08.png 8-bit RGBA
|
||||||
basn6a16.png 16-bit RGBA
|
basn6a16.png 16-bit RGBA
|
||||||
|
|
||||||
Here is the correct result of typing "pngtest -m *.png" in
|
ftbbn0g04.png 4-bit grayscale, black bKGD
|
||||||
|
ftbbn2c16.png 16-bit truecolor, black bKGD
|
||||||
|
ftbbn3p08.png 8-bit paletted, black bKGD
|
||||||
|
ftbgn2c16.png 16-bit truecolor, gray bKGD
|
||||||
|
ftbgn3p08.png 8-bit paletted, gray bKGD
|
||||||
|
ftbrn2c08.png 8-bit truecolor, red bKGD
|
||||||
|
ftbwn0g16.png 16-bit gray, white bKGD
|
||||||
|
ftbwn3p08.png 8-bit paletted, white bKGD
|
||||||
|
ftbyn3p08.png 8-bit paletted, yellow bKGD
|
||||||
|
ftp0n0g08.png 8-bit grayscale, opaque
|
||||||
|
ftp0n2c08.png 8-bit truecolor, opaque
|
||||||
|
ftp0n3p08.png 8-bit paletted, opaque
|
||||||
|
ftp1n3p08.png 8-bit paletted, no bKGD
|
||||||
|
|
||||||
|
Here is the correct result of typing "pngtest -m bas*.png" in
|
||||||
this directory:
|
this directory:
|
||||||
|
|
||||||
Testing basn0g01.png: PASS (524 zero samples)
|
Testing basn0g01.png: PASS (524 zero samples)
|
||||||
|
BIN
jni/libpng/contrib/pngsuite/ftbbn1g04.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
jni/libpng/contrib/pngsuite/ftbbn2c16.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
jni/libpng/contrib/pngsuite/ftbbn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
jni/libpng/contrib/pngsuite/ftbgn2c16.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
jni/libpng/contrib/pngsuite/ftbgn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
jni/libpng/contrib/pngsuite/ftbrn2c08.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
jni/libpng/contrib/pngsuite/ftbwn1g16.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
jni/libpng/contrib/pngsuite/ftbwn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
jni/libpng/contrib/pngsuite/ftbyn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
jni/libpng/contrib/pngsuite/ftp0n1g08.png
Normal file
After Width: | Height: | Size: 719 B |
BIN
jni/libpng/contrib/pngsuite/ftp0n2c08.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
jni/libpng/contrib/pngsuite/ftp0n3p08.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
jni/libpng/contrib/pngsuite/ftp1n3p08.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
@ -1,12 +1,13 @@
|
|||||||
//-------------------------------------
|
/*-------------------------------------
|
||||||
// PNGFILE.C -- Image File Functions
|
* PNGFILE.C -- Image File Functions
|
||||||
//-------------------------------------
|
*-------------------------------------
|
||||||
|
*
|
||||||
// Copyright 2000, Willem van Schaik.
|
* Copyright 2000, Willem van Schaik.
|
||||||
//
|
*
|
||||||
// This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
// For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
// and license in png.h
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
@ -28,14 +29,14 @@ static png_structp png_ptr = NULL;
|
|||||||
static png_infop info_ptr = NULL;
|
static png_infop info_ptr = NULL;
|
||||||
|
|
||||||
|
|
||||||
// cexcept interface
|
/* cexcept interface */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
png_cexcept_error(png_structp png_ptr, png_const_charp msg)
|
png_cexcept_error(png_structp png_ptr, png_const_charp msg)
|
||||||
{
|
{
|
||||||
if(png_ptr)
|
if(png_ptr)
|
||||||
;
|
;
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
fprintf(stderr, "libpng error: %s\n", msg);
|
fprintf(stderr, "libpng error: %s\n", msg);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -43,7 +44,7 @@ png_cexcept_error(png_structp png_ptr, png_const_charp msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Windows open-file functions
|
/* Windows open-file functions */
|
||||||
|
|
||||||
void PngFileInitialize (HWND hwnd)
|
void PngFileInitialize (HWND hwnd)
|
||||||
{
|
{
|
||||||
@ -57,13 +58,13 @@ void PngFileInitialize (HWND hwnd)
|
|||||||
ofn.lpstrCustomFilter = NULL;
|
ofn.lpstrCustomFilter = NULL;
|
||||||
ofn.nMaxCustFilter = 0;
|
ofn.nMaxCustFilter = 0;
|
||||||
ofn.nFilterIndex = 0;
|
ofn.nFilterIndex = 0;
|
||||||
ofn.lpstrFile = NULL; // Set in Open and Close functions
|
ofn.lpstrFile = NULL; /* Set in Open and Close functions */
|
||||||
ofn.nMaxFile = MAX_PATH;
|
ofn.nMaxFile = MAX_PATH;
|
||||||
ofn.lpstrFileTitle = NULL; // Set in Open and Close functions
|
ofn.lpstrFileTitle = NULL; /* Set in Open and Close functions */
|
||||||
ofn.nMaxFileTitle = MAX_PATH;
|
ofn.nMaxFileTitle = MAX_PATH;
|
||||||
ofn.lpstrInitialDir = NULL;
|
ofn.lpstrInitialDir = NULL;
|
||||||
ofn.lpstrTitle = NULL;
|
ofn.lpstrTitle = NULL;
|
||||||
ofn.Flags = 0; // Set in Open and Close functions
|
ofn.Flags = 0; /* Set in Open and Close functions */
|
||||||
ofn.nFileOffset = 0;
|
ofn.nFileOffset = 0;
|
||||||
ofn.nFileExtension = 0;
|
ofn.nFileExtension = 0;
|
||||||
ofn.lpstrDefExt = TEXT ("png");
|
ofn.lpstrDefExt = TEXT ("png");
|
||||||
@ -92,7 +93,7 @@ BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName)
|
|||||||
return GetSaveFileName (&ofn);
|
return GetSaveFileName (&ofn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PNG image handler functions
|
/* PNG image handler functions */
|
||||||
|
|
||||||
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||||
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor)
|
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor)
|
||||||
@ -109,7 +110,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
static png_byte **ppbRowPointers = NULL;
|
static png_byte **ppbRowPointers = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// open the PNG input file
|
/* open the PNG input file */
|
||||||
|
|
||||||
if (!pstrFileName)
|
if (!pstrFileName)
|
||||||
{
|
{
|
||||||
@ -123,7 +124,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first check the eight byte PNG signature
|
/* first check the eight byte PNG signature */
|
||||||
|
|
||||||
fread(pbSig, 1, 8, pfFile);
|
fread(pbSig, 1, 8, pfFile);
|
||||||
if (png_sig_cmp(pbSig, 0, 8))
|
if (png_sig_cmp(pbSig, 0, 8))
|
||||||
@ -132,7 +133,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the two png(-info) structures
|
/* create the two png(-info) structures */
|
||||||
|
|
||||||
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
|
||||||
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
|
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
|
||||||
@ -153,9 +154,9 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
Try
|
Try
|
||||||
{
|
{
|
||||||
|
|
||||||
// initialize the png structure
|
/* initialize the png structure */
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
||||||
@ -163,20 +164,26 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
|
|
||||||
png_set_sig_bytes(png_ptr, 8);
|
png_set_sig_bytes(png_ptr, 8);
|
||||||
|
|
||||||
// read all PNG info up to image data
|
/* read all PNG info up to image data */
|
||||||
|
|
||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
// get width, height, bit-depth and color-type
|
/* get width, height, bit-depth and color-type */
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||||
&iColorType, NULL, NULL, NULL);
|
&iColorType, NULL, NULL, NULL);
|
||||||
|
|
||||||
// expand images of all color-type and bit-depth to 3x8 bit RGB images
|
/* expand images of all color-type and bit-depth to 3x8-bit RGB */
|
||||||
// let the library process things like alpha, transparency, background
|
/* let the library process alpha, transparency, background, etc. */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_16_TO_8_SUPPORTED
|
||||||
if (iBitDepth == 16)
|
if (iBitDepth == 16)
|
||||||
|
# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||||
|
png_set_scale_16(png_ptr);
|
||||||
|
# else
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
if (iColorType == PNG_COLOR_TYPE_PALETTE)
|
if (iColorType == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_expand(png_ptr);
|
png_set_expand(png_ptr);
|
||||||
if (iBitDepth < 8)
|
if (iBitDepth < 8)
|
||||||
@ -187,7 +194,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
|
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
png_set_gray_to_rgb(png_ptr);
|
png_set_gray_to_rgb(png_ptr);
|
||||||
|
|
||||||
// set the background color to draw transparent and alpha images over.
|
/* set the background color to draw transparent and alpha images over */
|
||||||
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
|
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
|
||||||
{
|
{
|
||||||
png_set_background(png_ptr, pBackground, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
png_set_background(png_ptr, pBackground, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
||||||
@ -200,28 +207,28 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
pBkgColor = NULL;
|
pBkgColor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if required set gamma conversion
|
/* if required set gamma conversion */
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
|
||||||
png_set_gamma(png_ptr, (double) 2.2, dGamma);
|
png_set_gamma(png_ptr, (double) 2.2, dGamma);
|
||||||
|
|
||||||
// after the transformations have been registered update info_ptr data
|
/* after the transformations are registered, update info_ptr data */
|
||||||
|
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
// get again width, height and the new bit-depth and color-type
|
/* get again width, height and the new bit-depth and color-type */
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||||
&iColorType, NULL, NULL, NULL);
|
&iColorType, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
// row_bytes is the width x number of channels
|
/* row_bytes is the width x number of channels */
|
||||||
|
|
||||||
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
|
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
ulChannels = png_get_channels(png_ptr, info_ptr);
|
ulChannels = png_get_channels(png_ptr, info_ptr);
|
||||||
|
|
||||||
*piChannels = ulChannels;
|
*piChannels = ulChannels;
|
||||||
|
|
||||||
// now we can allocate memory to store the image
|
/* now we can allocate memory to store the image */
|
||||||
|
|
||||||
if (pbImageData)
|
if (pbImageData)
|
||||||
{
|
{
|
||||||
@ -235,7 +242,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
}
|
}
|
||||||
*ppbImageData = pbImageData;
|
*ppbImageData = pbImageData;
|
||||||
|
|
||||||
// and allocate memory for an array of row-pointers
|
/* and allocate memory for an array of row-pointers */
|
||||||
|
|
||||||
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
|
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
|
||||||
* sizeof(png_bytep))) == NULL)
|
* sizeof(png_bytep))) == NULL)
|
||||||
@ -243,25 +250,25 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
png_error(png_ptr, "Visual PNG: out of memory");
|
png_error(png_ptr, "Visual PNG: out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the individual row-pointers to point at the correct offsets
|
/* set the individual row-pointers to point at the correct offsets */
|
||||||
|
|
||||||
for (i = 0; i < (*piHeight); i++)
|
for (i = 0; i < (*piHeight); i++)
|
||||||
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
|
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
|
||||||
|
|
||||||
// now we can go ahead and just read the whole image
|
/* now we can go ahead and just read the whole image */
|
||||||
|
|
||||||
png_read_image(png_ptr, ppbRowPointers);
|
png_read_image(png_ptr, ppbRowPointers);
|
||||||
|
|
||||||
// read the additional chunks in the PNG file (not really needed)
|
/* read the additional chunks in the PNG file (not really needed) */
|
||||||
|
|
||||||
png_read_end(png_ptr, NULL);
|
png_read_end(png_ptr, NULL);
|
||||||
|
|
||||||
// and we're done
|
/* and we're done */
|
||||||
|
|
||||||
free (ppbRowPointers);
|
free (ppbRowPointers);
|
||||||
ppbRowPointers = NULL;
|
ppbRowPointers = NULL;
|
||||||
|
|
||||||
// yepp, done
|
/* yepp, done */
|
||||||
}
|
}
|
||||||
|
|
||||||
Catch (msg)
|
Catch (msg)
|
||||||
@ -295,7 +302,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
static png_byte **ppbRowPointers = NULL;
|
static png_byte **ppbRowPointers = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// open the PNG output file
|
/* open the PNG output file */
|
||||||
|
|
||||||
if (!pstrFileName)
|
if (!pstrFileName)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -303,7 +310,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
if (!(pfFile = fopen(pstrFileName, "wb")))
|
if (!(pfFile = fopen(pstrFileName, "wb")))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// prepare the standard PNG structures
|
/* prepare the standard PNG structures */
|
||||||
|
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
|
||||||
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
|
(png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);
|
||||||
@ -322,60 +329,60 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
{
|
{
|
||||||
// initialize the png structure
|
/* initialize the png structure */
|
||||||
|
|
||||||
#if !defined(PNG_NO_STDIO)
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// we're going to write a very simple 3x8 bit RGB image
|
/* we're going to write a very simple 3x8-bit RGB image */
|
||||||
|
|
||||||
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
|
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
|
||||||
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
|
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
|
||||||
PNG_FILTER_TYPE_BASE);
|
PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
// write the file header information
|
/* write the file header information */
|
||||||
|
|
||||||
png_write_info(png_ptr, info_ptr);
|
png_write_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
// swap the BGR pixels in the DiData structure to RGB
|
/* swap the BGR pixels in the DiData structure to RGB */
|
||||||
|
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
// row_bytes is the width x number of channels
|
/* row_bytes is the width x number of channels */
|
||||||
|
|
||||||
ulRowBytes = iWidth * ciChannels;
|
ulRowBytes = iWidth * ciChannels;
|
||||||
|
|
||||||
// we can allocate memory for an array of row-pointers
|
/* we can allocate memory for an array of row-pointers */
|
||||||
|
|
||||||
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
|
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
|
||||||
Throw "Visualpng: Out of memory";
|
Throw "Visualpng: Out of memory";
|
||||||
|
|
||||||
// set the individual row-pointers to point at the correct offsets
|
/* set the individual row-pointers to point at the correct offsets */
|
||||||
|
|
||||||
for (i = 0; i < iHeight; i++)
|
for (i = 0; i < iHeight; i++)
|
||||||
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
|
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
|
||||||
|
|
||||||
// write out the entire image data in one call
|
/* write out the entire image data in one call */
|
||||||
|
|
||||||
png_write_image (png_ptr, ppbRowPointers);
|
png_write_image (png_ptr, ppbRowPointers);
|
||||||
|
|
||||||
// write the additional chunks to the PNG file (not really needed)
|
/* write the additional chunks to the PNG file (not really needed) */
|
||||||
|
|
||||||
png_write_end(png_ptr, info_ptr);
|
png_write_end(png_ptr, info_ptr);
|
||||||
|
|
||||||
// and we're done
|
/* and we're done */
|
||||||
|
|
||||||
free (ppbRowPointers);
|
free (ppbRowPointers);
|
||||||
ppbRowPointers = NULL;
|
ppbRowPointers = NULL;
|
||||||
|
|
||||||
// clean up after the write, and free any memory allocated
|
/* clean up after the write, and free any memory allocated */
|
||||||
|
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
|
||||||
// yepp, done
|
/* yepp, done */
|
||||||
}
|
}
|
||||||
|
|
||||||
Catch (msg)
|
Catch (msg)
|
||||||
@ -395,7 +402,7 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_NO_STDIO
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
|
|
||||||
static void
|
static void
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
@ -437,6 +444,7 @@ png_flush(png_structp png_ptr)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------
|
/*-----------------
|
||||||
// end of source
|
* end of source
|
||||||
//-----------------
|
*-----------------
|
||||||
|
*/
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
//------------------------------------------
|
/*------------------------------------------*/
|
||||||
// PNGFILE.H -- Header File for pngfile.c
|
/* PNGFILE.H -- Header File for pngfile.c*/
|
||||||
//------------------------------------------
|
/*------------------------------------------*/
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik.
|
/* Copyright 2000, Willem van Schaik.*/
|
||||||
|
|
||||||
// This code is released under the libpng license.
|
/* This code is released under the libpng license.*/
|
||||||
// For conditions of distribution and use, see the disclaimer
|
/* For conditions of distribution and use, see the disclaimer*/
|
||||||
// and license in png.h
|
/* and license in png.h*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -22,7 +22,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
int iWidth, int iHeight, png_color BkgColor);
|
int iWidth, int iHeight, png_color BkgColor);
|
||||||
|
|
||||||
#if defined(PNG_NO_STDIO)
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||||
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||||
static void png_flush(png_structp png_ptr);
|
static void png_flush(png_structp png_ptr);
|
||||||
|
@ -1,41 +1,42 @@
|
|||||||
//------------------------------------
|
/*------------------------------------
|
||||||
// VisualPng.C -- Shows a PNG image
|
* VisualPng.C -- Shows a PNG image
|
||||||
//------------------------------------
|
*------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright 2000, Willem van Schaik.
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
// Copyright 2000, Willem van Schaik.
|
/* switches */
|
||||||
|
|
||||||
// This code is released under the libpng license.
|
/* defines */
|
||||||
// For conditions of distribution and use, see the disclaimer
|
|
||||||
// and license in png.h
|
|
||||||
|
|
||||||
// switches
|
|
||||||
|
|
||||||
// defines
|
|
||||||
|
|
||||||
#define PROGNAME "VisualPng"
|
#define PROGNAME "VisualPng"
|
||||||
#define LONGNAME "Win32 Viewer for PNG-files"
|
#define LONGNAME "Win32 Viewer for PNG-files"
|
||||||
#define VERSION "1.0 of 2000 June 07"
|
#define VERSION "1.0 of 2000 June 07"
|
||||||
|
|
||||||
// constants
|
/* constants */
|
||||||
|
|
||||||
#define MARGIN 8
|
#define MARGIN 8
|
||||||
|
|
||||||
// standard includes
|
/* standard includes */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
// application includes
|
/* application includes */
|
||||||
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
#include "pngfile.h"
|
#include "pngfile.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
// macros
|
/* macros */
|
||||||
|
|
||||||
// function prototypes
|
/* function prototypes */
|
||||||
|
|
||||||
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
|
||||||
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ;
|
BOOL CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ;
|
||||||
@ -65,14 +66,14 @@ BOOL FillBitmap (
|
|||||||
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
||||||
BOOL bStretched);
|
BOOL bStretched);
|
||||||
|
|
||||||
// a few global variables
|
/* a few global variables */
|
||||||
|
|
||||||
static char *szProgName = PROGNAME;
|
static char *szProgName = PROGNAME;
|
||||||
static char *szAppName = LONGNAME;
|
static char *szAppName = LONGNAME;
|
||||||
static char *szIconName = PROGNAME;
|
static char *szIconName = PROGNAME;
|
||||||
static char szCmdFileName [MAX_PATH];
|
static char szCmdFileName [MAX_PATH];
|
||||||
|
|
||||||
// MAIN routine
|
/* MAIN routine */
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
PSTR szCmdLine, int iCmdShow)
|
PSTR szCmdLine, int iCmdShow)
|
||||||
@ -90,7 +91,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
wndclass.hInstance = hInstance;
|
wndclass.hInstance = hInstance;
|
||||||
wndclass.hIcon = LoadIcon (hInstance, szIconName) ;
|
wndclass.hIcon = LoadIcon (hInstance, szIconName) ;
|
||||||
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
|
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||||
wndclass.hbrBackground = NULL; // (HBRUSH) GetStockObject (GRAY_BRUSH);
|
wndclass.hbrBackground = NULL; /* (HBRUSH) GetStockObject (GRAY_BRUSH); */
|
||||||
wndclass.lpszMenuName = szProgName;
|
wndclass.lpszMenuName = szProgName;
|
||||||
wndclass.lpszClassName = szProgName;
|
wndclass.lpszClassName = szProgName;
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if filename given on commandline, store it
|
/* if filename given on commandline, store it */
|
||||||
if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
|
if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
|
||||||
if (szCmdLine[0] == '"')
|
if (szCmdLine[0] == '"')
|
||||||
strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
|
strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
|
||||||
@ -110,7 +111,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
else
|
else
|
||||||
strcpy (szCmdFileName, "");
|
strcpy (szCmdFileName, "");
|
||||||
|
|
||||||
// calculate size of window-borders
|
/* calculate size of window-borders */
|
||||||
ixBorders = 2 * (GetSystemMetrics (SM_CXBORDER) +
|
ixBorders = 2 * (GetSystemMetrics (SM_CXBORDER) +
|
||||||
GetSystemMetrics (SM_CXDLGFRAME));
|
GetSystemMetrics (SM_CXDLGFRAME));
|
||||||
iyBorders = 2 * (GetSystemMetrics (SM_CYBORDER) +
|
iyBorders = 2 * (GetSystemMetrics (SM_CYBORDER) +
|
||||||
@ -123,7 +124,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
WS_OVERLAPPEDWINDOW,
|
WS_OVERLAPPEDWINDOW,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
512 + 2 * MARGIN + ixBorders, 384 + 2 * MARGIN + iyBorders,
|
512 + 2 * MARGIN + ixBorders, 384 + 2 * MARGIN + iyBorders,
|
||||||
// CW_USEDEFAULT, CW_USEDEFAULT,
|
/* CW_USEDEFAULT, CW_USEDEFAULT, */
|
||||||
NULL, NULL, hInstance, NULL);
|
NULL, NULL, hInstance, NULL);
|
||||||
|
|
||||||
ShowWindow (hwnd, iCmdShow);
|
ShowWindow (hwnd, iCmdShow);
|
||||||
@ -180,29 +181,29 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
|
|
||||||
strcpy (szImgPathName, "");
|
strcpy (szImgPathName, "");
|
||||||
|
|
||||||
// in case we process file given on command-line
|
/* in case we process file given on command-line */
|
||||||
|
|
||||||
if (szCmdFileName[0] != '\0')
|
if (szCmdFileName[0] != '\0')
|
||||||
{
|
{
|
||||||
strcpy (szImgPathName, szCmdFileName);
|
strcpy (szImgPathName, szCmdFileName);
|
||||||
|
|
||||||
// read the other png-files in the directory for later
|
/* read the other png-files in the directory for later */
|
||||||
// next/previous commands
|
/* next/previous commands */
|
||||||
|
|
||||||
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
|
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
|
||||||
&iPngFileIndex);
|
&iPngFileIndex);
|
||||||
|
|
||||||
// load the image from file
|
/* load the image from file */
|
||||||
|
|
||||||
if (!LoadImageFile (hwnd, szImgPathName,
|
if (!LoadImageFile (hwnd, szImgPathName,
|
||||||
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// invalidate the client area for later update
|
/* invalidate the client area for later update */
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
/* display the PNG into the DIBitmap */
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
@ -214,11 +215,11 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
cxWinSize = LOWORD (lParam);
|
cxWinSize = LOWORD (lParam);
|
||||||
cyWinSize = HIWORD (lParam);
|
cyWinSize = HIWORD (lParam);
|
||||||
|
|
||||||
// invalidate the client area for later update
|
/* invalidate the client area for later update */
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
/* display the PNG into the DIBitmap */
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
@ -242,28 +243,28 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
{
|
{
|
||||||
case IDM_FILE_OPEN:
|
case IDM_FILE_OPEN:
|
||||||
|
|
||||||
// show the File Open dialog box
|
/* show the File Open dialog box */
|
||||||
|
|
||||||
if (!PngFileOpenDlg (hwnd, szImgPathName, szTitleName))
|
if (!PngFileOpenDlg (hwnd, szImgPathName, szTitleName))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// read the other png-files in the directory for later
|
/* read the other png-files in the directory for later */
|
||||||
// next/previous commands
|
/* next/previous commands */
|
||||||
|
|
||||||
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
|
BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
|
||||||
&iPngFileIndex);
|
&iPngFileIndex);
|
||||||
|
|
||||||
// load the image from file
|
/* load the image from file */
|
||||||
|
|
||||||
if (!LoadImageFile (hwnd, szImgPathName,
|
if (!LoadImageFile (hwnd, szImgPathName,
|
||||||
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
&pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// invalidate the client area for later update
|
/* invalidate the client area for later update */
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
/* display the PNG into the DIBitmap */
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
@ -272,12 +273,12 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
|
|
||||||
case IDM_FILE_SAVE:
|
case IDM_FILE_SAVE:
|
||||||
|
|
||||||
// show the File Save dialog box
|
/* show the File Save dialog box */
|
||||||
|
|
||||||
if (!PngFileSaveDlg (hwnd, szImgPathName, szTitleName))
|
if (!PngFileSaveDlg (hwnd, szImgPathName, szTitleName))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// save the PNG to a disk file
|
/* save the PNG to a disk file */
|
||||||
|
|
||||||
SetCursor (LoadCursor (NULL, IDC_WAIT));
|
SetCursor (LoadCursor (NULL, IDC_WAIT));
|
||||||
ShowCursor (TRUE);
|
ShowCursor (TRUE);
|
||||||
@ -295,7 +296,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
|
|
||||||
case IDM_FILE_NEXT:
|
case IDM_FILE_NEXT:
|
||||||
|
|
||||||
// read next entry in the directory
|
/* read next entry in the directory */
|
||||||
|
|
||||||
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
||||||
NULL, szImgPathName))
|
NULL, szImgPathName))
|
||||||
@ -303,17 +304,17 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
if (strcmp (szImgPathName, "") == 0)
|
if (strcmp (szImgPathName, "") == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// load the image from file
|
/* load the image from file */
|
||||||
|
|
||||||
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
|
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
|
||||||
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// invalidate the client area for later update
|
/* invalidate the client area for later update */
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
/* display the PNG into the DIBitmap */
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
@ -323,7 +324,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
|
|
||||||
case IDM_FILE_PREVIOUS:
|
case IDM_FILE_PREVIOUS:
|
||||||
|
|
||||||
// read previous entry in the directory
|
/* read previous entry in the directory */
|
||||||
|
|
||||||
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
||||||
szImgPathName, NULL))
|
szImgPathName, NULL))
|
||||||
@ -332,17 +333,17 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
if (strcmp (szImgPathName, "") == 0)
|
if (strcmp (szImgPathName, "") == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// load the image from file
|
/* load the image from file */
|
||||||
|
|
||||||
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
|
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
|
||||||
&cyImgSize, &cImgChannels, &bkgColor))
|
&cyImgSize, &cImgChannels, &bkgColor))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// invalidate the client area for later update
|
/* invalidate the client area for later update */
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
/* display the PNG into the DIBitmap */
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
@ -352,9 +353,9 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
|
|
||||||
case IDM_FILE_EXIT:
|
case IDM_FILE_EXIT:
|
||||||
|
|
||||||
// more cleanup needed...
|
/* more cleanup needed... */
|
||||||
|
|
||||||
// free image buffer
|
/* free image buffer */
|
||||||
|
|
||||||
if (pDib != NULL)
|
if (pDib != NULL)
|
||||||
{
|
{
|
||||||
@ -362,7 +363,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
pDib = NULL;
|
pDib = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// free file-list
|
/* free file-list */
|
||||||
|
|
||||||
if (pPngFileList != NULL)
|
if (pPngFileList != NULL)
|
||||||
{
|
{
|
||||||
@ -370,7 +371,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
pPngFileList = NULL;
|
pPngFileList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let's go ...
|
/* let's go ... */
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
|
|
||||||
@ -383,11 +384,11 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
else
|
else
|
||||||
CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_UNCHECKED);
|
CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_UNCHECKED);
|
||||||
|
|
||||||
// invalidate the client area for later update
|
/* invalidate the client area for later update */
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
/* display the PNG into the DIBitmap */
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
@ -398,7 +399,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ;
|
DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} // end switch
|
} /* end switch */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -450,10 +451,10 @@ BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
|
|||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------
|
/*---------------
|
||||||
// CenterAbout
|
* CenterAbout
|
||||||
//---------------
|
*---------------
|
||||||
|
*/
|
||||||
BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
|
BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
|
||||||
{
|
{
|
||||||
RECT rChild, rParent, rWorkArea;
|
RECT rChild, rParent, rWorkArea;
|
||||||
@ -461,19 +462,19 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
|
|||||||
int xNew, yNew;
|
int xNew, yNew;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
|
|
||||||
// Get the Height and Width of the child window
|
/* Get the Height and Width of the child window */
|
||||||
GetWindowRect (hwndChild, &rChild);
|
GetWindowRect (hwndChild, &rChild);
|
||||||
wChild = rChild.right - rChild.left;
|
wChild = rChild.right - rChild.left;
|
||||||
hChild = rChild.bottom - rChild.top;
|
hChild = rChild.bottom - rChild.top;
|
||||||
|
|
||||||
// Get the Height and Width of the parent window
|
/* Get the Height and Width of the parent window */
|
||||||
GetWindowRect (hwndParent, &rParent);
|
GetWindowRect (hwndParent, &rParent);
|
||||||
wParent = rParent.right - rParent.left;
|
wParent = rParent.right - rParent.left;
|
||||||
hParent = rParent.bottom - rParent.top;
|
hParent = rParent.bottom - rParent.top;
|
||||||
|
|
||||||
// Get the limits of the 'workarea'
|
/* Get the limits of the 'workarea' */
|
||||||
bResult = SystemParametersInfo(
|
bResult = SystemParametersInfo(
|
||||||
SPI_GETWORKAREA, // system parameter to query or set
|
SPI_GETWORKAREA, /* system parameter to query or set */
|
||||||
sizeof(RECT),
|
sizeof(RECT),
|
||||||
&rWorkArea,
|
&rWorkArea,
|
||||||
0);
|
0);
|
||||||
@ -483,7 +484,7 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
|
|||||||
rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
|
rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate new X position, then adjust for workarea
|
/* Calculate new X position, then adjust for workarea */
|
||||||
xNew = rParent.left + ((wParent - wChild) /2);
|
xNew = rParent.left + ((wParent - wChild) /2);
|
||||||
if (xNew < rWorkArea.left) {
|
if (xNew < rWorkArea.left) {
|
||||||
xNew = rWorkArea.left;
|
xNew = rWorkArea.left;
|
||||||
@ -491,7 +492,7 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
|
|||||||
xNew = rWorkArea.right - wChild;
|
xNew = rWorkArea.right - wChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate new Y position, then adjust for workarea
|
/* Calculate new Y position, then adjust for workarea */
|
||||||
yNew = rParent.top + ((hParent - hChild) /2);
|
yNew = rParent.top + ((hParent - hChild) /2);
|
||||||
if (yNew < rWorkArea.top) {
|
if (yNew < rWorkArea.top) {
|
||||||
yNew = rWorkArea.top;
|
yNew = rWorkArea.top;
|
||||||
@ -499,15 +500,15 @@ BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
|
|||||||
yNew = rWorkArea.bottom - hChild;
|
yNew = rWorkArea.bottom - hChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set it, and return
|
/* Set it, and return */
|
||||||
return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE |
|
return SetWindowPos (hwndChild, NULL, xNew, yNew, 0, 0, SWP_NOSIZE |
|
||||||
SWP_NOZORDER);
|
SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------
|
/*----------------
|
||||||
// BuildPngList
|
* BuildPngList
|
||||||
//----------------
|
*----------------
|
||||||
|
*/
|
||||||
BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
||||||
int *pFileIndex)
|
int *pFileIndex)
|
||||||
{
|
{
|
||||||
@ -523,7 +524,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
|||||||
int i, ii;
|
int i, ii;
|
||||||
int j, jj;
|
int j, jj;
|
||||||
|
|
||||||
// free previous file-list
|
/* free previous file-list */
|
||||||
|
|
||||||
if (*ppFileList != NULL)
|
if (*ppFileList != NULL)
|
||||||
{
|
{
|
||||||
@ -531,7 +532,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
|||||||
*ppFileList = NULL;
|
*ppFileList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract foldername, filename and search-name
|
/* extract foldername, filename and search-name */
|
||||||
|
|
||||||
strcpy (szImgPathName, pstrPathName);
|
strcpy (szImgPathName, pstrPathName);
|
||||||
strcpy (szImgFileName, strrchr (pstrPathName, '\\') + 1);
|
strcpy (szImgFileName, strrchr (pstrPathName, '\\') + 1);
|
||||||
@ -540,7 +541,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
|||||||
*(strrchr (szImgFindName, '\\') + 1) = '\0';
|
*(strrchr (szImgFindName, '\\') + 1) = '\0';
|
||||||
strcat (szImgFindName, "*.png");
|
strcat (szImgFindName, "*.png");
|
||||||
|
|
||||||
// first cycle: count number of files in directory for memory allocation
|
/* first cycle: count number of files in directory for memory allocation */
|
||||||
|
|
||||||
*pFileCount = 0;
|
*pFileCount = 0;
|
||||||
|
|
||||||
@ -554,11 +555,11 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
|||||||
}
|
}
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
|
|
||||||
// allocation memory for file-list
|
/* allocation memory for file-list */
|
||||||
|
|
||||||
*ppFileList = (TCHAR *) malloc (*pFileCount * MAX_PATH);
|
*ppFileList = (TCHAR *) malloc (*pFileCount * MAX_PATH);
|
||||||
|
|
||||||
// second cycle: read directory and store filenames in file-list
|
/* second cycle: read directory and store filenames in file-list */
|
||||||
|
|
||||||
hFind = FindFirstFile(szImgFindName, &finddata);
|
hFind = FindFirstFile(szImgFindName, &finddata);
|
||||||
bOk = (hFind != (HANDLE) -1);
|
bOk = (hFind != (HANDLE) -1);
|
||||||
@ -580,7 +581,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
|||||||
}
|
}
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
|
|
||||||
// finally we must sort the file-list
|
/* finally we must sort the file-list */
|
||||||
|
|
||||||
for (i = 0; i < *pFileCount - 1; i++)
|
for (i = 0; i < *pFileCount - 1; i++)
|
||||||
{
|
{
|
||||||
@ -594,7 +595,7 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
|||||||
strcpy (*ppFileList + jj, *ppFileList + ii);
|
strcpy (*ppFileList + jj, *ppFileList + ii);
|
||||||
strcpy (*ppFileList + ii, szTmp);
|
strcpy (*ppFileList + ii, szTmp);
|
||||||
|
|
||||||
// check if this was the current image that we moved
|
/* check if this was the current image that we moved */
|
||||||
|
|
||||||
if (*pFileIndex == i)
|
if (*pFileIndex == i)
|
||||||
*pFileIndex = j;
|
*pFileIndex = j;
|
||||||
@ -608,9 +609,10 @@ BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------
|
/*----------------
|
||||||
// SearchPngList
|
* SearchPngList
|
||||||
//----------------
|
*----------------
|
||||||
|
*/
|
||||||
|
|
||||||
BOOL SearchPngList (
|
BOOL SearchPngList (
|
||||||
TCHAR *pFileList, int FileCount, int *pFileIndex,
|
TCHAR *pFileList, int FileCount, int *pFileIndex,
|
||||||
@ -618,7 +620,7 @@ BOOL SearchPngList (
|
|||||||
{
|
{
|
||||||
if (FileCount > 0)
|
if (FileCount > 0)
|
||||||
{
|
{
|
||||||
// get previous entry
|
/* get previous entry */
|
||||||
|
|
||||||
if (pstrPrevName != NULL)
|
if (pstrPrevName != NULL)
|
||||||
{
|
{
|
||||||
@ -630,7 +632,7 @@ BOOL SearchPngList (
|
|||||||
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
|
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
// get next entry
|
/* get next entry */
|
||||||
|
|
||||||
if (pstrNextName != NULL)
|
if (pstrNextName != NULL)
|
||||||
{
|
{
|
||||||
@ -650,9 +652,10 @@ BOOL SearchPngList (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------
|
/*-----------------
|
||||||
// LoadImageFile
|
* LoadImageFile
|
||||||
//-----------------
|
*-----------------
|
||||||
|
*/
|
||||||
|
|
||||||
BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
|
BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
|
||||||
png_byte **ppbImage, int *pxImgSize, int *pyImgSize,
|
png_byte **ppbImage, int *pxImgSize, int *pyImgSize,
|
||||||
@ -660,7 +663,7 @@ BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
|
|||||||
{
|
{
|
||||||
static TCHAR szTmp [MAX_PATH];
|
static TCHAR szTmp [MAX_PATH];
|
||||||
|
|
||||||
// if there's an existing PNG, free the memory
|
/* if there's an existing PNG, free the memory */
|
||||||
|
|
||||||
if (*ppbImage)
|
if (*ppbImage)
|
||||||
{
|
{
|
||||||
@ -668,7 +671,7 @@ BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
|
|||||||
*ppbImage = NULL;
|
*ppbImage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the entire PNG into memory
|
/* Load the entire PNG into memory */
|
||||||
|
|
||||||
SetCursor (LoadCursor (NULL, IDC_WAIT));
|
SetCursor (LoadCursor (NULL, IDC_WAIT));
|
||||||
ShowCursor (TRUE);
|
ShowCursor (TRUE);
|
||||||
@ -694,10 +697,10 @@ BOOL LoadImageFile (HWND hwnd, PTSTR pstrPathName,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------
|
/*----------------
|
||||||
// DisplayImage
|
* DisplayImage
|
||||||
//----------------
|
*----------------
|
||||||
|
*/
|
||||||
BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
||||||
BYTE **ppDiData, int cxWinSize, int cyWinSize,
|
BYTE **ppDiData, int cxWinSize, int cyWinSize,
|
||||||
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
||||||
@ -705,14 +708,14 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
|||||||
{
|
{
|
||||||
BYTE *pDib = *ppDib;
|
BYTE *pDib = *ppDib;
|
||||||
BYTE *pDiData = *ppDiData;
|
BYTE *pDiData = *ppDiData;
|
||||||
// BITMAPFILEHEADER *pbmfh;
|
/* BITMAPFILEHEADER *pbmfh; */
|
||||||
BITMAPINFOHEADER *pbmih;
|
BITMAPINFOHEADER *pbmih;
|
||||||
WORD wDIRowBytes;
|
WORD wDIRowBytes;
|
||||||
png_color bkgBlack = {0, 0, 0};
|
png_color bkgBlack = {0, 0, 0};
|
||||||
png_color bkgGray = {127, 127, 127};
|
png_color bkgGray = {127, 127, 127};
|
||||||
png_color bkgWhite = {255, 255, 255};
|
png_color bkgWhite = {255, 255, 255};
|
||||||
|
|
||||||
// allocate memory for the Device Independant bitmap
|
/* allocate memory for the Device Independant bitmap */
|
||||||
|
|
||||||
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
|
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
|
||||||
|
|
||||||
@ -733,7 +736,7 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
|||||||
*ppDib = pDib;
|
*ppDib = pDib;
|
||||||
memset (pDib, 0, sizeof(BITMAPINFOHEADER));
|
memset (pDib, 0, sizeof(BITMAPINFOHEADER));
|
||||||
|
|
||||||
// initialize the dib-structure
|
/* initialize the dib-structure */
|
||||||
|
|
||||||
pbmih = (BITMAPINFOHEADER *) pDib;
|
pbmih = (BITMAPINFOHEADER *) pDib;
|
||||||
pbmih->biSize = sizeof(BITMAPINFOHEADER);
|
pbmih->biSize = sizeof(BITMAPINFOHEADER);
|
||||||
@ -745,11 +748,11 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
|||||||
pDiData = pDib + sizeof(BITMAPINFOHEADER);
|
pDiData = pDib + sizeof(BITMAPINFOHEADER);
|
||||||
*ppDiData = pDiData;
|
*ppDiData = pDiData;
|
||||||
|
|
||||||
// first fill bitmap with gray and image border
|
/* first fill bitmap with gray and image border */
|
||||||
|
|
||||||
InitBitmap (pDiData, cxWinSize, cyWinSize);
|
InitBitmap (pDiData, cxWinSize, cyWinSize);
|
||||||
|
|
||||||
// then fill bitmap with image
|
/* then fill bitmap with image */
|
||||||
|
|
||||||
if (pbImage)
|
if (pbImage)
|
||||||
{
|
{
|
||||||
@ -762,16 +765,16 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------
|
/*--------------
|
||||||
// InitBitmap
|
* InitBitmap
|
||||||
//--------------
|
*--------------
|
||||||
|
*/
|
||||||
BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
|
BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
|
||||||
{
|
{
|
||||||
BYTE *dst;
|
BYTE *dst;
|
||||||
int x, y, col;
|
int x, y, col;
|
||||||
|
|
||||||
// initialize the background with gray
|
/* initialize the background with gray */
|
||||||
|
|
||||||
dst = pDiData;
|
dst = pDiData;
|
||||||
for (y = 0; y < cyWinSize; y++)
|
for (y = 0; y < cyWinSize; y++)
|
||||||
@ -779,13 +782,13 @@ BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
|
|||||||
col = 0;
|
col = 0;
|
||||||
for (x = 0; x < cxWinSize; x++)
|
for (x = 0; x < cxWinSize; x++)
|
||||||
{
|
{
|
||||||
// fill with GRAY
|
/* fill with GRAY */
|
||||||
*dst++ = 127;
|
*dst++ = 127;
|
||||||
*dst++ = 127;
|
*dst++ = 127;
|
||||||
*dst++ = 127;
|
*dst++ = 127;
|
||||||
col += 3;
|
col += 3;
|
||||||
}
|
}
|
||||||
// rows start on 4 byte boundaries
|
/* rows start on 4 byte boundaries */
|
||||||
while ((col % 4) != 0)
|
while ((col % 4) != 0)
|
||||||
{
|
{
|
||||||
dst++;
|
dst++;
|
||||||
@ -796,10 +799,10 @@ BOOL InitBitmap (BYTE *pDiData, int cxWinSize, int cyWinSize)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------
|
/*--------------
|
||||||
// FillBitmap
|
* FillBitmap
|
||||||
//--------------
|
*--------------
|
||||||
|
*/
|
||||||
BOOL FillBitmap (
|
BOOL FillBitmap (
|
||||||
BYTE *pDiData, int cxWinSize, int cyWinSize,
|
BYTE *pDiData, int cxWinSize, int cyWinSize,
|
||||||
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
|
||||||
@ -824,11 +827,12 @@ BOOL FillBitmap (
|
|||||||
cxNewSize = cxWinSize - 2 * MARGIN;
|
cxNewSize = cxWinSize - 2 * MARGIN;
|
||||||
cyNewSize = cyWinSize - 2 * MARGIN;
|
cyNewSize = cyWinSize - 2 * MARGIN;
|
||||||
|
|
||||||
// stretch the image to it's window determined size
|
/* stretch the image to it's window determined size */
|
||||||
|
|
||||||
// the following two are the same, but the first has side-effects
|
/* the following two are mathematically the same, but the first
|
||||||
// because of rounding
|
* has side-effects because of rounding
|
||||||
// if ((cyNewSize / cxNewSize) > (cyImgSize / cxImgSize))
|
*/
|
||||||
|
/* if ((cyNewSize / cxNewSize) > (cyImgSize / cxImgSize)) */
|
||||||
if ((cyNewSize * cxImgSize) > (cyImgSize * cxNewSize))
|
if ((cyNewSize * cxImgSize) > (cyImgSize * cxNewSize))
|
||||||
{
|
{
|
||||||
cyNewSize = cxNewSize * cyImgSize / cxImgSize;
|
cyNewSize = cxNewSize * cyImgSize / cxImgSize;
|
||||||
@ -867,12 +871,12 @@ BOOL FillBitmap (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate row-bytes
|
/* calculate row-bytes */
|
||||||
|
|
||||||
wImgRowBytes = cImgChannels * cxNewSize;
|
wImgRowBytes = cImgChannels * cxNewSize;
|
||||||
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
|
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
|
||||||
|
|
||||||
// copy image to screen
|
/* copy image to screen */
|
||||||
|
|
||||||
for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin++)
|
for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin++)
|
||||||
{
|
{
|
||||||
@ -898,7 +902,7 @@ BOOL FillBitmap (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// free memory
|
/* free memory */
|
||||||
|
|
||||||
if (pStretchedImage != NULL)
|
if (pStretchedImage != NULL)
|
||||||
{
|
{
|
||||||
@ -908,28 +912,28 @@ BOOL FillBitmap (
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// process the image not-stretched
|
/* process the image not-stretched */
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// calculate the central position
|
/* calculate the central position */
|
||||||
|
|
||||||
cxImgPos = (cxWinSize - cxImgSize) / 2;
|
cxImgPos = (cxWinSize - cxImgSize) / 2;
|
||||||
cyImgPos = (cyWinSize - cyImgSize) / 2;
|
cyImgPos = (cyWinSize - cyImgSize) / 2;
|
||||||
|
|
||||||
// check for image larger than window
|
/* check for image larger than window */
|
||||||
|
|
||||||
if (cxImgPos < MARGIN)
|
if (cxImgPos < MARGIN)
|
||||||
cxImgPos = MARGIN;
|
cxImgPos = MARGIN;
|
||||||
if (cyImgPos < MARGIN)
|
if (cyImgPos < MARGIN)
|
||||||
cyImgPos = MARGIN;
|
cyImgPos = MARGIN;
|
||||||
|
|
||||||
// calculate both row-bytes
|
/* calculate both row-bytes */
|
||||||
|
|
||||||
wImgRowBytes = cImgChannels * cxImgSize;
|
wImgRowBytes = cImgChannels * cxImgSize;
|
||||||
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
|
wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;
|
||||||
|
|
||||||
// copy image to screen
|
/* copy image to screen */
|
||||||
|
|
||||||
for (yImg = 0, yWin = cyImgPos; yImg < cyImgSize; yImg++, yWin++)
|
for (yImg = 0, yWin = cyImgPos; yImg < cyImgSize; yImg++, yWin++)
|
||||||
{
|
{
|
||||||
@ -959,6 +963,7 @@ BOOL FillBitmap (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------
|
/*-----------------
|
||||||
// end of source
|
* end of source
|
||||||
//-----------------
|
*-----------------
|
||||||
|
*/
|
||||||
|
@ -43,9 +43,9 @@ RSC=rc.exe
|
|||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
# ADD BASE CPP /nologo /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
||||||
# SUBTRACT BASE CPP /YX
|
# SUBTRACT BASE CPP /YX
|
||||||
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /c
|
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
@ -77,9 +77,9 @@ PostBuild_Cmds=$(outdir)\VisualPng.exe ..\..\contrib\pngsuite\basn6a16.png
|
|||||||
# PROP Intermediate_Dir "Debug"
|
# PROP Intermediate_Dir "Debug"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
|
||||||
# SUBTRACT BASE CPP /YX
|
# SUBTRACT BASE CPP /YX
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /D "PNG_NO_GLOBAL_ARRAYS" /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
|
||||||
scriptversion=2009-04-28.21; # UTC
|
scriptversion=2011-12-04.11; # UTC
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
|
||||||
# Software Foundation, Inc.
|
# 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -44,7 +44,7 @@ Environment variables:
|
|||||||
object Object file output by `PROGRAMS ARGS'.
|
object Object file output by `PROGRAMS ARGS'.
|
||||||
DEPDIR directory where to store dependencies.
|
DEPDIR directory where to store dependencies.
|
||||||
depfile Dependency file to output.
|
depfile Dependency file to output.
|
||||||
tmpdepfile Temporary file to use when outputing dependencies.
|
tmpdepfile Temporary file to use when outputting dependencies.
|
||||||
libtool Whether libtool is used (yes/no).
|
libtool Whether libtool is used (yes/no).
|
||||||
|
|
||||||
Report bugs to <bug-automake@gnu.org>.
|
Report bugs to <bug-automake@gnu.org>.
|
||||||
@ -90,10 +90,18 @@ if test "$depmode" = msvcmsys; then
|
|||||||
# This is just like msvisualcpp but w/o cygpath translation.
|
# This is just like msvisualcpp but w/o cygpath translation.
|
||||||
# Just convert the backslash-escaped backslashes to single forward
|
# Just convert the backslash-escaped backslashes to single forward
|
||||||
# slashes to satisfy depend.m4
|
# slashes to satisfy depend.m4
|
||||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
cygpath_u='sed s,\\\\,/,g'
|
||||||
depmode=msvisualcpp
|
depmode=msvisualcpp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$depmode" = msvc7msys; then
|
||||||
|
# This is just like msvc7 but w/o cygpath translation.
|
||||||
|
# Just convert the backslash-escaped backslashes to single forward
|
||||||
|
# slashes to satisfy depend.m4
|
||||||
|
cygpath_u='sed s,\\\\,/,g'
|
||||||
|
depmode=msvc7
|
||||||
|
fi
|
||||||
|
|
||||||
case "$depmode" in
|
case "$depmode" in
|
||||||
gcc3)
|
gcc3)
|
||||||
## gcc 3 implements dependency tracking that does exactly what
|
## gcc 3 implements dependency tracking that does exactly what
|
||||||
@ -158,10 +166,12 @@ gcc)
|
|||||||
' < "$tmpdepfile" |
|
' < "$tmpdepfile" |
|
||||||
## Some versions of gcc put a space before the `:'. On the theory
|
## Some versions of gcc put a space before the `:'. On the theory
|
||||||
## that the space means something, we add a space to the output as
|
## that the space means something, we add a space to the output as
|
||||||
## well.
|
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||||
|
## to the object. Take care to not repeat it in the output.
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||||
|
| sed -e 's/$/ :/' >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -405,6 +415,52 @@ tru64)
|
|||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
msvc7)
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
showIncludes=-Wc,-showIncludes
|
||||||
|
else
|
||||||
|
showIncludes=-showIncludes
|
||||||
|
fi
|
||||||
|
"$@" $showIncludes > "$tmpdepfile"
|
||||||
|
stat=$?
|
||||||
|
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||||
|
if test "$stat" = 0; then :
|
||||||
|
else
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
# The first sed program below extracts the file names and escapes
|
||||||
|
# backslashes for cygpath. The second sed program outputs the file
|
||||||
|
# name when reading, but also accumulates all include files in the
|
||||||
|
# hold buffer in order to output them again at the end. This only
|
||||||
|
# works with sed implementations that can handle large buffers.
|
||||||
|
sed < "$tmpdepfile" -n '
|
||||||
|
/^Note: including file: *\(.*\)/ {
|
||||||
|
s//\1/
|
||||||
|
s/\\/\\\\/g
|
||||||
|
p
|
||||||
|
}' | $cygpath_u | sort -u | sed -n '
|
||||||
|
s/ /\\ /g
|
||||||
|
s/\(.*\)/ \1 \\/p
|
||||||
|
s/.\(.*\) \\/\1:/
|
||||||
|
H
|
||||||
|
$ {
|
||||||
|
s/.*/ /
|
||||||
|
G
|
||||||
|
p
|
||||||
|
}' >> "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
msvc7msys)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
#nosideeffect)
|
#nosideeffect)
|
||||||
# This comment above is used by automake to tell side-effect
|
# This comment above is used by automake to tell side-effect
|
||||||
# dependency tracking mechanisms from slower ones.
|
# dependency tracking mechanisms from slower ones.
|
||||||
@ -503,7 +559,9 @@ makedepend)
|
|||||||
touch "$tmpdepfile"
|
touch "$tmpdepfile"
|
||||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
# makedepend may prepend the VPATH from the source file name to the object.
|
||||||
|
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||||
|
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||||
' | \
|
' | \
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
|
@ -2,18 +2,19 @@
|
|||||||
#if 0 /* in case someone actually tries to compile this */
|
#if 0 /* in case someone actually tries to compile this */
|
||||||
|
|
||||||
/* example.c - an example of using libpng
|
/* example.c - an example of using libpng
|
||||||
* Last changed in libpng 1.2.37 [June 4, 2009]
|
* Last changed in libpng 1.5.10 [March 8, 2012]
|
||||||
* This file has been placed in the public domain by the authors.
|
* Maintained 1998-2012 Glenn Randers-Pehrson
|
||||||
* Maintained 1998-2010 Glenn Randers-Pehrson
|
* Maintained 1996, 1997 Andreas Dilger
|
||||||
* Maintained 1996, 1997 Andreas Dilger)
|
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This is an example of how to use libpng to read and write PNG files.
|
/* This is an example of how to use libpng to read and write PNG files.
|
||||||
* The file libpng.txt is much more verbose then this. If you have not
|
* 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
|
* 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
|
* implementation. This is not officially part of libpng, is hereby placed
|
||||||
* in the public domain, and therefore does not require a copyright notice.
|
* in the public domain, and therefore does not require a copyright notice.
|
||||||
|
* To the extent possible under law, the authors have waived all copyright and
|
||||||
|
* related or neighboring rights to this file.
|
||||||
*
|
*
|
||||||
* This file does not currently compile, because it is missing certain
|
* This file does not currently compile, because it is missing certain
|
||||||
* parts, like allocating memory to hold an image. You will have to
|
* parts, like allocating memory to hold an image. You will have to
|
||||||
@ -22,6 +23,10 @@
|
|||||||
* see also the programs in the contrib directory.
|
* see also the programs in the contrib directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _POSIX_SOURCE 1 /* libpng and zlib are POSIX-compliant. You may
|
||||||
|
* change this if your application uses non-POSIX
|
||||||
|
* extensions. */
|
||||||
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* The png_jmpbuf() macro, used in error handling, became available in
|
/* The png_jmpbuf() macro, used in error handling, became available in
|
||||||
@ -31,7 +36,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef png_jmpbuf
|
#ifndef png_jmpbuf
|
||||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
# define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
|
||||||
@ -121,7 +126,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
|
png_destroy_read_struct(&png_ptr, NULL, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +138,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
if (setjmp(png_jmpbuf(png_ptr)))
|
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, png_infopp_NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
fclose(fp);
|
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);
|
return (ERROR);
|
||||||
@ -160,11 +165,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
* 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
|
* and you need to specify only transforms that can be controlled
|
||||||
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
* with one of the PNG_TRANSFORM_* bits (this presently excludes
|
||||||
* dithering, filling, setting background, and doing gamma
|
* quantizing, filling, setting background, and doing gamma
|
||||||
* adjustment), then you can read the entire image (including
|
* adjustment), then you can read the entire image (including
|
||||||
* pixels) into the info structure with this call:
|
* pixels) into the info structure with this call:
|
||||||
*/
|
*/
|
||||||
png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
png_read_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||||
|
|
||||||
#else
|
#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 */
|
||||||
@ -175,7 +180,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
&interlace_type, int_p_NULL, int_p_NULL);
|
&interlace_type, NULL, NULL);
|
||||||
|
|
||||||
/* Set up the data transformations you want. Note that these are all
|
/* Set up the data transformations you want. Note that these are all
|
||||||
* optional. Only call them if you want/need them. Many of the
|
* optional. Only call them if you want/need them. Many of the
|
||||||
@ -183,8 +188,15 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
* are mutually exclusive.
|
* are mutually exclusive.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Tell libpng to strip 16 bit/color files down to 8 bits/color */
|
/* Tell libpng to strip 16 bit/color files down to 8 bits/color.
|
||||||
|
* Use accurate scaling if it's available, otherwise just chop off the
|
||||||
|
* low byte.
|
||||||
|
*/
|
||||||
|
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||||
|
png_set_scale_16(png_ptr);
|
||||||
|
#else
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Strip alpha bytes from the input data without combining with the
|
/* Strip alpha bytes from the input data without combining with the
|
||||||
* background (not recommended).
|
* background (not recommended).
|
||||||
@ -271,7 +283,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dither RGB files down to 8 bit palette or reduce palettes
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
/* Quantize RGB files down to 8 bit palette or reduce palettes
|
||||||
* to the number of colors available on your screen.
|
* to the number of colors available on your screen.
|
||||||
*/
|
*/
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||||
@ -282,11 +295,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
/* This reduces the image to the application supplied palette */
|
/* This reduces the image to the application supplied palette */
|
||||||
if (/* We have our own palette */)
|
if (/* We have our own palette */)
|
||||||
{
|
{
|
||||||
/* An array of colors to which the image should be dithered */
|
/* An array of colors to which the image should be quantized */
|
||||||
png_color std_color_cube[MAX_SCREEN_COLORS];
|
png_color std_color_cube[MAX_SCREEN_COLORS];
|
||||||
|
|
||||||
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
|
||||||
MAX_SCREEN_COLORS, png_uint_16p_NULL, 0);
|
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))
|
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
||||||
@ -295,10 +308,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
|
|
||||||
png_get_hIST(png_ptr, info_ptr, &histogram);
|
png_get_hIST(png_ptr, info_ptr, &histogram);
|
||||||
|
|
||||||
png_set_dither(png_ptr, palette, num_palette,
|
png_set_quantize(png_ptr, palette, num_palette,
|
||||||
max_screen_colors, histogram, 0);
|
max_screen_colors, histogram, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
||||||
|
|
||||||
/* 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);
|
png_set_invert_mono(png_ptr);
|
||||||
@ -328,11 +342,16 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
/* 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, 0xff, PNG_FILLER_AFTER);
|
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
|
||||||
|
|
||||||
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
/* Turn on interlace handling. REQUIRED if you are not using
|
/* Turn on interlace handling. REQUIRED if you are not using
|
||||||
* png_read_image(). To see how to handle interlacing passes,
|
* png_read_image(). To see how to handle interlacing passes,
|
||||||
* see the png_read_row() method below:
|
* see the png_read_row() method below:
|
||||||
*/
|
*/
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
|
#else
|
||||||
|
number_passes = 1;
|
||||||
|
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||||
|
|
||||||
|
|
||||||
/* Optional call to gamma correct and add the background to the palette
|
/* Optional call to gamma correct and add the background to the palette
|
||||||
* and update info structure. REQUIRED if you are expecting libpng to
|
* and update info structure. REQUIRED if you are expecting libpng to
|
||||||
@ -365,17 +384,17 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
#ifdef single /* Read the image a single row at a time */
|
#ifdef single /* Read the image a single row at a time */
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, 1);
|
png_read_rows(png_ptr, &row_pointers[y], NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else no_single /* Read the image several rows at a time */
|
#else no_single /* Read the image several rows at a time */
|
||||||
for (y = 0; y < height; y += number_of_rows)
|
for (y = 0; y < height; y += number_of_rows)
|
||||||
{
|
{
|
||||||
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
#ifdef sparkle /* Read the image using the "sparkle" effect. */
|
||||||
png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL,
|
png_read_rows(png_ptr, &row_pointers[y], NULL,
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
#else no_sparkle /* Read the image using the "rectangle" effect */
|
#else no_sparkle /* Read the image using the "rectangle" effect */
|
||||||
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y],
|
png_read_rows(png_ptr, NULL, &row_pointers[y],
|
||||||
number_of_rows);
|
number_of_rows);
|
||||||
#endif no_sparkle /* Use only one of these two methods */
|
#endif no_sparkle /* Use only one of these two methods */
|
||||||
}
|
}
|
||||||
@ -392,7 +411,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
|||||||
/* 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, png_infopp_NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
|
|
||||||
/* Close the file */
|
/* Close the file */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -425,13 +444,13 @@ initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
|
|||||||
|
|
||||||
if (*info_ptr == NULL)
|
if (*info_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_jmpbuf((*png_ptr))))
|
if (setjmp(png_jmpbuf((*png_ptr))))
|
||||||
{
|
{
|
||||||
png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,7 +479,7 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
|
|||||||
if (setjmp(png_jmpbuf((*png_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, png_infopp_NULL);
|
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,6 +533,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
|||||||
*/
|
*/
|
||||||
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
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.
|
* data to the corresponding row data.
|
||||||
*/
|
*/
|
||||||
@ -542,6 +562,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
|||||||
* to pass the current row as new_row, and the function will combine
|
* to pass the current row as new_row, and the function will combine
|
||||||
* the old row and the new row.
|
* the old row and the new row.
|
||||||
*/
|
*/
|
||||||
|
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||||
}
|
}
|
||||||
|
|
||||||
end_callback(png_structp png_ptr, png_infop info)
|
end_callback(png_structp png_ptr, png_infop info)
|
||||||
@ -590,7 +611,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
png_destroy_write_struct(&png_ptr, png_infopp_NULL);
|
png_destroy_write_struct(&png_ptr, NULL);
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +646,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
* image info living in the structure. You could "|" many
|
* image info living in the structure. You could "|" many
|
||||||
* PNG_TRANSFORM flags into the png_transforms integer here.
|
* PNG_TRANSFORM flags into the png_transforms integer here.
|
||||||
*/
|
*/
|
||||||
png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
|
png_write_png(png_ptr, info_ptr, png_transforms, NULL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* This is the hard way */
|
/* This is the hard way */
|
||||||
@ -653,14 +674,18 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
|
|
||||||
/* Optional significant bit (sBIT) chunk */
|
/* Optional significant bit (sBIT) chunk */
|
||||||
png_color_8 sig_bit;
|
png_color_8 sig_bit;
|
||||||
|
|
||||||
/* If we are dealing with a grayscale image then */
|
/* If we are dealing with a grayscale image then */
|
||||||
sig_bit.gray = true_bit_depth;
|
sig_bit.gray = true_bit_depth;
|
||||||
|
|
||||||
/* Otherwise, if we are dealing with a color image then */
|
/* Otherwise, if we are dealing with a color image then */
|
||||||
sig_bit.red = true_red_bit_depth;
|
sig_bit.red = true_red_bit_depth;
|
||||||
sig_bit.green = true_green_bit_depth;
|
sig_bit.green = true_green_bit_depth;
|
||||||
sig_bit.blue = true_blue_bit_depth;
|
sig_bit.blue = true_blue_bit_depth;
|
||||||
|
|
||||||
/* If the image has an alpha channel then */
|
/* If the image has an alpha channel then */
|
||||||
sig_bit.alpha = true_alpha_bit_depth;
|
sig_bit.alpha = true_alpha_bit_depth;
|
||||||
|
|
||||||
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||||
|
|
||||||
|
|
||||||
@ -670,21 +695,38 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
png_set_gAMA(png_ptr, info_ptr, gamma);
|
png_set_gAMA(png_ptr, info_ptr, gamma);
|
||||||
|
|
||||||
/* Optionally write comments into the image */
|
/* Optionally write comments into the image */
|
||||||
text_ptr[0].key = "Title";
|
{
|
||||||
text_ptr[0].text = "Mona Lisa";
|
png_text text_ptr[3];
|
||||||
|
|
||||||
|
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;
|
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text_ptr[1].key = "Author";
|
text_ptr[0].itxt_length = 0;
|
||||||
text_ptr[1].text = "Leonardo DaVinci";
|
|
||||||
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
|
||||||
text_ptr[2].key = "Description";
|
|
||||||
text_ptr[2].text = "<long text>";
|
|
||||||
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
|
||||||
#ifdef PNG_iTXt_SUPPORTED
|
|
||||||
text_ptr[0].lang = NULL;
|
text_ptr[0].lang = NULL;
|
||||||
|
text_ptr[0].lang_key = NULL;
|
||||||
|
|
||||||
|
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;
|
||||||
|
text_ptr[1].itxt_length = 0;
|
||||||
text_ptr[1].lang = NULL;
|
text_ptr[1].lang = NULL;
|
||||||
|
text_ptr[1].lang_key = NULL;
|
||||||
|
|
||||||
|
char key2[]="Description";
|
||||||
|
char text2[]="<long text>";
|
||||||
|
text_ptr[2].key = key2;
|
||||||
|
text_ptr[2].text = text2;
|
||||||
|
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||||
|
text_ptr[2].itxt_length = 0;
|
||||||
text_ptr[2].lang = NULL;
|
text_ptr[2].lang = NULL;
|
||||||
#endif
|
text_ptr[2].lang_key = NULL;
|
||||||
png_set_text(png_ptr, info_ptr, text_ptr, 3);
|
|
||||||
|
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 */
|
||||||
|
|
||||||
@ -748,6 +790,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
|||||||
/* 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)
|
if (interlacing)
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
else
|
else
|
||||||
number_passes = 1;
|
number_passes = 1;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# install - install a program, script, or datafile
|
# install - install a program, script, or datafile
|
||||||
|
|
||||||
scriptversion=2009-04-28.21; # UTC
|
scriptversion=2011-01-19.21; # UTC
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||||
@ -156,6 +156,10 @@ while test $# -ne 0; do
|
|||||||
-s) stripcmd=$stripprog;;
|
-s) stripcmd=$stripprog;;
|
||||||
|
|
||||||
-t) dst_arg=$2
|
-t) dst_arg=$2
|
||||||
|
# Protect names problematic for `test' and other utilities.
|
||||||
|
case $dst_arg in
|
||||||
|
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||||
|
esac
|
||||||
shift;;
|
shift;;
|
||||||
|
|
||||||
-T) no_target_directory=true;;
|
-T) no_target_directory=true;;
|
||||||
@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
|||||||
fi
|
fi
|
||||||
shift # arg
|
shift # arg
|
||||||
dst_arg=$arg
|
dst_arg=$arg
|
||||||
|
# Protect names problematic for `test' and other utilities.
|
||||||
|
case $dst_arg in
|
||||||
|
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -200,7 +208,11 @@ if test $# -eq 0; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dir_arg"; then
|
if test -z "$dir_arg"; then
|
||||||
trap '(exit $?); exit' 1 2 13 15
|
do_exit='(exit $ret); exit $ret'
|
||||||
|
trap "ret=129; $do_exit" 1
|
||||||
|
trap "ret=130; $do_exit" 2
|
||||||
|
trap "ret=141; $do_exit" 13
|
||||||
|
trap "ret=143; $do_exit" 15
|
||||||
|
|
||||||
# Set umask so as not to create temps with too-generous modes.
|
# Set umask so as not to create temps with too-generous modes.
|
||||||
# However, 'strip' requires both read and write access to temps.
|
# However, 'strip' requires both read and write access to temps.
|
||||||
@ -228,9 +240,9 @@ fi
|
|||||||
|
|
||||||
for src
|
for src
|
||||||
do
|
do
|
||||||
# Protect names starting with `-'.
|
# Protect names problematic for `test' and other utilities.
|
||||||
case $src in
|
case $src in
|
||||||
-*) src=./$src;;
|
-* | [=\(\)!]) src=./$src;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
if test -n "$dir_arg"; then
|
||||||
@ -252,12 +264,7 @@ do
|
|||||||
echo "$0: no destination specified." >&2
|
echo "$0: no destination specified." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dst=$dst_arg
|
dst=$dst_arg
|
||||||
# Protect names starting with `-'.
|
|
||||||
case $dst in
|
|
||||||
-*) dst=./$dst;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; won't work
|
# If destination is a directory, append the input filename; won't work
|
||||||
# if double slashes aren't ignored.
|
# if double slashes aren't ignored.
|
||||||
@ -385,7 +392,7 @@ do
|
|||||||
|
|
||||||
case $dstdir in
|
case $dstdir in
|
||||||
/*) prefix='/';;
|
/*) prefix='/';;
|
||||||
-*) prefix='./';;
|
[-=\(\)!]*) prefix='./';;
|
||||||
*) prefix='';;
|
*) prefix='';;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -403,7 +410,7 @@ do
|
|||||||
|
|
||||||
for d
|
for d
|
||||||
do
|
do
|
||||||
test -z "$d" && continue
|
test X"$d" = X && continue
|
||||||
|
|
||||||
prefix=$prefix$d
|
prefix=$prefix$d
|
||||||
if test -d "$prefix"; then
|
if test -d "$prefix"; then
|
||||||
|
127
jni/libpng/libpng-config.in
Executable file
@ -0,0 +1,127 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
# libpng-config
|
||||||
|
# provides configuration info for libpng.
|
||||||
|
|
||||||
|
# Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson
|
||||||
|
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
# Modeled after libxml-config.
|
||||||
|
|
||||||
|
version="@PNGLIB_VERSION@"
|
||||||
|
prefix="@prefix@"
|
||||||
|
exec_prefix="@exec_prefix@"
|
||||||
|
libdir="@libdir@"
|
||||||
|
includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
|
||||||
|
libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
|
||||||
|
all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@"
|
||||||
|
I_opts="-I${includedir}"
|
||||||
|
L_opts="-L${libdir}"
|
||||||
|
R_opts=""
|
||||||
|
cppflags=""
|
||||||
|
ccopts=""
|
||||||
|
ldopts=""
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 [OPTION] ...
|
||||||
|
|
||||||
|
Known values for OPTION are:
|
||||||
|
|
||||||
|
--prefix print libpng prefix
|
||||||
|
--libdir print path to directory containing library
|
||||||
|
--libs print library linking information
|
||||||
|
--ccopts print compiler options
|
||||||
|
--cppflags print pre-processor flags
|
||||||
|
--cflags print preprocessor flags, I_opts, and compiler options
|
||||||
|
--I_opts print "-I" include options
|
||||||
|
--L_opts print linker "-L" flags for dynamic linking
|
||||||
|
--R_opts print dynamic linker "-R" or "-rpath" flags
|
||||||
|
--ldopts print linker options
|
||||||
|
--ldflags print linker flags (ldopts, L_opts, R_opts, and libs)
|
||||||
|
--static revise subsequent outputs for static linking
|
||||||
|
--help print this help and exit
|
||||||
|
--version print version information
|
||||||
|
EOF
|
||||||
|
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
if test $# -eq 0; then
|
||||||
|
usage 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
|
--prefix)
|
||||||
|
echo ${prefix}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--version)
|
||||||
|
echo ${version}
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
--help)
|
||||||
|
usage 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
--ccopts)
|
||||||
|
echo ${ccopts}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--cppflags)
|
||||||
|
echo ${cppflags}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--cflags)
|
||||||
|
echo ${I_opts} ${cppflags} ${ccopts}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--libdir)
|
||||||
|
echo ${libdir}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--libs)
|
||||||
|
echo ${libs}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--I_opts)
|
||||||
|
echo ${I_opts}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--L_opts)
|
||||||
|
echo ${L_opts}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--R_opts)
|
||||||
|
echo ${R_opts}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--ldopts)
|
||||||
|
echo ${ldopts}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--ldflags)
|
||||||
|
echo ${ldopts} ${L_opts} ${R_opts} ${libs}
|
||||||
|
;;
|
||||||
|
|
||||||
|
--static)
|
||||||
|
R_opts=""
|
||||||
|
libs=${all_libs}
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
4652
jni/libpng/libpng-manual.txt
Normal file
2794
jni/libpng/libpng.3
11
jni/libpng/libpng.pc.in
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
|
||||||
|
Name: libpng
|
||||||
|
Description: Loads and saves PNG files
|
||||||
|
Version: @PNGLIB_VERSION@
|
||||||
|
Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
Libs.private: @LIBS@
|
||||||
|
Cflags: -I${includedir}
|
@ -1,806 +1,28 @@
|
|||||||
.TH LIBPNGPF 3 "July 9, 2011"
|
.TH LIBPNGPF 3 "March 29, 2012"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.46
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.10
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include <png.h>\fP
|
\fB#include \fI"pngpriv.h"
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBvoid png_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fI*hi_product,
|
\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now \fIthat
|
||||||
|
|
||||||
\fBunsigned long \fI*lo_product\fP\fB);\fP
|
\fBthe private function prototypes are hidden in pngpriv.h and not \fIaccessible
|
||||||
|
|
||||||
\fI\fB
|
\fBto applications. Look in pngpriv.h for the prototypes and a short \fIdescription
|
||||||
|
|
||||||
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBint png_check_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_fixed_point \fP\fIint_white_x\fP\fB, png_fixed_point \fP\fIint_white_y\fP\fB, png_fixed_point \fP\fIint_red_x\fP\fB, png_fixed_point \fP\fIint_red_y\fP\fB, png_fixed_point \fP\fIint_green_x\fP\fB, png_fixed_point \fP\fIint_green_y\fP\fB, png_fixed_point \fP\fIint_blue_x\fP\fB, png_fixed_point \fIint_blue_y\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
\fBof each \fIfunction.
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBpng_uint_32 png_read_chunk_header (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
The functions listed above are used privately by libpng
|
The functions previously listed here are used privately by libpng
|
||||||
and are not recommended for use by applications. They are
|
and are not recommended for use by applications. They are
|
||||||
not "exported" to applications using shared libraries. They
|
not "exported" to applications using shared libraries.
|
||||||
are listed alphabetically here as an aid to libpng maintainers.
|
|
||||||
See png.h for more information on these functions.
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.IR libpng(3) ", " png(5)
|
.BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
|
3853
jni/libpng/ltmain.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "July 9, 2011"
|
.TH PNG 5 "March 29, 2012"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@ -18,7 +18,7 @@ gamma and chromaticity data for improved color matching on heterogeneous
|
|||||||
platforms.
|
platforms.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.IR libpng(3) ", " zlib(3) ", " deflate(5) ", and " zlib(5)
|
.BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
|
||||||
.LP
|
.LP
|
||||||
PNG specification (second edition), November 2003:
|
PNG specification (second edition), November 2003:
|
||||||
.IP
|
.IP
|
||||||
@ -35,7 +35,7 @@ PNG 1.0 specification, October 1996:
|
|||||||
RFC 2083
|
RFC 2083
|
||||||
.IP
|
.IP
|
||||||
.br
|
.br
|
||||||
ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
|
ftp://ds.internic.net/rfc/rfc2083.txt
|
||||||
.br
|
.br
|
||||||
or (as a W3C Recommendation) at
|
or (as a W3C Recommendation) at
|
||||||
.br
|
.br
|
||||||
|
2514
jni/libpng/png.c
3930
jni/libpng/png.h
1881
jni/libpng/pngconf.h
157
jni/libpng/pngdebug.h
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
|
||||||
|
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
*
|
||||||
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define PNG_DEBUG at compile time for debugging information. Higher
|
||||||
|
* numbers for PNG_DEBUG mean more debugging information. This has
|
||||||
|
* only been added since version 0.95 so it is not implemented throughout
|
||||||
|
* libpng yet, but more support will be added as needed.
|
||||||
|
*
|
||||||
|
* png_debug[1-2]?(level, message ,arg{0-2})
|
||||||
|
* Expands to a statement (either a simple expression or a compound
|
||||||
|
* do..while(0) statement) that outputs a message with parameter
|
||||||
|
* substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
|
||||||
|
* is undefined, 0 or 1 every png_debug expands to a simple expression
|
||||||
|
* (actually ((void)0)).
|
||||||
|
*
|
||||||
|
* level: level of detail of message, starting at 0. A level 'n'
|
||||||
|
* message is preceded by 'n' tab characters (not implemented
|
||||||
|
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
||||||
|
* defined, to allow debug DLL compilation with no standard IO).
|
||||||
|
* message: a printf(3) style text string. A trailing '\n' is added
|
||||||
|
* to the message.
|
||||||
|
* arg: 0 to 2 arguments for printf(3) style substitution in message.
|
||||||
|
*/
|
||||||
|
#ifndef PNGDEBUG_H
|
||||||
|
#define PNGDEBUG_H
|
||||||
|
/* These settings control the formatting of messages in png.c and pngerror.c */
|
||||||
|
/* Moved to pngdebug.h at 1.5.0 */
|
||||||
|
# ifndef PNG_LITERAL_SHARP
|
||||||
|
# define PNG_LITERAL_SHARP 0x23
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
|
||||||
|
# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
|
||||||
|
# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_STRING_NEWLINE
|
||||||
|
# define PNG_STRING_NEWLINE "\n"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#ifdef PNG_DEBUG
|
||||||
|
# if (PNG_DEBUG > 0)
|
||||||
|
# if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
|
||||||
|
# include <crtdbg.h>
|
||||||
|
# if (PNG_DEBUG > 1)
|
||||||
|
# ifndef _DEBUG
|
||||||
|
# define _DEBUG
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug
|
||||||
|
# define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug1
|
||||||
|
# define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug2
|
||||||
|
# define png_debug2(l,m,p1,p2) \
|
||||||
|
_RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# else /* PNG_DEBUG_FILE || !_MSC_VER */
|
||||||
|
# ifndef PNG_STDIO_SUPPORTED
|
||||||
|
# include <stdio.h> /* not included yet */
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_DEBUG_FILE
|
||||||
|
# define PNG_DEBUG_FILE stderr
|
||||||
|
# endif /* PNG_DEBUG_FILE */
|
||||||
|
|
||||||
|
# if (PNG_DEBUG > 1)
|
||||||
|
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
|
||||||
|
* non-ISO compilers
|
||||||
|
*/
|
||||||
|
# ifdef __STDC__
|
||||||
|
# ifndef png_debug
|
||||||
|
# define png_debug(l,m) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug1
|
||||||
|
# define png_debug1(l,m,p1) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug2
|
||||||
|
# define png_debug2(l,m,p1,p2) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# else /* __STDC __ */
|
||||||
|
# ifndef png_debug
|
||||||
|
# define png_debug(l,m) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
char format[256]; \
|
||||||
|
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||||
|
m,PNG_STRING_NEWLINE); \
|
||||||
|
fprintf(PNG_DEBUG_FILE,format); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug1
|
||||||
|
# define png_debug1(l,m,p1) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
char format[256]; \
|
||||||
|
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||||
|
m,PNG_STRING_NEWLINE); \
|
||||||
|
fprintf(PNG_DEBUG_FILE,format,p1); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# ifndef png_debug2
|
||||||
|
# define png_debug2(l,m,p1,p2) \
|
||||||
|
do { \
|
||||||
|
int num_tabs=l; \
|
||||||
|
char format[256]; \
|
||||||
|
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||||
|
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||||
|
m,PNG_STRING_NEWLINE); \
|
||||||
|
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
# endif /* __STDC __ */
|
||||||
|
# endif /* (PNG_DEBUG > 1) */
|
||||||
|
|
||||||
|
# endif /* _MSC_VER */
|
||||||
|
# endif /* (PNG_DEBUG > 0) */
|
||||||
|
#endif /* PNG_DEBUG */
|
||||||
|
#ifndef png_debug
|
||||||
|
# define png_debug(l, m) ((void)0)
|
||||||
|
#endif
|
||||||
|
#ifndef png_debug1
|
||||||
|
# define png_debug1(l, m, p1) ((void)0)
|
||||||
|
#endif
|
||||||
|
#ifndef png_debug2
|
||||||
|
# define png_debug2(l, m, p1, p2) ((void)0)
|
||||||
|
#endif
|
||||||
|
#endif /* PNGDEBUG_H */
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.45 [July 7, 2011]
|
* Last changed in libpng 1.5.8 [February 1, 2011]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -16,14 +16,13 @@
|
|||||||
* at each function.
|
* at each function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
|
||||||
#include "png.h"
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
||||||
static void /* PRIVATE */
|
static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
|
||||||
png_default_error PNGARG((png_structp png_ptr,
|
png_const_charp error_message)),PNG_NORETURN);
|
||||||
png_const_charp error_message)) PNG_NORETURN;
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning PNGARG((png_structp png_ptr,
|
png_default_warning PNGARG((png_structp png_ptr,
|
||||||
@ -36,8 +35,8 @@ png_default_warning PNGARG((png_structp png_ptr,
|
|||||||
* to replace the error function at run-time.
|
* to replace the error function at run-time.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
||||||
void PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_error(png_structp png_ptr, png_const_charp error_message)
|
png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
char msg[16];
|
char msg[16];
|
||||||
@ -53,6 +52,7 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
for (offset = 1; offset<15; offset++)
|
for (offset = 1; offset<15; offset++)
|
||||||
if (error_message[offset] == ' ')
|
if (error_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -61,9 +61,11 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
msg[i - 1] = '\0';
|
msg[i - 1] = '\0';
|
||||||
error_message = msg;
|
error_message = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
error_message += offset;
|
error_message += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||||
@ -84,10 +86,10 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
png_default_error(png_ptr, error_message);
|
png_default_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_err(png_structp png_ptr)
|
png_err,(png_structp png_ptr),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
/* Prior to 1.2.45 the error_fn received a NULL pointer, expressed
|
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
|
||||||
* erroneously as '\0', instead of the empty string "". This was
|
* erroneously as '\0', instead of the empty string "". This was
|
||||||
* apparently an error, introduced in libpng-1.2.20, and png_default_error
|
* apparently an error, introduced in libpng-1.2.20, and png_default_error
|
||||||
* will crash in this case.
|
* will crash in this case.
|
||||||
@ -101,6 +103,107 @@ png_err(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
#endif /* PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* PNG_ERROR_TEXT_SUPPORTED */
|
||||||
|
|
||||||
|
/* Utility to safely appends strings to a buffer. This never errors out so
|
||||||
|
* error checking is not required in the caller.
|
||||||
|
*/
|
||||||
|
size_t
|
||||||
|
png_safecat(png_charp buffer, size_t bufsize, size_t pos,
|
||||||
|
png_const_charp string)
|
||||||
|
{
|
||||||
|
if (buffer != NULL && pos < bufsize)
|
||||||
|
{
|
||||||
|
if (string != NULL)
|
||||||
|
while (*string != '\0' && pos < bufsize-1)
|
||||||
|
buffer[pos++] = *string++;
|
||||||
|
|
||||||
|
buffer[pos] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED)
|
||||||
|
/* Utility to dump an unsigned value into a buffer, given a start pointer and
|
||||||
|
* and end pointer (which should point just *beyond* the end of the buffer!)
|
||||||
|
* Returns the pointer to the start of the formatted string.
|
||||||
|
*/
|
||||||
|
png_charp
|
||||||
|
png_format_number(png_const_charp start, png_charp end, int format,
|
||||||
|
png_alloc_size_t number)
|
||||||
|
{
|
||||||
|
int count = 0; /* number of digits output */
|
||||||
|
int mincount = 1; /* minimum number required */
|
||||||
|
int output = 0; /* digit output (for the fixed point format) */
|
||||||
|
|
||||||
|
*--end = '\0';
|
||||||
|
|
||||||
|
/* This is written so that the loop always runs at least once, even with
|
||||||
|
* number zero.
|
||||||
|
*/
|
||||||
|
while (end > start && (number != 0 || count < mincount))
|
||||||
|
{
|
||||||
|
|
||||||
|
static const char digits[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
|
switch (format)
|
||||||
|
{
|
||||||
|
case PNG_NUMBER_FORMAT_fixed:
|
||||||
|
/* Needs five digits (the fraction) */
|
||||||
|
mincount = 5;
|
||||||
|
if (output || number % 10 != 0)
|
||||||
|
{
|
||||||
|
*--end = digits[number % 10];
|
||||||
|
output = 1;
|
||||||
|
}
|
||||||
|
number /= 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PNG_NUMBER_FORMAT_02u:
|
||||||
|
/* Expects at least 2 digits. */
|
||||||
|
mincount = 2;
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
|
case PNG_NUMBER_FORMAT_u:
|
||||||
|
*--end = digits[number % 10];
|
||||||
|
number /= 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PNG_NUMBER_FORMAT_02x:
|
||||||
|
/* This format expects at least two digits */
|
||||||
|
mincount = 2;
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
|
case PNG_NUMBER_FORMAT_x:
|
||||||
|
*--end = digits[number & 0xf];
|
||||||
|
number >>= 4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* an error */
|
||||||
|
number = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep track of the number of digits added */
|
||||||
|
++count;
|
||||||
|
|
||||||
|
/* Float a fixed number here: */
|
||||||
|
if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
|
||||||
|
{
|
||||||
|
/* End of the fraction, but maybe nothing was output? In that case
|
||||||
|
* drop the decimal point. If the number is a true zero handle that
|
||||||
|
* here.
|
||||||
|
*/
|
||||||
|
if (output)
|
||||||
|
*--end = '.';
|
||||||
|
else if (number == 0) /* and !output */
|
||||||
|
*--end = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
/* This function is called whenever there is a non-fatal error. This function
|
/* This function is called whenever there is a non-fatal error. This function
|
||||||
* should not be changed. If there is a need to handle warnings differently,
|
* should not be changed. If there is a need to handle warnings differently,
|
||||||
@ -131,6 +234,124 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
else
|
else
|
||||||
png_default_warning(png_ptr, warning_message + offset);
|
png_default_warning(png_ptr, warning_message + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* These functions support 'formatted' warning messages with up to
|
||||||
|
* PNG_WARNING_PARAMETER_COUNT parameters. In the format string the parameter
|
||||||
|
* is introduced by @<number>, where 'number' starts at 1. This follows the
|
||||||
|
* standard established by X/Open for internationalizable error messages.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
png_warning_parameter(png_warning_parameters p, int number,
|
||||||
|
png_const_charp string)
|
||||||
|
{
|
||||||
|
if (number > 0 && number <= PNG_WARNING_PARAMETER_COUNT)
|
||||||
|
(void)png_safecat(p[number-1], (sizeof p[number-1]), 0, string);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
|
||||||
|
png_alloc_size_t value)
|
||||||
|
{
|
||||||
|
char buffer[PNG_NUMBER_BUFFER_SIZE];
|
||||||
|
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
png_warning_parameter_signed(png_warning_parameters p, int number, int format,
|
||||||
|
png_int_32 value)
|
||||||
|
{
|
||||||
|
png_alloc_size_t u;
|
||||||
|
png_charp str;
|
||||||
|
char buffer[PNG_NUMBER_BUFFER_SIZE];
|
||||||
|
|
||||||
|
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
|
||||||
|
u = (png_alloc_size_t)value;
|
||||||
|
if (value < 0)
|
||||||
|
u = ~u + 1;
|
||||||
|
|
||||||
|
str = PNG_FORMAT_NUMBER(buffer, format, u);
|
||||||
|
|
||||||
|
if (value < 0 && str > buffer)
|
||||||
|
*--str = '-';
|
||||||
|
|
||||||
|
png_warning_parameter(p, number, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
|
||||||
|
png_const_charp message)
|
||||||
|
{
|
||||||
|
/* The internal buffer is just 192 bytes - enough for all our messages,
|
||||||
|
* overflow doesn't happen because this code checks! If someone figures
|
||||||
|
* out how to send us a message longer than 192 bytes, all that will
|
||||||
|
* happen is that the message will be truncated appropriately.
|
||||||
|
*/
|
||||||
|
size_t i = 0; /* Index in the msg[] buffer: */
|
||||||
|
char msg[192];
|
||||||
|
|
||||||
|
/* Each iteration through the following loop writes at most one character
|
||||||
|
* to msg[i++] then returns here to validate that there is still space for
|
||||||
|
* the trailing '\0'. It may (in the case of a parameter) read more than
|
||||||
|
* one character from message[]; it must check for '\0' and continue to the
|
||||||
|
* test if it finds the end of string.
|
||||||
|
*/
|
||||||
|
while (i<(sizeof msg)-1 && *message != '\0')
|
||||||
|
{
|
||||||
|
/* '@' at end of string is now just printed (previously it was skipped);
|
||||||
|
* it is an error in the calling code to terminate the string with @.
|
||||||
|
*/
|
||||||
|
if (p != NULL && *message == '@' && message[1] != '\0')
|
||||||
|
{
|
||||||
|
int parameter_char = *++message; /* Consume the '@' */
|
||||||
|
static const char valid_parameters[] = "123456789";
|
||||||
|
int parameter = 0;
|
||||||
|
|
||||||
|
/* Search for the parameter digit, the index in the string is the
|
||||||
|
* parameter to use.
|
||||||
|
*/
|
||||||
|
while (valid_parameters[parameter] != parameter_char &&
|
||||||
|
valid_parameters[parameter] != '\0')
|
||||||
|
++parameter;
|
||||||
|
|
||||||
|
/* If the parameter digit is out of range it will just get printed. */
|
||||||
|
if (parameter < PNG_WARNING_PARAMETER_COUNT)
|
||||||
|
{
|
||||||
|
/* Append this parameter */
|
||||||
|
png_const_charp parm = p[parameter];
|
||||||
|
png_const_charp pend = p[parameter] + (sizeof p[parameter]);
|
||||||
|
|
||||||
|
/* No need to copy the trailing '\0' here, but there is no guarantee
|
||||||
|
* that parm[] has been initialized, so there is no guarantee of a
|
||||||
|
* trailing '\0':
|
||||||
|
*/
|
||||||
|
while (i<(sizeof msg)-1 && *parm != '\0' && parm < pend)
|
||||||
|
msg[i++] = *parm++;
|
||||||
|
|
||||||
|
/* Consume the parameter digit too: */
|
||||||
|
++message;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* else not a parameter and there is a character after the @ sign; just
|
||||||
|
* copy that. This is known not to be '\0' because of the test above.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* At this point *message can't be '\0', even in the bad parameter case
|
||||||
|
* above where there is a lone '@' at the end of the message string.
|
||||||
|
*/
|
||||||
|
msg[i++] = *message++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i is always less than (sizeof msg), so: */
|
||||||
|
msg[i] = '\0';
|
||||||
|
|
||||||
|
/* And this is the formatted message, it may be larger than
|
||||||
|
* PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these are
|
||||||
|
* not (currently) formatted.
|
||||||
|
*/
|
||||||
|
png_warning(png_ptr, msg);
|
||||||
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
@ -162,11 +383,14 @@ static void /* PRIVATE */
|
|||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
{
|
{
|
||||||
int iout = 0, iin = 0;
|
png_uint_32 chunk_name = png_ptr->chunk_name;
|
||||||
|
int iout = 0, ishift = 24;
|
||||||
|
|
||||||
while (iin < 4)
|
while (ishift >= 0)
|
||||||
{
|
{
|
||||||
int c = png_ptr->chunk_name[iin++];
|
int c = (int)(chunk_name >> ishift) & 0xff;
|
||||||
|
|
||||||
|
ishift -= 8;
|
||||||
if (isnonalpha(c))
|
if (isnonalpha(c))
|
||||||
{
|
{
|
||||||
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
||||||
@ -174,20 +398,23 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
buffer[iout++] = png_digit[c & 0x0f];
|
buffer[iout++] = png_digit[c & 0x0f];
|
||||||
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
|
buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[iout++] = (png_byte)c;
|
buffer[iout++] = (char)c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_message == NULL)
|
if (error_message == NULL)
|
||||||
buffer[iout] = '\0';
|
buffer[iout] = '\0';
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int iin = 0;
|
||||||
|
|
||||||
buffer[iout++] = ':';
|
buffer[iout++] = ':';
|
||||||
buffer[iout++] = ' ';
|
buffer[iout++] = ' ';
|
||||||
|
|
||||||
iin = 0;
|
|
||||||
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
|
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
|
||||||
buffer[iout++] = error_message[iin++];
|
buffer[iout++] = error_message[iin++];
|
||||||
|
|
||||||
@ -195,22 +422,24 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
buffer[iout] = '\0';
|
buffer[iout] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||||
void PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_chunk_error(png_structp png_ptr, png_const_charp error_message)
|
png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
|
||||||
|
PNG_NORETURN)
|
||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_error(png_ptr, error_message);
|
png_error(png_ptr, error_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, error_message);
|
png_format_buffer(png_ptr, msg, error_message);
|
||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
|
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
@ -219,6 +448,7 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
png_warning(png_ptr, warning_message);
|
png_warning(png_ptr, warning_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_format_buffer(png_ptr, msg, warning_message);
|
png_format_buffer(png_ptr, msg, warning_message);
|
||||||
@ -234,23 +464,64 @@ png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
||||||
png_chunk_warning(png_ptr, error_message);
|
png_chunk_warning(png_ptr, error_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_chunk_error(png_ptr, error_message);
|
png_chunk_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
PNG_FUNCTION(void,
|
||||||
|
png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
|
||||||
|
{
|
||||||
|
# define fixed_message "fixed point overflow in "
|
||||||
|
# define fixed_message_ln ((sizeof fixed_message)-1)
|
||||||
|
int iin;
|
||||||
|
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
||||||
|
png_memcpy(msg, fixed_message, fixed_message_ln);
|
||||||
|
iin = 0;
|
||||||
|
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
||||||
|
{
|
||||||
|
msg[fixed_message_ln + iin] = name[iin];
|
||||||
|
++iin;
|
||||||
|
}
|
||||||
|
msg[fixed_message_ln + iin] = 0;
|
||||||
|
png_error(png_ptr, msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
/* This API only exists if ANSI-C style error handling is used,
|
||||||
|
* otherwise it is necessary for png_default_error to be overridden.
|
||||||
|
*/
|
||||||
|
jmp_buf* PNGAPI
|
||||||
|
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
|
||||||
|
size_t jmp_buf_size)
|
||||||
|
{
|
||||||
|
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
png_ptr->longjmp_fn = longjmp_fn;
|
||||||
|
return &png_ptr->longjmp_buffer;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is the default error handling function. Note that replacements for
|
/* This is the default error handling function. Note that replacements for
|
||||||
* this function MUST NOT RETURN, or the program will likely crash. This
|
* this function MUST NOT RETURN, or the program will likely crash. This
|
||||||
* function is used by default, or if the program supplies NULL for the
|
* function is used by default, or if the program supplies NULL for the
|
||||||
* error function pointer in png_set_error_fn().
|
* error function pointer in png_set_error_fn().
|
||||||
*/
|
*/
|
||||||
static void /* PRIVATE */
|
static PNG_FUNCTION(void /* PRIVATE */,
|
||||||
png_default_error(png_structp png_ptr, png_const_charp error_message)
|
png_default_error,(png_structp png_ptr, png_const_charp error_message),
|
||||||
|
PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
/* Check on NULL only added in 1.5.4 */
|
||||||
|
if (error_message != NULL && *error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
/* Strip "#nnnn " from beginning of error message. */
|
/* Strip "#nnnn " from beginning of error message. */
|
||||||
int offset;
|
int offset;
|
||||||
@ -261,6 +532,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
if (error_message[offset] == ' ')
|
if (error_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((offset > 1) && (offset < 15))
|
if ((offset > 1) && (offset < 15))
|
||||||
{
|
{
|
||||||
error_number[offset - 1] = '\0';
|
error_number[offset - 1] = '\0';
|
||||||
@ -268,6 +540,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
error_number, error_message + offset + 1);
|
error_number, error_message + offset + 1);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng error: %s, offset=%d",
|
fprintf(stderr, "libpng error: %s, offset=%d",
|
||||||
@ -278,30 +551,36 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng error: %s", error_message);
|
fprintf(stderr, "libpng error: %s", error_message ? error_message :
|
||||||
|
"undefined");
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(error_message) /* Make compiler happy */
|
||||||
#endif
|
#endif
|
||||||
|
png_longjmp(png_ptr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
PNG_FUNCTION(void,PNGAPI
|
||||||
|
png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
|
||||||
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
if (png_ptr)
|
if (png_ptr && png_ptr->longjmp_fn)
|
||||||
{
|
{
|
||||||
# ifdef USE_FAR_KEYWORD
|
# ifdef USE_FAR_KEYWORD
|
||||||
{
|
{
|
||||||
jmp_buf jmpbuf;
|
jmp_buf tmp_jmpbuf;
|
||||||
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
png_memcpy(tmp_jmpbuf, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
|
||||||
longjmp(jmpbuf,1);
|
png_ptr->longjmp_fn(tmp_jmpbuf, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
# else
|
# else
|
||||||
longjmp(png_ptr->jmpbuf, 1);
|
png_ptr->longjmp_fn(png_ptr->longjmp_buffer, val);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Here if not setjmp support or if png_ptr is null. */
|
/* Here if not setjmp support or if png_ptr is null. */
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
#ifndef PNG_CONSOLE_IO_SUPPORTED
|
|
||||||
error_message = error_message; /* Make compiler happy */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
@ -325,6 +604,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
if (warning_message[offset] == ' ')
|
if (warning_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((offset > 1) && (offset < 15))
|
if ((offset > 1) && (offset < 15))
|
||||||
{
|
{
|
||||||
warning_number[offset + 1] = '\0';
|
warning_number[offset + 1] = '\0';
|
||||||
@ -332,6 +612,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
warning_number, warning_message + offset);
|
warning_number, warning_message + offset);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng warning: %s",
|
fprintf(stderr, "libpng warning: %s",
|
||||||
@ -341,21 +622,22 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
{
|
{
|
||||||
fprintf(stderr, "libpng warning: %s", warning_message);
|
fprintf(stderr, "libpng warning: %s", warning_message);
|
||||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
warning_message = warning_message; /* Make compiler happy */
|
PNG_UNUSED(warning_message) /* Make compiler happy */
|
||||||
#endif
|
#endif
|
||||||
png_ptr = png_ptr; /* Make compiler happy */
|
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||||
|
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
* of handling errors and warnings. Note that the error function MUST NOT
|
* of handling errors and warnings. Note that the error function MUST NOT
|
||||||
* return to the calling routine or serious problems will occur. The return
|
* return to the calling routine or serious problems will occur. The return
|
||||||
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
|
* method used in the default routine calls longjmp(png_ptr->longjmp_buffer, 1)
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
||||||
@ -363,9 +645,14 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->error_ptr = error_ptr;
|
png_ptr->error_ptr = error_ptr;
|
||||||
png_ptr->error_fn = error_fn;
|
png_ptr->error_fn = error_fn;
|
||||||
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
png_ptr->warning_fn = warning_fn;
|
png_ptr->warning_fn = warning_fn;
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(warning_fn)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -374,10 +661,11 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_error_ptr(png_structp png_ptr)
|
png_get_error_ptr(png_const_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->error_ptr);
|
return ((png_voidp)png_ptr->error_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +677,8 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
|||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
png_ptr->flags &=
|
png_ptr->flags &=
|
||||||
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
|
||||||
|
PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
269
jni/libpng/pnginfo.h
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
|
||||||
|
/* pnginfo.h - header file for PNG reference library
|
||||||
|
*
|
||||||
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
*
|
||||||
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* png_info is a structure that holds the information in a PNG file so
|
||||||
|
* that the application can find out the characteristics of the image.
|
||||||
|
* If you are reading the file, this structure will tell you what is
|
||||||
|
* in the PNG file. If you are writing the file, fill in the information
|
||||||
|
* you want to put into the PNG file, using png_set_*() functions, then
|
||||||
|
* call png_write_info().
|
||||||
|
*
|
||||||
|
* The names chosen should be very close to the PNG specification, so
|
||||||
|
* consult that document for information about the meaning of each field.
|
||||||
|
*
|
||||||
|
* With libpng < 0.95, it was only possible to directly set and read the
|
||||||
|
* the values in the png_info_struct, which meant that the contents and
|
||||||
|
* order of the values had to remain fixed. With libpng 0.95 and later,
|
||||||
|
* however, there are now functions that abstract the contents of
|
||||||
|
* png_info_struct from the application, so this makes it easier to use
|
||||||
|
* libpng with dynamic libraries, and even makes it possible to use
|
||||||
|
* libraries that don't have all of the libpng ancillary chunk-handing
|
||||||
|
* functionality. In libpng-1.5.0 this was moved into a separate private
|
||||||
|
* file that is not visible to applications.
|
||||||
|
*
|
||||||
|
* The following members may have allocated storage attached that should be
|
||||||
|
* cleaned up before the structure is discarded: palette, trans, text,
|
||||||
|
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
|
||||||
|
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
|
||||||
|
* are automatically freed when the info structure is deallocated, if they were
|
||||||
|
* allocated internally by libpng. This behavior can be changed by means
|
||||||
|
* of the png_data_freer() function.
|
||||||
|
*
|
||||||
|
* More allocation details: all the chunk-reading functions that
|
||||||
|
* change these members go through the corresponding png_set_*
|
||||||
|
* functions. A function to clear these members is available: see
|
||||||
|
* png_free_data(). The png_set_* functions do not depend on being
|
||||||
|
* able to point info structure members to any of the storage they are
|
||||||
|
* passed (they make their own copies), EXCEPT that the png_set_text
|
||||||
|
* functions use the same storage passed to them in the text_ptr or
|
||||||
|
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
|
||||||
|
* functions do not make their own copies.
|
||||||
|
*/
|
||||||
|
#ifndef PNGINFO_H
|
||||||
|
#define PNGINFO_H
|
||||||
|
|
||||||
|
struct png_info_def
|
||||||
|
{
|
||||||
|
/* the following are necessary for every PNG file */
|
||||||
|
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
||||||
|
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
||||||
|
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
||||||
|
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
|
||||||
|
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
|
||||||
|
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
|
||||||
|
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
|
||||||
|
png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
|
||||||
|
png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
|
||||||
|
/* The following three should have been named *_method not *_type */
|
||||||
|
png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
|
||||||
|
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
|
||||||
|
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||||
|
|
||||||
|
/* The following is informational only on read, and not used on writes. */
|
||||||
|
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
|
||||||
|
png_byte pixel_depth; /* number of bits per pixel */
|
||||||
|
png_byte spare_byte; /* to align the data, and for future use */
|
||||||
|
png_byte signature[8]; /* magic bytes read by libpng from start of file */
|
||||||
|
|
||||||
|
/* The rest of the data is optional. If you are reading, check the
|
||||||
|
* valid field to see if the information in these are valid. If you
|
||||||
|
* are writing, set the valid field to those chunks you want written,
|
||||||
|
* and initialize the appropriate fields below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(PNG_gAMA_SUPPORTED)
|
||||||
|
/* The gAMA chunk describes the gamma characteristics of the system
|
||||||
|
* on which the image was created, normally in the range [1.0, 2.5].
|
||||||
|
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
|
||||||
|
*/
|
||||||
|
png_fixed_point gamma;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sRGB_SUPPORTED
|
||||||
|
/* GR-P, 0.96a */
|
||||||
|
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
|
||||||
|
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_TEXT_SUPPORTED
|
||||||
|
/* The tEXt, and zTXt chunks contain human-readable textual data in
|
||||||
|
* uncompressed, compressed, and optionally compressed forms, respectively.
|
||||||
|
* The data in "text" is an array of pointers to uncompressed,
|
||||||
|
* null-terminated C strings. Each chunk has a keyword that describes the
|
||||||
|
* textual data contained in that chunk. Keywords are not required to be
|
||||||
|
* unique, and the text string may be empty. Any number of text chunks may
|
||||||
|
* be in an image.
|
||||||
|
*/
|
||||||
|
int num_text; /* number of comments read or comments to write */
|
||||||
|
int max_text; /* current size of text array */
|
||||||
|
png_textp text; /* array of comments read or comments to write */
|
||||||
|
#endif /* PNG_TEXT_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_tIME_SUPPORTED
|
||||||
|
/* The tIME chunk holds the last time the displayed image data was
|
||||||
|
* modified. See the png_time struct for the contents of this struct.
|
||||||
|
*/
|
||||||
|
png_time mod_time;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sBIT_SUPPORTED
|
||||||
|
/* The sBIT chunk specifies the number of significant high-order bits
|
||||||
|
* in the pixel data. Values are in the range [1, bit_depth], and are
|
||||||
|
* only specified for the channels in the pixel data. The contents of
|
||||||
|
* the low-order bits is not specified. Data is valid if
|
||||||
|
* (valid & PNG_INFO_sBIT) is non-zero.
|
||||||
|
*/
|
||||||
|
png_color_8 sig_bit; /* significant bits in color channels */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
|
||||||
|
defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
/* The tRNS chunk supplies transparency data for paletted images and
|
||||||
|
* other image types that don't need a full alpha channel. There are
|
||||||
|
* "num_trans" transparency values for a paletted image, stored in the
|
||||||
|
* same order as the palette colors, starting from index 0. Values
|
||||||
|
* for the data are in the range [0, 255], ranging from fully transparent
|
||||||
|
* to fully opaque, respectively. For non-paletted images, there is a
|
||||||
|
* single color specified that should be treated as fully transparent.
|
||||||
|
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
|
||||||
|
*/
|
||||||
|
png_bytep trans_alpha; /* alpha values for paletted image */
|
||||||
|
png_color_16 trans_color; /* transparent color for non-palette image */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
/* The bKGD chunk gives the suggested image background color if the
|
||||||
|
* display program does not have its own background color and the image
|
||||||
|
* is needs to composited onto a background before display. The colors
|
||||||
|
* in "background" are normally in the same color space/depth as the
|
||||||
|
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
|
||||||
|
*/
|
||||||
|
png_color_16 background;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
|
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
|
||||||
|
* and downwards from the top-left corner of the display, page, or other
|
||||||
|
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
|
||||||
|
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
|
||||||
|
*/
|
||||||
|
png_int_32 x_offset; /* x offset on page */
|
||||||
|
png_int_32 y_offset; /* y offset on page */
|
||||||
|
png_byte offset_unit_type; /* offset units type */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
|
/* The pHYs chunk gives the physical pixel density of the image for
|
||||||
|
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
|
||||||
|
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
|
||||||
|
*/
|
||||||
|
png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
|
||||||
|
png_uint_32 y_pixels_per_unit; /* vertical pixel density */
|
||||||
|
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_hIST_SUPPORTED
|
||||||
|
/* The hIST chunk contains the relative frequency or importance of the
|
||||||
|
* various palette entries, so that a viewer can intelligently select a
|
||||||
|
* reduced-color palette, if required. Data is an array of "num_palette"
|
||||||
|
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
|
||||||
|
* is non-zero.
|
||||||
|
*/
|
||||||
|
png_uint_16p hist;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_cHRM_SUPPORTED
|
||||||
|
/* The cHRM chunk describes the CIE color characteristics of the monitor
|
||||||
|
* on which the PNG was created. This data allows the viewer to do gamut
|
||||||
|
* mapping of the input image to ensure that the viewer sees the same
|
||||||
|
* colors in the image as the creator. Values are in the range
|
||||||
|
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
|
||||||
|
*/
|
||||||
|
png_fixed_point x_white;
|
||||||
|
png_fixed_point y_white;
|
||||||
|
png_fixed_point x_red;
|
||||||
|
png_fixed_point y_red;
|
||||||
|
png_fixed_point x_green;
|
||||||
|
png_fixed_point y_green;
|
||||||
|
png_fixed_point x_blue;
|
||||||
|
png_fixed_point y_blue;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_pCAL_SUPPORTED
|
||||||
|
/* The pCAL chunk describes a transformation between the stored pixel
|
||||||
|
* values and original physical data values used to create the image.
|
||||||
|
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
|
||||||
|
* range given by [pcal_X0, pcal_X1], and are further transformed by a
|
||||||
|
* (possibly non-linear) transformation function given by "pcal_type"
|
||||||
|
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
|
||||||
|
* defines below, and the PNG-Group's PNG extensions document for a
|
||||||
|
* complete description of the transformations and how they should be
|
||||||
|
* implemented, and for a description of the ASCII parameter strings.
|
||||||
|
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
|
||||||
|
*/
|
||||||
|
png_charp pcal_purpose; /* pCAL chunk description string */
|
||||||
|
png_int_32 pcal_X0; /* minimum value */
|
||||||
|
png_int_32 pcal_X1; /* maximum value */
|
||||||
|
png_charp pcal_units; /* Latin-1 string giving physical units */
|
||||||
|
png_charpp pcal_params; /* ASCII strings containing parameter values */
|
||||||
|
png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
|
||||||
|
png_byte pcal_nparams; /* number of parameters given in pcal_params */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.6 */
|
||||||
|
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||||
|
|
||||||
|
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
|
||||||
|
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
||||||
|
/* Storage for unknown chunks that the library doesn't recognize. */
|
||||||
|
png_unknown_chunkp unknown_chunks;
|
||||||
|
int unknown_chunks_num;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_iCCP_SUPPORTED
|
||||||
|
/* iCCP chunk data. */
|
||||||
|
png_charp iccp_name; /* profile name */
|
||||||
|
png_bytep iccp_profile; /* International Color Consortium profile data */
|
||||||
|
png_uint_32 iccp_proflen; /* ICC profile data length */
|
||||||
|
png_byte iccp_compression; /* Always zero */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sPLT_SUPPORTED
|
||||||
|
/* Data on sPLT chunks (there may be more than one). */
|
||||||
|
png_sPLT_tp splt_palettes;
|
||||||
|
png_uint_32 splt_palettes_num;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_sCAL_SUPPORTED
|
||||||
|
/* The sCAL chunk describes the actual physical dimensions of the
|
||||||
|
* subject matter of the graphic. The chunk contains a unit specification
|
||||||
|
* a byte value, and two ASCII strings representing floating-point
|
||||||
|
* values. The values are width and height corresponsing to one pixel
|
||||||
|
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
|
||||||
|
* non-zero.
|
||||||
|
*/
|
||||||
|
png_byte scal_unit; /* unit of physical scale */
|
||||||
|
png_charp scal_s_width; /* string containing height */
|
||||||
|
png_charp scal_s_height; /* string containing width */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||||
|
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
|
||||||
|
non-zero */
|
||||||
|
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
|
||||||
|
png_bytepp row_pointers; /* the image bits */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif /* PNGINFO_H */
|
186
jni/libpng/pnglibconf.h
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
|
||||||
|
/* libpng STANDARD API DEFINITION */
|
||||||
|
|
||||||
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
|
/* Libpng 1.5.10 - March 29, 2012 */
|
||||||
|
|
||||||
|
/* Copyright (c) 1998-2012 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
|
/* This code is released under the libpng license. */
|
||||||
|
/* For conditions of distribution and use, see the disclaimer */
|
||||||
|
/* and license in png.h */
|
||||||
|
|
||||||
|
/* pnglibconf.h */
|
||||||
|
/* Derived from: scripts/pnglibconf.dfa */
|
||||||
|
/* If you edit this file by hand you must obey the rules expressed in */
|
||||||
|
/* pnglibconf.dfa with respect to the dependencies between the following */
|
||||||
|
/* symbols. It is much better to generate a new file using */
|
||||||
|
/* scripts/libpngconf.mak */
|
||||||
|
|
||||||
|
#ifndef PNGLCONF_H
|
||||||
|
#define PNGLCONF_H
|
||||||
|
/* settings */
|
||||||
|
#define PNG_API_RULE 0
|
||||||
|
#define PNG_CALLOC_SUPPORTED
|
||||||
|
#define PNG_COST_SHIFT 3
|
||||||
|
#define PNG_DEFAULT_READ_MACROS 1
|
||||||
|
#define PNG_GAMMA_THRESHOLD_FIXED 5000
|
||||||
|
#define PNG_MAX_GAMMA_8 11
|
||||||
|
#define PNG_QUANTIZE_BLUE_BITS 5
|
||||||
|
#define PNG_QUANTIZE_GREEN_BITS 5
|
||||||
|
#define PNG_QUANTIZE_RED_BITS 5
|
||||||
|
#define PNG_sCAL_PRECISION 5
|
||||||
|
#define PNG_WEIGHT_SHIFT 8
|
||||||
|
#define PNG_ZBUF_SIZE 8192
|
||||||
|
/* end of settings */
|
||||||
|
/* options */
|
||||||
|
#define PNG_16BIT_SUPPORTED
|
||||||
|
#define PNG_ALIGN_MEMORY_SUPPORTED
|
||||||
|
#define PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
#define PNG_bKGD_SUPPORTED
|
||||||
|
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
|
||||||
|
#define PNG_CHECK_cHRM_SUPPORTED
|
||||||
|
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
|
#define PNG_cHRM_SUPPORTED
|
||||||
|
#define PNG_CONSOLE_IO_SUPPORTED
|
||||||
|
#define PNG_CONVERT_tIME_SUPPORTED
|
||||||
|
#define PNG_EASY_ACCESS_SUPPORTED
|
||||||
|
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
||||||
|
#define PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
#define PNG_FIXED_POINT_SUPPORTED
|
||||||
|
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
|
||||||
|
#define PNG_FLOATING_POINT_SUPPORTED
|
||||||
|
#define PNG_gAMA_SUPPORTED
|
||||||
|
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
#define PNG_hIST_SUPPORTED
|
||||||
|
#define PNG_iCCP_SUPPORTED
|
||||||
|
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||||
|
#define PNG_INFO_IMAGE_SUPPORTED
|
||||||
|
#define PNG_IO_STATE_SUPPORTED
|
||||||
|
#define PNG_iTXt_SUPPORTED
|
||||||
|
#define PNG_MNG_FEATURES_SUPPORTED
|
||||||
|
#define PNG_oFFs_SUPPORTED
|
||||||
|
#define PNG_pCAL_SUPPORTED
|
||||||
|
#define PNG_pHYs_SUPPORTED
|
||||||
|
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||||
|
#define PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
|
#define PNG_READ_16BIT_SUPPORTED
|
||||||
|
#define PNG_READ_ALPHA_MODE_SUPPORTED
|
||||||
|
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_READ_BACKGROUND_SUPPORTED
|
||||||
|
#define PNG_READ_BGR_SUPPORTED
|
||||||
|
#define PNG_READ_bKGD_SUPPORTED
|
||||||
|
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
|
#define PNG_READ_cHRM_SUPPORTED
|
||||||
|
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||||
|
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||||
|
#define PNG_READ_EXPAND_16_SUPPORTED
|
||||||
|
#define PNG_READ_EXPAND_SUPPORTED
|
||||||
|
#define PNG_READ_FILLER_SUPPORTED
|
||||||
|
#define PNG_READ_gAMA_SUPPORTED
|
||||||
|
#define PNG_READ_GAMMA_SUPPORTED
|
||||||
|
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||||
|
#define PNG_READ_hIST_SUPPORTED
|
||||||
|
#define PNG_READ_iCCP_SUPPORTED
|
||||||
|
#define PNG_READ_INTERLACING_SUPPORTED
|
||||||
|
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||||
|
#define PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||||
|
#define PNG_READ_INVERT_SUPPORTED
|
||||||
|
#define PNG_READ_iTXt_SUPPORTED
|
||||||
|
#define PNG_READ_oFFs_SUPPORTED
|
||||||
|
#define PNG_READ_OPT_PLTE_SUPPORTED
|
||||||
|
#define PNG_READ_PACK_SUPPORTED
|
||||||
|
#define PNG_READ_PACKSWAP_SUPPORTED
|
||||||
|
#define PNG_READ_pCAL_SUPPORTED
|
||||||
|
#define PNG_READ_pHYs_SUPPORTED
|
||||||
|
#define PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||||
|
#define PNG_READ_sBIT_SUPPORTED
|
||||||
|
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||||
|
#define PNG_READ_sCAL_SUPPORTED
|
||||||
|
#define PNG_READ_SHIFT_SUPPORTED
|
||||||
|
#define PNG_READ_sPLT_SUPPORTED
|
||||||
|
#define PNG_READ_sRGB_SUPPORTED
|
||||||
|
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||||
|
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_READ_SUPPORTED
|
||||||
|
#define PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_READ_SWAP_SUPPORTED
|
||||||
|
#define PNG_READ_tEXt_SUPPORTED
|
||||||
|
#define PNG_READ_TEXT_SUPPORTED
|
||||||
|
#define PNG_READ_tIME_SUPPORTED
|
||||||
|
#define PNG_READ_TRANSFORMS_SUPPORTED
|
||||||
|
#define PNG_READ_tRNS_SUPPORTED
|
||||||
|
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
|
#define PNG_READ_zTXt_SUPPORTED
|
||||||
|
#define PNG_SAVE_INT_32_SUPPORTED
|
||||||
|
#define PNG_sBIT_SUPPORTED
|
||||||
|
#define PNG_sCAL_SUPPORTED
|
||||||
|
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||||
|
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||||
|
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||||
|
#define PNG_SETJMP_SUPPORTED
|
||||||
|
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
|
#define PNG_sPLT_SUPPORTED
|
||||||
|
#define PNG_sRGB_SUPPORTED
|
||||||
|
#define PNG_STDIO_SUPPORTED
|
||||||
|
#define PNG_tEXt_SUPPORTED
|
||||||
|
#define PNG_TEXT_SUPPORTED
|
||||||
|
#define PNG_TIME_RFC1123_SUPPORTED
|
||||||
|
#define PNG_tIME_SUPPORTED
|
||||||
|
#define PNG_tRNS_SUPPORTED
|
||||||
|
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_USER_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_USER_LIMITS_SUPPORTED
|
||||||
|
#define PNG_USER_MEM_SUPPORTED
|
||||||
|
#define PNG_USER_TRANSFORM_INFO_SUPPORTED
|
||||||
|
#define PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
|
#define PNG_WARNINGS_SUPPORTED
|
||||||
|
#define PNG_WRITE_16BIT_SUPPORTED
|
||||||
|
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_WRITE_BGR_SUPPORTED
|
||||||
|
#define PNG_WRITE_bKGD_SUPPORTED
|
||||||
|
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
|
#define PNG_WRITE_cHRM_SUPPORTED
|
||||||
|
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||||
|
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||||
|
#define PNG_WRITE_FILLER_SUPPORTED
|
||||||
|
#define PNG_WRITE_FILTER_SUPPORTED
|
||||||
|
#define PNG_WRITE_FLUSH_SUPPORTED
|
||||||
|
#define PNG_WRITE_gAMA_SUPPORTED
|
||||||
|
#define PNG_WRITE_hIST_SUPPORTED
|
||||||
|
#define PNG_WRITE_iCCP_SUPPORTED
|
||||||
|
#define PNG_WRITE_INTERLACING_SUPPORTED
|
||||||
|
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
|
||||||
|
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
|
#define PNG_WRITE_INVERT_SUPPORTED
|
||||||
|
#define PNG_WRITE_iTXt_SUPPORTED
|
||||||
|
#define PNG_WRITE_oFFs_SUPPORTED
|
||||||
|
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||||
|
#define PNG_WRITE_PACK_SUPPORTED
|
||||||
|
#define PNG_WRITE_PACKSWAP_SUPPORTED
|
||||||
|
#define PNG_WRITE_pCAL_SUPPORTED
|
||||||
|
#define PNG_WRITE_pHYs_SUPPORTED
|
||||||
|
#define PNG_WRITE_sBIT_SUPPORTED
|
||||||
|
#define PNG_WRITE_sCAL_SUPPORTED
|
||||||
|
#define PNG_WRITE_SHIFT_SUPPORTED
|
||||||
|
#define PNG_WRITE_sPLT_SUPPORTED
|
||||||
|
#define PNG_WRITE_sRGB_SUPPORTED
|
||||||
|
#define PNG_WRITE_SUPPORTED
|
||||||
|
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_WRITE_SWAP_SUPPORTED
|
||||||
|
#define PNG_WRITE_tEXt_SUPPORTED
|
||||||
|
#define PNG_WRITE_TEXT_SUPPORTED
|
||||||
|
#define PNG_WRITE_tIME_SUPPORTED
|
||||||
|
#define PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||||
|
#define PNG_WRITE_tRNS_SUPPORTED
|
||||||
|
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||||
|
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
|
#define PNG_WRITE_zTXt_SUPPORTED
|
||||||
|
#define PNG_zTXt_SUPPORTED
|
||||||
|
/* end of options */
|
||||||
|
#endif /* PNGLCONF_H */
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [February 25, 2010]
|
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -17,9 +17,8 @@
|
|||||||
* identify the replacement functions.
|
* identify the replacement functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
|
||||||
#include "png.h"
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
||||||
/* Borland DOS special memory handler */
|
/* Borland DOS special memory handler */
|
||||||
@ -28,41 +27,46 @@
|
|||||||
|
|
||||||
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
||||||
by a single call to calloc() if this is thought to improve performance. */
|
by a single call to calloc() if this is thought to improve performance. */
|
||||||
png_voidp /* PRIVATE */
|
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||||
png_create_struct(int type)
|
png_create_struct,(int type),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
return (png_create_struct_2(type, NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
||||||
png_voidp /* PRIVATE */
|
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
||||||
|
PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
png_voidp struct_ptr;
|
png_voidp struct_ptr;
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
if (type == PNG_STRUCT_INFO)
|
||||||
size = png_sizeof(png_info);
|
size = png_sizeof(png_info);
|
||||||
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = png_sizeof(png_struct);
|
size = png_sizeof(png_struct);
|
||||||
|
|
||||||
else
|
else
|
||||||
return (png_get_copyright(NULL));
|
return (png_get_copyright(NULL));
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (malloc_fn != NULL)
|
if (malloc_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
memset(&dummy_struct, 0, sizeof dummy_struct);
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
dummy_struct.mem_ptr=mem_ptr;
|
||||||
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
|
struct_ptr = (*(malloc_fn))(&dummy_struct, (png_alloc_size_t)size);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
struct_ptr = (png_voidp)farmalloc(size);
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
|
|
||||||
return (struct_ptr);
|
return (struct_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +74,8 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
png_destroy_struct_2(struct_ptr, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
@ -79,19 +83,20 @@ void /* PRIVATE */
|
|||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
png_voidp mem_ptr)
|
png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
#endif
|
# endif
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (free_fn != NULL)
|
if (free_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
memset(&dummy_struct, 0, sizeof dummy_struct);
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
dummy_struct.mem_ptr=mem_ptr;
|
||||||
(*(free_fn))(png_ptr, struct_ptr);
|
(*(free_fn))(&dummy_struct, struct_ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
farfree (struct_ptr);
|
farfree (struct_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,55 +120,62 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|||||||
* result, we would be truncating potentially larger memory requests
|
* result, we would be truncating potentially larger memory requests
|
||||||
* (which should cause a fatal error) and introducing major problems.
|
* (which should cause a fatal error) and introducing major problems.
|
||||||
*/
|
*/
|
||||||
png_voidp /* PRIVATE */
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_calloc(png_structp png_ptr, png_uint_32 size)
|
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
ret = (png_malloc(png_ptr, size));
|
ret = (png_malloc(png_ptr, size));
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
png_memset(ret,0,(png_size_t)size);
|
png_memset(ret,0,(png_size_t)size);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp PNGAPI
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr->malloc_fn != NULL)
|
if (png_ptr->malloc_fn != NULL)
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
ret = (png_malloc_default(png_ptr, size));
|
||||||
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of memory!");
|
png_error(png_ptr, "Out of memory");
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp PNGAPI
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
# ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Cannot Allocate > 64K");
|
png_warning(png_ptr, "Cannot Allocate > 64K");
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
if (size != (size_t)size)
|
if (size != (size_t)size)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
|
||||||
else if (size == (png_uint_32)65536L)
|
else if (size == (png_uint_32)65536L)
|
||||||
{
|
{
|
||||||
if (png_ptr->offset_table == NULL)
|
if (png_ptr->offset_table == NULL)
|
||||||
@ -175,8 +187,9 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
int num_blocks;
|
int num_blocks;
|
||||||
png_uint_32 total_size;
|
png_uint_32 total_size;
|
||||||
png_bytep table;
|
png_bytep table;
|
||||||
int i;
|
int i, mem_level, window_bits;
|
||||||
png_byte huge * hptr;
|
png_byte huge * hptr;
|
||||||
|
int window_bits
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
{
|
{
|
||||||
@ -184,12 +197,23 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
ret = NULL;
|
ret = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->zlib_window_bits > 14)
|
window_bits =
|
||||||
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
|
png_ptr->zlib_window_bits >= png_ptr->zlib_text_window_bits ?
|
||||||
|
png_ptr->zlib_window_bits : png_ptr->zlib_text_window_bits;
|
||||||
|
|
||||||
|
if (window_bits > 14)
|
||||||
|
num_blocks = (int)(1 << (window_bits - 14));
|
||||||
|
|
||||||
else
|
else
|
||||||
num_blocks = 1;
|
num_blocks = 1;
|
||||||
if (png_ptr->zlib_mem_level >= 7)
|
|
||||||
num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7));
|
mem_level =
|
||||||
|
png_ptr->zlib_mem_level >= png_ptr->zlib_text_mem_level ?
|
||||||
|
png_ptr->zlib_mem_level : png_ptr->zlib_text_mem_level;
|
||||||
|
|
||||||
|
if (mem_level >= 7)
|
||||||
|
num_blocks += (int)(1 << (mem_level - 7));
|
||||||
|
|
||||||
else
|
else
|
||||||
num_blocks++;
|
num_blocks++;
|
||||||
|
|
||||||
@ -199,25 +223,27 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
{
|
{
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
# ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out Of Memory."); /* Note "O", "M" */
|
png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out Of Memory.");
|
png_warning(png_ptr, "Out Of Memory");
|
||||||
#endif
|
# endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((png_size_t)table & 0xfff0)
|
if ((png_size_t)table & 0xfff0)
|
||||||
{
|
{
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
# ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr,
|
png_error(png_ptr,
|
||||||
"Farmalloc didn't return normalized pointer");
|
"Farmalloc didn't return normalized pointer");
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Farmalloc didn't return normalized pointer");
|
"Farmalloc didn't return normalized pointer");
|
||||||
#endif
|
# endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,12 +253,13 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (png_ptr->offset_table_ptr == NULL)
|
if (png_ptr->offset_table_ptr == NULL)
|
||||||
{
|
{
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
# ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out Of memory."); /* Note "O", "m" */
|
png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out Of memory.");
|
png_warning(png_ptr, "Out Of memory");
|
||||||
#endif
|
# endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,6 +269,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||||
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < num_blocks; i++)
|
for (i = 0; i < num_blocks; i++)
|
||||||
{
|
{
|
||||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||||
@ -256,29 +284,32 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
|||||||
|
|
||||||
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
||||||
{
|
{
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
# ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */
|
png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out of Memory.");
|
png_warning(png_ptr, "Out of Memory");
|
||||||
#endif
|
# endif
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = farmalloc(size);
|
ret = farmalloc(size);
|
||||||
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
# ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
|
||||||
|
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */
|
png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@ -293,12 +324,13 @@ png_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr->free_fn != NULL)
|
if (png_ptr->free_fn != NULL)
|
||||||
{
|
{
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
png_free_default(png_ptr, ptr);
|
png_free_default(png_ptr, ptr);
|
||||||
}
|
}
|
||||||
@ -306,7 +338,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
@ -334,9 +366,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
{
|
|
||||||
farfree(ptr);
|
farfree(ptr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* Not the Borland DOS special memory handler */
|
#else /* Not the Borland DOS special memory handler */
|
||||||
@ -344,52 +374,58 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
|
|||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
memset can be replaced by a single call to calloc() if this is thought
|
||||||
to improve performance noticably. */
|
to improve performance noticably. */
|
||||||
png_voidp /* PRIVATE */
|
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||||
png_create_struct(int type)
|
png_create_struct,(int type),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL));
|
return (png_create_struct_2(type, NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
/* Allocate memory for a png_struct or a png_info. The malloc and
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
memset can be replaced by a single call to calloc() if this is thought
|
||||||
to improve performance noticably. */
|
to improve performance noticably. */
|
||||||
png_voidp /* PRIVATE */
|
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||||
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
||||||
|
PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
png_size_t size;
|
png_size_t size;
|
||||||
png_voidp struct_ptr;
|
png_voidp struct_ptr;
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
if (type == PNG_STRUCT_INFO)
|
||||||
size = png_sizeof(png_info);
|
size = png_sizeof(png_info);
|
||||||
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
else if (type == PNG_STRUCT_PNG)
|
||||||
size = png_sizeof(png_struct);
|
size = png_sizeof(png_struct);
|
||||||
|
|
||||||
else
|
else
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (malloc_fn != NULL)
|
if (malloc_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
png_structp png_ptr = &dummy_struct;
|
png_structp png_ptr = &dummy_struct;
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
png_ptr->mem_ptr=mem_ptr;
|
||||||
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
||||||
|
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
|
|
||||||
return (struct_ptr);
|
return (struct_ptr);
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
# if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
struct_ptr = (png_voidp)farmalloc(size);
|
||||||
#else
|
# else
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
struct_ptr = (png_voidp)halloc(size, 1);
|
struct_ptr = (png_voidp)halloc(size, 1);
|
||||||
# else
|
# else
|
||||||
struct_ptr = (png_voidp)malloc(size);
|
struct_ptr = (png_voidp)malloc(size);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
png_memset(struct_ptr, 0, size);
|
png_memset(struct_ptr, 0, size);
|
||||||
|
|
||||||
@ -401,8 +437,8 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_struct(png_voidp struct_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL);
|
png_destroy_struct_2(struct_ptr, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
/* Free memory allocated by a png_create_struct() call */
|
||||||
@ -410,10 +446,10 @@ void /* PRIVATE */
|
|||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||||
png_voidp mem_ptr)
|
png_voidp mem_ptr)
|
||||||
{
|
{
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
if (struct_ptr != NULL)
|
if (struct_ptr != NULL)
|
||||||
{
|
{
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (free_fn != NULL)
|
if (free_fn != NULL)
|
||||||
{
|
{
|
||||||
png_struct dummy_struct;
|
png_struct dummy_struct;
|
||||||
@ -422,16 +458,19 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|||||||
(*(free_fn))(png_ptr, struct_ptr);
|
(*(free_fn))(png_ptr, struct_ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
# if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
farfree(struct_ptr);
|
farfree(struct_ptr);
|
||||||
#else
|
|
||||||
|
# else
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
hfree(struct_ptr);
|
hfree(struct_ptr);
|
||||||
|
|
||||||
# else
|
# else
|
||||||
free(struct_ptr);
|
free(struct_ptr);
|
||||||
|
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,80 +481,92 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|||||||
* have the ability to do that.
|
* have the ability to do that.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_voidp /* PRIVATE */
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_calloc(png_structp png_ptr, png_uint_32 size)
|
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
ret = (png_malloc(png_ptr, size));
|
ret = (png_malloc(png_ptr, size));
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
png_memset(ret,0,(png_size_t)size);
|
png_memset(ret,0,(png_size_t)size);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp PNGAPI
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (png_ptr->malloc_fn != NULL)
|
if (png_ptr->malloc_fn != NULL)
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
ret = (png_malloc_default(png_ptr, size));
|
||||||
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of Memory!");
|
png_error(png_ptr, "Out of Memory");
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
png_voidp PNGAPI
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_malloc_default(png_structp png_ptr, png_uint_32 size)
|
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
if (png_ptr == NULL || size == 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
#ifdef PNG_MAX_MALLOC_64K
|
# ifdef PNG_MAX_MALLOC_64K
|
||||||
if (size > (png_uint_32)65536L)
|
if (size > (png_uint_32)65536L)
|
||||||
{
|
{
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
# ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
png_error(png_ptr, "Cannot Allocate > 64K");
|
||||||
|
|
||||||
else
|
else
|
||||||
#endif
|
# endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* Check for overflow */
|
/* Check for overflow */
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
# if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
|
|
||||||
if (size != (unsigned long)size)
|
if (size != (unsigned long)size)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = farmalloc(size);
|
ret = farmalloc(size);
|
||||||
#else
|
|
||||||
|
# else
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
if (size != (unsigned long)size)
|
if (size != (unsigned long)size)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = halloc(size, 1);
|
ret = halloc(size, 1);
|
||||||
|
|
||||||
# else
|
# else
|
||||||
if (size != (size_t)size)
|
if (size != (size_t)size)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
|
||||||
else
|
else
|
||||||
ret = malloc((size_t)size);
|
ret = malloc((size_t)size);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
# ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
||||||
png_error(png_ptr, "Out of Memory");
|
png_error(png_ptr, "Out of Memory");
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
@ -529,46 +580,47 @@ png_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
# ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr->free_fn != NULL)
|
if (png_ptr->free_fn != NULL)
|
||||||
{
|
{
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
(*(png_ptr->free_fn))(png_ptr, ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
png_free_default(png_ptr, ptr);
|
png_free_default(png_ptr, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
png_free_default(png_structp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
# endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
# if defined(__TURBOC__) && !defined(__FLAT__)
|
||||||
farfree(ptr);
|
farfree(ptr);
|
||||||
#else
|
|
||||||
|
# else
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
||||||
hfree(ptr);
|
hfree(ptr);
|
||||||
|
|
||||||
# else
|
# else
|
||||||
free(ptr);
|
free(ptr);
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
}
|
||||||
#endif /* Not Borland DOS special memory handler */
|
#endif /* Not Borland DOS special memory handler */
|
||||||
|
|
||||||
#ifdef PNG_1_0_X
|
|
||||||
# define png_malloc_warn png_malloc
|
|
||||||
#else
|
|
||||||
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
||||||
* function will set up png_malloc() to issue a png_warning and return NULL
|
* function will set up png_malloc() to issue a png_warning and return NULL
|
||||||
* instead of issuing a png_error, if it fails to allocate the requested
|
* instead of issuing a png_error, if it fails to allocate the requested
|
||||||
* memory.
|
* memory.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_malloc_warn(png_structp png_ptr, png_uint_32 size)
|
png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ptr;
|
png_voidp ptr;
|
||||||
png_uint_32 save_flags;
|
png_uint_32 save_flags;
|
||||||
@ -581,34 +633,7 @@ png_malloc_warn(png_structp png_ptr, png_uint_32 size)
|
|||||||
png_ptr->flags=save_flags;
|
png_ptr->flags=save_flags;
|
||||||
return(ptr);
|
return(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
|
|
||||||
png_uint_32 length)
|
|
||||||
{
|
|
||||||
png_size_t size;
|
|
||||||
|
|
||||||
size = (png_size_t)length;
|
|
||||||
if ((png_uint_32)size != length)
|
|
||||||
png_error(png_ptr, "Overflow in png_memcpy_check.");
|
|
||||||
|
|
||||||
return(png_memcpy (s1, s2, size));
|
|
||||||
}
|
|
||||||
|
|
||||||
png_voidp PNGAPI
|
|
||||||
png_memset_check (png_structp png_ptr, png_voidp s1, int value,
|
|
||||||
png_uint_32 length)
|
|
||||||
{
|
|
||||||
png_size_t size;
|
|
||||||
|
|
||||||
size = (png_size_t)length;
|
|
||||||
if ((png_uint_32)size != length)
|
|
||||||
png_error(png_ptr, "Overflow in png_memset_check.");
|
|
||||||
|
|
||||||
return (png_memset (s1, value, size));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
@ -631,10 +656,11 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
|||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_mem_ptr(png_structp png_ptr)
|
png_get_mem_ptr(png_const_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->mem_ptr);
|
return ((png_voidp)png_ptr->mem_ptr);
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||||
|
1677
jni/libpng/pngpriv.h
Normal file
1195
jni/libpng/pngread.c
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.43 [February 25, 2010]
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -18,9 +18,8 @@
|
|||||||
* libpng use it at run time with png_set_read_fn(...).
|
* libpng use it at run time with png_set_read_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
|
||||||
#include "png.h"
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
|
||||||
/* Read the data from whatever input you are using. The default routine
|
/* Read the data from whatever input you are using. The default routine
|
||||||
@ -36,54 +35,35 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
|
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
(*(png_ptr->read_data_fn))(png_ptr, data, length);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL read function");
|
png_error(png_ptr, "Call to NULL read function");
|
||||||
|
|
||||||
#ifdef PNG_INDEX_SUPPORTED
|
|
||||||
png_ptr->total_data_read += length;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_INDEX_SUPPORTED
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_seek_data(png_structp png_ptr, png_uint_32 offset)
|
|
||||||
{
|
|
||||||
if (png_ptr->seek_data_fn != NULL)
|
|
||||||
(*(png_ptr->seek_data_fn))(png_ptr, offset);
|
|
||||||
else
|
|
||||||
png_error(png_ptr, "Call to NULL seek function");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
/* This is the function that does the actual reading of data. If you are
|
/* This is the function that does the actual reading of data. If you are
|
||||||
* not reading from a standard C stream, you should create a replacement
|
* not reading from a standard C stream, you should create a replacement
|
||||||
* read_data function and use it at run time with png_set_read_fn(), rather
|
* read_data function and use it at run time with png_set_read_fn(), rather
|
||||||
* than changing the library.
|
* than changing the library.
|
||||||
*/
|
*/
|
||||||
#ifndef USE_FAR_KEYWORD
|
# ifndef USE_FAR_KEYWORD
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_size_t check;
|
png_size_t check;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||||
* instead of an int, which is what fread() actually returns.
|
* instead of an int, which is what fread() actually returns.
|
||||||
*/
|
*/
|
||||||
#ifdef _WIN32_WCE
|
check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
|
||||||
(png_FILE_p)png_ptr->io_ptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Read Error");
|
png_error(png_ptr, "Read Error");
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
/* This is the model-independent version. Since the standard I/O library
|
/* This is the model-independent version. Since the standard I/O library
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
can't handle far buffers in the medium and small models, we have to copy
|
||||||
the data.
|
the data.
|
||||||
@ -92,66 +72,66 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
static void PNGAPI
|
static void PNGCBAPI
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
int check;
|
png_size_t check;
|
||||||
png_byte *n_data;
|
png_byte *n_data;
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
|
|
||||||
if ((png_bytep)n_data == data)
|
if ((png_bytep)n_data == data)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check,
|
|
||||||
NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fread(n_data, 1, length, io_ptr);
|
check = fread(n_data, 1, length, io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
png_size_t read, remaining, err;
|
png_size_t read, remaining, err;
|
||||||
check = 0;
|
check = 0;
|
||||||
remaining = length;
|
remaining = length;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
read = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
#ifdef _WIN32_WCE
|
err = fread(buf, 1, read, io_ptr);
|
||||||
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
|
|
||||||
err = 0;
|
|
||||||
#else
|
|
||||||
err = fread(buf, (png_size_t)1, read, io_ptr);
|
|
||||||
#endif
|
|
||||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
||||||
|
|
||||||
if (err != read)
|
if (err != read)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
else
|
else
|
||||||
check += err;
|
check += err;
|
||||||
|
|
||||||
data += read;
|
data += read;
|
||||||
remaining -= read;
|
remaining -= read;
|
||||||
}
|
}
|
||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((png_uint_32)check != (png_uint_32)length)
|
if ((png_uint_32)check != (png_uint_32)length)
|
||||||
png_error(png_ptr, "read Error");
|
png_error(png_ptr, "read Error");
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function allows the application to supply a new input function
|
/* This function allows the application to supply a new input function
|
||||||
* for libpng if standard C streams aren't being used.
|
* for libpng if standard C streams aren't being used.
|
||||||
*
|
*
|
||||||
* This function takes as its arguments:
|
* This function takes as its arguments:
|
||||||
|
*
|
||||||
* png_ptr - pointer to a png input data structure
|
* png_ptr - pointer to a png input data structure
|
||||||
|
*
|
||||||
* io_ptr - pointer to user supplied structure containing info about
|
* io_ptr - pointer to user supplied structure containing info about
|
||||||
* the input functions. May be NULL.
|
* the input functions. May be NULL.
|
||||||
|
*
|
||||||
* read_data_fn - pointer to a new input function that takes as its
|
* read_data_fn - pointer to a new input function that takes as its
|
||||||
* arguments a pointer to a png_struct, a pointer to
|
* arguments a pointer to a png_struct, a pointer to
|
||||||
* a location where input data can be stored, and a 32-bit
|
* a location where input data can be stored, and a 32-bit
|
||||||
@ -167,11 +147,13 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->io_ptr = io_ptr;
|
png_ptr->io_ptr = io_ptr;
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
if (read_data_fn != NULL)
|
if (read_data_fn != NULL)
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->read_data_fn = png_default_read_data;
|
png_ptr->read_data_fn = png_default_read_data;
|
||||||
#else
|
#else
|
||||||
@ -183,23 +165,12 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
{
|
{
|
||||||
png_ptr->write_data_fn = NULL;
|
png_ptr->write_data_fn = NULL;
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"It's an error to set both read_data_fn and write_data_fn in the ");
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
png_warning(png_ptr,
|
" same structure");
|
||||||
"same structure. Resetting write_data_fn to NULL.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
png_ptr->output_flush_fn = NULL;
|
png_ptr->output_flush_fn = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_INDEX_SUPPORTED
|
|
||||||
void PNGAPI
|
|
||||||
png_set_seek_fn(png_structp png_ptr, png_seek_ptr seek_data_fn)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
png_ptr->seek_data_fn = seek_data_fn;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED */
|
||||||
|
357
jni/libpng/pngstruct.h
Normal file
@ -0,0 +1,357 @@
|
|||||||
|
|
||||||
|
/* pngstruct.h - header file for PNG reference library
|
||||||
|
*
|
||||||
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
|
*
|
||||||
|
* Last changed in libpng 1.5.9 [March 29, 2012]
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The structure that holds the information to read and write PNG files.
|
||||||
|
* The only people who need to care about what is inside of this are the
|
||||||
|
* people who will be modifying the library for their own special needs.
|
||||||
|
* It should NOT be accessed directly by an application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PNGSTRUCT_H
|
||||||
|
#define PNGSTRUCT_H
|
||||||
|
/* zlib.h defines the structure z_stream, an instance of which is included
|
||||||
|
* in this structure and is required for decompressing the LZ compressed
|
||||||
|
* data in PNG files.
|
||||||
|
*/
|
||||||
|
#include "zlib.h"
|
||||||
|
|
||||||
|
struct png_struct_def
|
||||||
|
{
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
jmp_buf longjmp_buffer; /* used in png_error */
|
||||||
|
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
|
||||||
|
#endif
|
||||||
|
png_error_ptr error_fn; /* function for printing errors and aborting */
|
||||||
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
|
png_error_ptr warning_fn; /* function for printing warnings */
|
||||||
|
#endif
|
||||||
|
png_voidp error_ptr; /* user supplied struct for error functions */
|
||||||
|
png_rw_ptr write_data_fn; /* function for writing output data */
|
||||||
|
png_rw_ptr read_data_fn; /* function for reading input data */
|
||||||
|
png_voidp io_ptr; /* ptr to application struct for I/O functions */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
|
png_user_transform_ptr read_user_transform_fn; /* user read transform */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||||
|
png_user_transform_ptr write_user_transform_fn; /* user write transform */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These were added in libpng-1.0.2 */
|
||||||
|
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
|
png_voidp user_transform_ptr; /* user supplied struct for user transform */
|
||||||
|
png_byte user_transform_depth; /* bit depth of user transformed pixels */
|
||||||
|
png_byte user_transform_channels; /* channels in user transformed pixels */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_uint_32 mode; /* tells us where we are in the PNG file */
|
||||||
|
png_uint_32 flags; /* flags indicating various things to libpng */
|
||||||
|
png_uint_32 transformations; /* which transformations to perform */
|
||||||
|
|
||||||
|
z_stream zstream; /* pointer to decompression structure (below) */
|
||||||
|
png_bytep zbuf; /* buffer for zlib */
|
||||||
|
uInt zbuf_size; /* size of zbuf (typically 65536) */
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
|
/* Added in 1.5.4: state to keep track of whether the zstream has been
|
||||||
|
* initialized and if so whether it is for IDAT or some other chunk.
|
||||||
|
*/
|
||||||
|
#define PNG_ZLIB_UNINITIALIZED 0
|
||||||
|
#define PNG_ZLIB_FOR_IDAT 1
|
||||||
|
#define PNG_ZLIB_FOR_TEXT 2 /* anything other than IDAT */
|
||||||
|
#define PNG_ZLIB_USE_MASK 3 /* bottom two bits */
|
||||||
|
#define PNG_ZLIB_IN_USE 4 /* a flag value */
|
||||||
|
|
||||||
|
png_uint_32 zlib_state; /* State of zlib initialization */
|
||||||
|
/* End of material added at libpng 1.5.4 */
|
||||||
|
|
||||||
|
int zlib_level; /* holds zlib compression level */
|
||||||
|
int zlib_method; /* holds zlib compression method */
|
||||||
|
int zlib_window_bits; /* holds zlib compression window bits */
|
||||||
|
int zlib_mem_level; /* holds zlib compression memory level */
|
||||||
|
int zlib_strategy; /* holds zlib compression strategy */
|
||||||
|
#endif
|
||||||
|
/* Added at libpng 1.5.4 */
|
||||||
|
#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \
|
||||||
|
defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED)
|
||||||
|
int zlib_text_level; /* holds zlib compression level */
|
||||||
|
int zlib_text_method; /* holds zlib compression method */
|
||||||
|
int zlib_text_window_bits; /* holds zlib compression window bits */
|
||||||
|
int zlib_text_mem_level; /* holds zlib compression memory level */
|
||||||
|
int zlib_text_strategy; /* holds zlib compression strategy */
|
||||||
|
#endif
|
||||||
|
/* End of material added at libpng 1.5.4 */
|
||||||
|
|
||||||
|
png_uint_32 width; /* width of image in pixels */
|
||||||
|
png_uint_32 height; /* height of image in pixels */
|
||||||
|
png_uint_32 num_rows; /* number of rows in current pass */
|
||||||
|
png_uint_32 usr_width; /* width of row at start of write */
|
||||||
|
png_size_t rowbytes; /* size of row in bytes */
|
||||||
|
png_uint_32 iwidth; /* width of current interlaced row in pixels */
|
||||||
|
png_uint_32 row_number; /* current row in interlace pass */
|
||||||
|
png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
|
||||||
|
png_bytep prev_row; /* buffer to save previous (unfiltered) row.
|
||||||
|
* This is a pointer into big_prev_row
|
||||||
|
*/
|
||||||
|
png_bytep row_buf; /* buffer to save current (unfiltered) row.
|
||||||
|
* This is a pointer into big_row_buf
|
||||||
|
*/
|
||||||
|
png_bytep sub_row; /* buffer to save "sub" row when filtering */
|
||||||
|
png_bytep up_row; /* buffer to save "up" row when filtering */
|
||||||
|
png_bytep avg_row; /* buffer to save "avg" row when filtering */
|
||||||
|
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
|
||||||
|
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
||||||
|
|
||||||
|
png_uint_32 idat_size; /* current IDAT size for read */
|
||||||
|
png_uint_32 crc; /* current chunk CRC value */
|
||||||
|
png_colorp palette; /* palette from the input file */
|
||||||
|
png_uint_16 num_palette; /* number of color entries in palette */
|
||||||
|
|
||||||
|
/* Added at libpng-1.5.10 */
|
||||||
|
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
|
int num_palette_max; /* maximum palette index found in IDAT */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_uint_16 num_trans; /* number of transparency values */
|
||||||
|
png_byte compression; /* file compression type (always 0) */
|
||||||
|
png_byte filter; /* file filter type (always 0) */
|
||||||
|
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||||
|
png_byte pass; /* current interlace pass (0 - 6) */
|
||||||
|
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
|
||||||
|
png_byte color_type; /* color type of file */
|
||||||
|
png_byte bit_depth; /* bit depth of file */
|
||||||
|
png_byte usr_bit_depth; /* bit depth of users row: write only */
|
||||||
|
png_byte pixel_depth; /* number of bits per pixel */
|
||||||
|
png_byte channels; /* number of channels in file */
|
||||||
|
png_byte usr_channels; /* channels at start of write: write only */
|
||||||
|
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
||||||
|
png_byte maximum_pixel_depth;
|
||||||
|
/* pixel depth used for the row buffers */
|
||||||
|
png_byte transformed_pixel_depth;
|
||||||
|
/* pixel depth after read/write transforms */
|
||||||
|
png_byte io_chunk_string[5];
|
||||||
|
/* string name of chunk */
|
||||||
|
|
||||||
|
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||||
|
png_uint_16 filler; /* filler bytes for pixel expansion */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||||
|
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||||
|
png_byte background_gamma_type;
|
||||||
|
png_fixed_point background_gamma;
|
||||||
|
png_color_16 background; /* background color in screen gamma space */
|
||||||
|
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||||
|
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_bKGD_SUPPORTED */
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
|
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
||||||
|
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
|
||||||
|
png_uint_32 flush_rows; /* number of rows written since last flush */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||||
|
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
|
||||||
|
png_fixed_point gamma; /* file gamma value */
|
||||||
|
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
|
||||||
|
|
||||||
|
png_bytep gamma_table; /* gamma table for 8-bit depth files */
|
||||||
|
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
|
||||||
|
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|
||||||
|
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
|
||||||
|
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
||||||
|
png_bytep gamma_from_1; /* converts from 1.0 to screen */
|
||||||
|
png_bytep gamma_to_1; /* converts from file to 1.0 */
|
||||||
|
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
|
||||||
|
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
|
||||||
|
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
|
||||||
|
png_color_8 sig_bit; /* significant bits in each available channel */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||||
|
png_color_8 shift; /* shift for significant bit tranformation */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|
||||||
|
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
|
png_bytep trans_alpha; /* alpha values for paletted files */
|
||||||
|
png_color_16 trans_color; /* transparent color for non-paletted files */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
png_read_status_ptr read_row_fn; /* called after each row is decoded */
|
||||||
|
png_write_status_ptr write_row_fn; /* called after each row is encoded */
|
||||||
|
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
|
png_progressive_info_ptr info_fn; /* called after header data fully read */
|
||||||
|
png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
|
||||||
|
png_progressive_end_ptr end_fn; /* called after image is complete */
|
||||||
|
png_bytep save_buffer_ptr; /* current location in save_buffer */
|
||||||
|
png_bytep save_buffer; /* buffer for previously read data */
|
||||||
|
png_bytep current_buffer_ptr; /* current location in current_buffer */
|
||||||
|
png_bytep current_buffer; /* buffer for recently used data */
|
||||||
|
png_uint_32 push_length; /* size of current input chunk */
|
||||||
|
png_uint_32 skip_length; /* bytes to skip in input data */
|
||||||
|
png_size_t save_buffer_size; /* amount of data now in save_buffer */
|
||||||
|
png_size_t save_buffer_max; /* total size of save_buffer */
|
||||||
|
png_size_t buffer_size; /* total amount of available input data */
|
||||||
|
png_size_t current_buffer_size; /* amount of data now in current_buffer */
|
||||||
|
int process_mode; /* what push library is currently doing */
|
||||||
|
int cur_palette; /* current push library palette index */
|
||||||
|
|
||||||
|
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||||
|
|
||||||
|
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||||
|
/* For the Borland special 64K segment handler */
|
||||||
|
png_bytepp offset_table_ptr;
|
||||||
|
png_bytep offset_table;
|
||||||
|
png_uint_16 offset_table_number;
|
||||||
|
png_uint_16 offset_table_count;
|
||||||
|
png_uint_16 offset_table_count_free;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
png_bytep palette_lookup; /* lookup table for quantizing */
|
||||||
|
png_bytep quantize_index; /* index translation for palette files */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
|
||||||
|
png_uint_16p hist; /* histogram */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
|
png_byte heuristic_method; /* heuristic for row filter selection */
|
||||||
|
png_byte num_prev_filters; /* number of weights for previous rows */
|
||||||
|
png_bytep prev_filters; /* filter type(s) of previous row(s) */
|
||||||
|
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
|
||||||
|
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
|
||||||
|
png_uint_16p filter_costs; /* relative filter calculation cost */
|
||||||
|
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||||
|
char time_buffer[29]; /* String to hold RFC 1123 time text */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.6 */
|
||||||
|
|
||||||
|
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||||
|
|
||||||
|
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
||||||
|
png_voidp user_chunk_ptr;
|
||||||
|
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
int num_chunk_list;
|
||||||
|
png_bytep chunk_list;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_READ_sRGB_SUPPORTED
|
||||||
|
/* Added in 1.5.5 to record an sRGB chunk in the png. */
|
||||||
|
png_byte is_sRGB;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.3 */
|
||||||
|
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||||
|
png_byte rgb_to_gray_status;
|
||||||
|
/* Added in libpng 1.5.5 to record setting of coefficients: */
|
||||||
|
png_byte rgb_to_gray_coefficients_set;
|
||||||
|
/* These were changed from png_byte in libpng-1.0.6 */
|
||||||
|
png_uint_16 rgb_to_gray_red_coeff;
|
||||||
|
png_uint_16 rgb_to_gray_green_coeff;
|
||||||
|
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
|
||||||
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
|
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
|
||||||
|
png_uint_32 mng_features_permitted;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
|
||||||
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
|
png_byte filter_type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.2.0 */
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
png_voidp mem_ptr; /* user supplied struct for mem functions */
|
||||||
|
png_malloc_ptr malloc_fn; /* function for allocating memory */
|
||||||
|
png_free_ptr free_fn; /* function for freeing memory */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.13 and 1.2.0 */
|
||||||
|
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
|
/* The following three members were added at version 1.0.14 and 1.2.4 */
|
||||||
|
png_bytep quantize_sort; /* working sort array */
|
||||||
|
png_bytep index_to_palette; /* where the original index currently is
|
||||||
|
in the palette */
|
||||||
|
png_bytep palette_to_index; /* which original index points to this
|
||||||
|
palette color */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New members added in libpng-1.0.16 and 1.2.6 */
|
||||||
|
png_byte compression_type;
|
||||||
|
|
||||||
|
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||||
|
png_uint_32 user_width_max;
|
||||||
|
png_uint_32 user_height_max;
|
||||||
|
|
||||||
|
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
|
||||||
|
* chunks that can be stored (0 means unlimited).
|
||||||
|
*/
|
||||||
|
png_uint_32 user_chunk_cache_max;
|
||||||
|
|
||||||
|
/* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
|
||||||
|
* can occupy when decompressed. 0 means unlimited.
|
||||||
|
*/
|
||||||
|
png_alloc_size_t user_chunk_malloc_max;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.0.25 and 1.2.17 */
|
||||||
|
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
/* Storage for unknown chunk that the library doesn't recognize. */
|
||||||
|
png_unknown_chunk unknown_chunk;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.2.26 */
|
||||||
|
png_size_t old_big_row_buf_size;
|
||||||
|
|
||||||
|
/* New member added in libpng-1.2.30 */
|
||||||
|
png_charp chunkdata; /* buffer for reading chunk data */
|
||||||
|
|
||||||
|
#ifdef PNG_IO_STATE_SUPPORTED
|
||||||
|
/* New member added in libpng-1.4.0 */
|
||||||
|
png_uint_32 io_state;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* New member added in libpng-1.5.6 */
|
||||||
|
png_bytep big_prev_row;
|
||||||
|
|
||||||
|
void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
|
||||||
|
png_bytep row, png_const_bytep prev_row);
|
||||||
|
};
|
||||||
|
#endif /* PNGSTRUCT_H */
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.5 KiB |
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [December 3, 2009]
|
* Last changed in libpng 1.5.10 [March 8, 2012]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -11,9 +11,8 @@
|
|||||||
* and license in png.h
|
* and license in png.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
|
||||||
#include "png.h"
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
@ -25,6 +24,7 @@ png_set_bgr(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_BGR;
|
png_ptr->transformations |= PNG_BGR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -38,6 +38,7 @@ png_set_swap(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (png_ptr->bit_depth == 16)
|
if (png_ptr->bit_depth == 16)
|
||||||
png_ptr->transformations |= PNG_SWAP_BYTES;
|
png_ptr->transformations |= PNG_SWAP_BYTES;
|
||||||
}
|
}
|
||||||
@ -52,6 +53,7 @@ png_set_packing(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_PACK;
|
png_ptr->transformations |= PNG_PACK;
|
||||||
@ -69,6 +71,7 @@ png_set_packswap(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
png_ptr->transformations |= PNG_PACKSWAP;
|
png_ptr->transformations |= PNG_PACKSWAP;
|
||||||
}
|
}
|
||||||
@ -76,12 +79,13 @@ png_set_packswap(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
|
png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_shift");
|
png_debug(1, "in png_set_shift");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_SHIFT;
|
png_ptr->transformations |= PNG_SHIFT;
|
||||||
png_ptr->shift = *true_bits;
|
png_ptr->shift = *true_bits;
|
||||||
}
|
}
|
||||||
@ -117,14 +121,13 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_FILLER;
|
png_ptr->transformations |= PNG_FILLER;
|
||||||
#ifdef PNG_LEGACY_SUPPORTED
|
|
||||||
png_ptr->filler = (png_byte)filler;
|
|
||||||
#else
|
|
||||||
png_ptr->filler = (png_uint_16)filler;
|
png_ptr->filler = (png_uint_16)filler;
|
||||||
#endif
|
|
||||||
if (filler_loc == PNG_FILLER_AFTER)
|
if (filler_loc == PNG_FILLER_AFTER)
|
||||||
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
@ -139,7 +142,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
||||||
* a less-than-8-bit grayscale to GA? */
|
* a less-than-8-bit grayscale to GA?) */
|
||||||
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
||||||
{
|
{
|
||||||
@ -147,7 +150,6 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PNG_1_0_X
|
|
||||||
/* Added to libpng-1.2.7 */
|
/* Added to libpng-1.2.7 */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
@ -156,10 +158,10 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_set_filler(png_ptr, filler, filler_loc);
|
png_set_filler(png_ptr, filler, filler_loc);
|
||||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -172,6 +174,7 @@ png_set_swap_alpha(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
png_ptr->transformations |= PNG_SWAP_ALPHA;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -185,6 +188,7 @@ png_set_invert_alpha(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
png_ptr->transformations |= PNG_INVERT_ALPHA;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -197,6 +201,7 @@ png_set_invert_mono(png_structp png_ptr)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_INVERT_MONO;
|
png_ptr->transformations |= PNG_INVERT_MONO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,15 +214,11 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||||||
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
/* This test removed from libpng version 1.0.13 and 1.2.0:
|
||||||
* if (row_info->bit_depth == 1 &&
|
* if (row_info->bit_depth == 1 &&
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
if (row == NULL || row_info == NULL)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_uint_32 i;
|
png_size_t i;
|
||||||
png_uint_32 istop = row_info->rowbytes;
|
png_size_t istop = row_info->rowbytes;
|
||||||
|
|
||||||
for (i = 0; i < istop; i++)
|
for (i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
@ -225,36 +226,41 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
row_info->bit_depth == 8)
|
row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_uint_32 i;
|
png_size_t i;
|
||||||
png_uint_32 istop = row_info->rowbytes;
|
png_size_t istop = row_info->rowbytes;
|
||||||
|
|
||||||
for (i = 0; i < istop; i+=2)
|
for (i = 0; i < istop; i += 2)
|
||||||
{
|
{
|
||||||
*rp = (png_byte)(~(*rp));
|
*rp = (png_byte)(~(*rp));
|
||||||
rp+=2;
|
rp += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_16BIT_SUPPORTED
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
||||||
row_info->bit_depth == 16)
|
row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_uint_32 i;
|
png_size_t i;
|
||||||
png_uint_32 istop = row_info->rowbytes;
|
png_size_t istop = row_info->rowbytes;
|
||||||
|
|
||||||
for (i = 0; i < istop; i+=4)
|
for (i = 0; i < istop; i += 4)
|
||||||
{
|
{
|
||||||
*rp = (png_byte)(~(*rp));
|
*rp = (png_byte)(~(*rp));
|
||||||
*(rp+1) = (png_byte)(~(*(rp+1)));
|
*(rp + 1) = (png_byte)(~(*(rp + 1)));
|
||||||
rp+=4;
|
rp += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_16BIT_SUPPORTED
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* Swaps byte order on 16 bit depth images */
|
/* Swaps byte order on 16 bit depth images */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
@ -262,11 +268,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_do_swap");
|
png_debug(1, "in png_do_swap");
|
||||||
|
|
||||||
if (
|
if (row_info->bit_depth == 16)
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->bit_depth == 16)
|
|
||||||
{
|
{
|
||||||
png_bytep rp = row;
|
png_bytep rp = row;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
@ -281,6 +283,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||||
static PNG_CONST png_byte onebppswaptable[256] = {
|
static PNG_CONST png_byte onebppswaptable[256] = {
|
||||||
@ -394,22 +397,22 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_do_packswap");
|
png_debug(1, "in png_do_packswap");
|
||||||
|
|
||||||
if (
|
if (row_info->bit_depth < 8)
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->bit_depth < 8)
|
|
||||||
{
|
{
|
||||||
png_bytep rp, end, table;
|
png_bytep rp;
|
||||||
|
png_const_bytep end, table;
|
||||||
|
|
||||||
end = row + row_info->rowbytes;
|
end = row + row_info->rowbytes;
|
||||||
|
|
||||||
if (row_info->bit_depth == 1)
|
if (row_info->bit_depth == 1)
|
||||||
table = (png_bytep)onebppswaptable;
|
table = onebppswaptable;
|
||||||
|
|
||||||
else if (row_info->bit_depth == 2)
|
else if (row_info->bit_depth == 2)
|
||||||
table = (png_bytep)twobppswaptable;
|
table = twobppswaptable;
|
||||||
|
|
||||||
else if (row_info->bit_depth == 4)
|
else if (row_info->bit_depth == 4)
|
||||||
table = (png_bytep)fourbppswaptable;
|
table = fourbppswaptable;
|
||||||
|
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -421,161 +424,119 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||||
/* Remove filler or alpha byte(s) */
|
/* Remove a channel - this used to be 'png_do_strip_filler' but it used a
|
||||||
|
* somewhat weird combination of flags to determine what to do. All the calls
|
||||||
|
* to png_do_strip_filler are changed in 1.5.2 to call this instead with the
|
||||||
|
* correct arguments.
|
||||||
|
*
|
||||||
|
* The routine isn't general - the channel must be the channel at the start or
|
||||||
|
* end (not in the middle) of each pixel.
|
||||||
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
|
png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_strip_filler");
|
png_bytep sp = row; /* source pointer */
|
||||||
|
png_bytep dp = row; /* destination pointer */
|
||||||
|
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
|
||||||
|
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
/* At the start sp will point to the first byte to copy and dp to where
|
||||||
if (row != NULL && row_info != NULL)
|
* it is copied to. ep always points just beyond the end of the row, so
|
||||||
#endif
|
* the loop simply copies (channels-1) channels until sp reaches ep.
|
||||||
{
|
*
|
||||||
png_bytep sp=row;
|
* at_start: 0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc.
|
||||||
png_bytep dp=row;
|
* nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc.
|
||||||
png_uint_32 row_width=row_info->width;
|
*/
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
if ((row_info->color_type == PNG_COLOR_TYPE_RGB ||
|
/* GA, GX, XG cases */
|
||||||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
|
if (row_info->channels == 2)
|
||||||
(flags & PNG_FLAG_STRIP_ALPHA))) &&
|
|
||||||
row_info->channels == 4)
|
|
||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
/* This converts from RGBX or RGBA to RGB */
|
if (at_start) /* Skip initial filler */
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
++sp;
|
||||||
{
|
else /* Skip initial channel and, for sp, the filler */
|
||||||
dp+=3; sp+=4;
|
sp += 2, ++dp;
|
||||||
for (i = 1; i < row_width; i++)
|
|
||||||
{
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This converts from XRGB or ARGB to RGB */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 24;
|
|
||||||
row_info->rowbytes = row_width * 3;
|
|
||||||
}
|
|
||||||
else /* if (row_info->bit_depth == 16) */
|
|
||||||
{
|
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
|
||||||
{
|
|
||||||
/* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */
|
|
||||||
sp += 8; dp += 6;
|
|
||||||
for (i = 1; i < row_width; i++)
|
|
||||||
{
|
|
||||||
/* This could be (although png_memcpy is probably slower):
|
|
||||||
png_memcpy(dp, sp, 6);
|
|
||||||
sp += 8;
|
|
||||||
dp += 6;
|
|
||||||
*/
|
|
||||||
|
|
||||||
*dp++ = *sp++;
|
/* For a 1 pixel wide image there is nothing to do */
|
||||||
*dp++ = *sp++;
|
while (sp < ep)
|
||||||
*dp++ = *sp++;
|
*dp++ = *sp, sp += 2;
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This converts from XXRRGGBB or AARRGGBB to RRGGBB */
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
/* This could be (although png_memcpy is probably slower):
|
|
||||||
png_memcpy(dp, sp, 6);
|
|
||||||
sp += 8;
|
|
||||||
dp += 6;
|
|
||||||
*/
|
|
||||||
|
|
||||||
sp+=2;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 48;
|
|
||||||
row_info->rowbytes = row_width * 6;
|
|
||||||
}
|
|
||||||
row_info->channels = 3;
|
|
||||||
}
|
|
||||||
else if ((row_info->color_type == PNG_COLOR_TYPE_GRAY ||
|
|
||||||
(row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
|
|
||||||
(flags & PNG_FLAG_STRIP_ALPHA))) &&
|
|
||||||
row_info->channels == 2)
|
|
||||||
{
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
/* This converts from GX or GA to G */
|
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
|
||||||
{
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* This converts from XG or AG to G */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 8;
|
row_info->pixel_depth = 8;
|
||||||
row_info->rowbytes = row_width;
|
|
||||||
}
|
}
|
||||||
else /* if (row_info->bit_depth == 16) */
|
|
||||||
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
if (at_start) /* Skip initial filler */
|
||||||
{
|
|
||||||
/* This converts from GGXX or GGAA to GG */
|
|
||||||
sp += 4; dp += 2;
|
|
||||||
for (i = 1; i < row_width; i++)
|
|
||||||
{
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
sp += 2;
|
sp += 2;
|
||||||
}
|
else /* Skip initial channel and, for sp, the filler */
|
||||||
}
|
sp += 4, dp += 2;
|
||||||
else
|
|
||||||
{
|
while (sp < ep)
|
||||||
/* This converts from XXGG or AAGG to GG */
|
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
||||||
for (i = 0; i < row_width; i++)
|
|
||||||
{
|
|
||||||
sp += 2;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
*dp++ = *sp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
row_info->pixel_depth = 16;
|
row_info->pixel_depth = 16;
|
||||||
row_info->rowbytes = row_width * 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return; /* bad bit depth */
|
||||||
|
|
||||||
row_info->channels = 1;
|
row_info->channels = 1;
|
||||||
|
|
||||||
|
/* Finally fix the color type if it records an alpha channel */
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
|
row_info->color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
}
|
}
|
||||||
if (flags & PNG_FLAG_STRIP_ALPHA)
|
|
||||||
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
|
/* RGBA, RGBX, XRGB cases */
|
||||||
|
else if (row_info->channels == 4)
|
||||||
|
{
|
||||||
|
if (row_info->bit_depth == 8)
|
||||||
|
{
|
||||||
|
if (at_start) /* Skip initial filler */
|
||||||
|
++sp;
|
||||||
|
else /* Skip initial channels and, for sp, the filler */
|
||||||
|
sp += 4, dp += 3;
|
||||||
|
|
||||||
|
/* Note that the loop adds 3 to dp and 4 to sp each time. */
|
||||||
|
while (sp < ep)
|
||||||
|
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
|
||||||
|
|
||||||
|
row_info->pixel_depth = 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (row_info->bit_depth == 16)
|
||||||
|
{
|
||||||
|
if (at_start) /* Skip initial filler */
|
||||||
|
sp += 2;
|
||||||
|
else /* Skip initial channels and, for sp, the filler */
|
||||||
|
sp += 8, dp += 6;
|
||||||
|
|
||||||
|
while (sp < ep)
|
||||||
|
{
|
||||||
|
/* Copy 6 bytes, skip 2 */
|
||||||
|
*dp++ = *sp++, *dp++ = *sp++;
|
||||||
|
*dp++ = *sp++, *dp++ = *sp++;
|
||||||
|
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
row_info->pixel_depth = 48;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return; /* bad bit depth */
|
||||||
|
|
||||||
|
row_info->channels = 3;
|
||||||
|
|
||||||
|
/* Finally fix the color type if it records an alpha channel */
|
||||||
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
|
row_info->color_type = PNG_COLOR_TYPE_RGB;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return; /* The filler channel has gone already */
|
||||||
|
|
||||||
|
/* Fix the rowbytes value. */
|
||||||
|
row_info->rowbytes = dp-row;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -586,11 +547,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_do_bgr");
|
png_debug(1, "in png_do_bgr");
|
||||||
|
|
||||||
if (
|
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
|
||||||
{
|
{
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
@ -607,6 +564,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
*(rp + 2) = save;
|
*(rp + 2) = save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
@ -620,6 +578,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_16BIT_SUPPORTED
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
@ -637,6 +597,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
*(rp + 5) = save;
|
*(rp + 5) = save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
@ -653,13 +614,117 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
||||||
|
|
||||||
|
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
||||||
|
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
||||||
|
/* Added at libpng-1.5.10 */
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_do_check_palette_indexes(png_structp png_ptr, png_row_infop row_info)
|
||||||
|
{
|
||||||
|
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
|
||||||
|
png_ptr->num_palette_max >= 0)
|
||||||
|
{
|
||||||
|
/* Calculations moved outside switch in an attempt to stop different
|
||||||
|
* compiler warnings. 'padding' is in *bits* within the last byte, it is
|
||||||
|
* an 'int' because pixel_depth becomes an 'int' in the expression below,
|
||||||
|
* and this calculation is used because it avoids warnings that other
|
||||||
|
* forms produced on either GCC or MSVC.
|
||||||
|
*/
|
||||||
|
int padding = (-row_info->pixel_depth * row_info->width) & 7;
|
||||||
|
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||||
|
|
||||||
|
switch (row_info->bit_depth)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
/* in this case, all bytes must be 0 so we don't need
|
||||||
|
* to unpack the pixels except for the rightmost one.
|
||||||
|
*/
|
||||||
|
for (; rp > png_ptr->row_buf; rp--)
|
||||||
|
{
|
||||||
|
if (*rp >> padding != 0)
|
||||||
|
png_ptr->num_palette_max = 1;
|
||||||
|
padding = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
for (; rp > png_ptr->row_buf; rp--)
|
||||||
|
{
|
||||||
|
int i = ((*rp >> padding) & 0x03);
|
||||||
|
|
||||||
|
if (i > png_ptr->num_palette_max)
|
||||||
|
png_ptr->num_palette_max = i;
|
||||||
|
|
||||||
|
i = (((*rp >> padding) >> 2) & 0x03);
|
||||||
|
|
||||||
|
if (i > png_ptr->num_palette_max)
|
||||||
|
png_ptr->num_palette_max = i;
|
||||||
|
|
||||||
|
i = (((*rp >> padding) >> 4) & 0x03);
|
||||||
|
|
||||||
|
if (i > png_ptr->num_palette_max)
|
||||||
|
png_ptr->num_palette_max = i;
|
||||||
|
|
||||||
|
i = (((*rp >> padding) >> 6) & 0x03);
|
||||||
|
|
||||||
|
if (i > png_ptr->num_palette_max)
|
||||||
|
png_ptr->num_palette_max = i;
|
||||||
|
|
||||||
|
padding = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
for (; rp > png_ptr->row_buf; rp--)
|
||||||
|
{
|
||||||
|
int i = ((*rp >> padding) & 0x0f);
|
||||||
|
|
||||||
|
if (i > png_ptr->num_palette_max)
|
||||||
|
png_ptr->num_palette_max = i;
|
||||||
|
|
||||||
|
i = (((*rp >> padding) >> 4) & 0x0f);
|
||||||
|
|
||||||
|
if (i > png_ptr->num_palette_max)
|
||||||
|
png_ptr->num_palette_max = i;
|
||||||
|
|
||||||
|
padding = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
{
|
||||||
|
for (; rp > png_ptr->row_buf; rp--)
|
||||||
|
{
|
||||||
|
if (*rp >= png_ptr->num_palette_max)
|
||||||
|
png_ptr->num_palette_max = (int) *rp;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED */
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
defined(PNG_LEGACY_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
|
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
||||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||||
@ -668,15 +733,9 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
|
||||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||||
#else
|
|
||||||
if (user_transform_ptr || user_transform_depth || user_transform_channels)
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"This version of libpng does not support user transform info");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -685,15 +744,38 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
|||||||
* associated with this pointer before png_write_destroy and png_read_destroy
|
* associated with this pointer before png_write_destroy and png_read_destroy
|
||||||
* are called.
|
* are called.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_user_transform_ptr(png_structp png_ptr)
|
png_get_user_transform_ptr(png_const_structp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
|
||||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
return ((png_voidp)png_ptr->user_transform_ptr);
|
||||||
#else
|
|
||||||
return (NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
|
||||||
|
png_uint_32 PNGAPI
|
||||||
|
png_get_current_row_number(png_const_structp png_ptr)
|
||||||
|
{
|
||||||
|
/* See the comments in png.h - this is the sub-image row when reading and
|
||||||
|
* interlaced image.
|
||||||
|
*/
|
||||||
|
if (png_ptr != NULL)
|
||||||
|
return png_ptr->row_number;
|
||||||
|
|
||||||
|
return PNG_UINT_32_MAX; /* help the app not to fail silently */
|
||||||
|
}
|
||||||
|
|
||||||
|
png_byte PNGAPI
|
||||||
|
png_get_current_pass_number(png_const_structp png_ptr)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL)
|
||||||
|
return png_ptr->pass;
|
||||||
|
return 8; /* invalid */
|
||||||
|
}
|
||||||
|
#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
|
||||||
|
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
|
||||||
|
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||||
|
14
jni/libpng/pngusr.dfa
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# pngusr.dfa
|
||||||
|
#
|
||||||
|
# Build time configuration of libpng
|
||||||
|
#
|
||||||
|
# Enter build configuration options in this file
|
||||||
|
#
|
||||||
|
# Security settings: by default these limits are unset, you can change them
|
||||||
|
# here by entering the appropriate values as #defines preceded by '@' (to cause,
|
||||||
|
# them to be passed through to the build of pnglibconf.h), for example:
|
||||||
|
#
|
||||||
|
# @# define PNG_USER_WIDTH_MAX 1000000
|
||||||
|
# @# define PNG_USER_HEIGHT_MAX 1000000
|
||||||
|
# @# define PNG_USER_CHUNK_CACHE_MAX 128
|
||||||
|
# @# define PNG_USER_CHUNK_MALLOC_MAX 8000000
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.41 [December 3, 2009]
|
* Last changed in libpng 1.5.0 [January 6, 2011]
|
||||||
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -18,9 +18,8 @@
|
|||||||
* them at run time with png_set_write_fn(...).
|
* them at run time with png_set_write_fn(...).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
|
||||||
#include "png.h"
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
/* Write the data to whatever output you are using. The default routine
|
/* Write the data to whatever output you are using. The default routine
|
||||||
@ -31,10 +30,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
|
/* NOTE: write_data_fn must not change the buffer! */
|
||||||
if (png_ptr->write_data_fn != NULL )
|
if (png_ptr->write_data_fn != NULL )
|
||||||
(*(png_ptr->write_data_fn))(png_ptr, data, length);
|
(*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL write function");
|
png_error(png_ptr, "Call to NULL write function");
|
||||||
}
|
}
|
||||||
@ -46,19 +47,16 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
* than changing the library.
|
* than changing the library.
|
||||||
*/
|
*/
|
||||||
#ifndef USE_FAR_KEYWORD
|
#ifndef USE_FAR_KEYWORD
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_size_t check;
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr));
|
||||||
#endif
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
@ -71,7 +69,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
#define NEAR_BUF_SIZE 1024
|
#define NEAR_BUF_SIZE 1024
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
#define MIN(a,b) (a <= b ? a : b)
|
||||||
|
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_uint_32 check;
|
png_uint_32 check;
|
||||||
@ -80,34 +78,29 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
/* Check if data really is near. If so, use usual code. */
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
||||||
|
|
||||||
if ((png_bytep)near_data == data)
|
if ((png_bytep)near_data == data)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
|
|
||||||
check = 0;
|
|
||||||
#else
|
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
check = fwrite(near_data, 1, length, io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
png_byte buf[NEAR_BUF_SIZE];
|
||||||
png_size_t written, remaining, err;
|
png_size_t written, remaining, err;
|
||||||
check = 0;
|
check = 0;
|
||||||
remaining = length;
|
remaining = length;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
written = MIN(NEAR_BUF_SIZE, remaining);
|
||||||
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
|
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
|
|
||||||
err = 0;
|
|
||||||
#else
|
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
err = fwrite(buf, 1, written, io_ptr);
|
||||||
#endif
|
|
||||||
if (err != written)
|
if (err != written)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -119,6 +112,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
}
|
}
|
||||||
while (remaining != 0);
|
while (remaining != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
@ -138,21 +132,19 @@ png_flush(png_structp png_ptr)
|
|||||||
(*(png_ptr->output_flush_fn))(png_ptr);
|
(*(png_ptr->output_flush_fn))(png_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
# ifdef PNG_STDIO_SUPPORTED
|
||||||
void PNGAPI
|
void PNGCBAPI
|
||||||
png_default_flush(png_structp png_ptr)
|
png_default_flush(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
png_FILE_p io_ptr;
|
png_FILE_p io_ptr;
|
||||||
#endif
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
#ifndef _WIN32_WCE
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||||
fflush(io_ptr);
|
fflush(io_ptr);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function allows the application to supply new output functions for
|
/* This function allows the application to supply new output functions for
|
||||||
@ -204,30 +196,32 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
# ifdef PNG_STDIO_SUPPORTED
|
||||||
|
|
||||||
if (output_flush_fn != NULL)
|
if (output_flush_fn != NULL)
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->output_flush_fn = png_default_flush;
|
png_ptr->output_flush_fn = png_default_flush;
|
||||||
#else
|
|
||||||
|
# else
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
#endif
|
# endif
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||||
|
|
||||||
/* It is an error to read while writing a png file */
|
/* It is an error to read while writing a png file */
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
{
|
{
|
||||||
png_ptr->read_data_fn = NULL;
|
png_ptr->read_data_fn = NULL;
|
||||||
|
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Attempted to set both read_data_fn and write_data_fn in");
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
png_warning(png_ptr,
|
" same structure");
|
||||||
"the same structure. Resetting read_data_fn to NULL.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_FAR_KEYWORD
|
#ifdef USE_FAR_KEYWORD
|
||||||
#ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
||||||
{
|
{
|
||||||
void *near_ptr;
|
void *near_ptr;
|
||||||
@ -256,5 +250,5 @@ void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
|||||||
return(near_ptr);
|
return(near_ptr);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# endif
|
#endif
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.2.43 [February 25, 2010]
|
* Last changed in libpng 1.5.6 [November 3, 2011]
|
||||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -11,16 +11,16 @@
|
|||||||
* and license in png.h
|
* and license in png.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_INTERNAL
|
#include "pngpriv.h"
|
||||||
#define PNG_NO_PEDANTIC_WARNINGS
|
|
||||||
#include "png.h"
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||||
/* Transform the data according to the user's wishes. The order of
|
/* Transform the data according to the user's wishes. The order of
|
||||||
* transformations is significant.
|
* transformations is significant.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_write_transformations(png_structp png_ptr)
|
png_do_write_transformations(png_structp png_ptr, png_row_infop row_info)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_transformations");
|
png_debug(1, "in png_do_write_transformations");
|
||||||
|
|
||||||
@ -33,53 +33,62 @@ png_do_write_transformations(png_structp png_ptr)
|
|||||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||||
function */
|
function */
|
||||||
(png_ptr, /* png_ptr */
|
(png_ptr, /* png_ptr */
|
||||||
&(png_ptr->row_info), /* row_info: */
|
row_info, /* row_info: */
|
||||||
/* png_uint_32 width; width of row */
|
/* png_uint_32 width; width of row */
|
||||||
/* png_uint_32 rowbytes; number of bytes in row */
|
/* png_size_t rowbytes; number of bytes in row */
|
||||||
/* png_byte color_type; color type of pixels */
|
/* png_byte color_type; color type of pixels */
|
||||||
/* png_byte bit_depth; bit depth of samples */
|
/* png_byte bit_depth; bit depth of samples */
|
||||||
/* png_byte channels; number of channels (1-4) */
|
/* png_byte channels; number of channels (1-4) */
|
||||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_FILLER)
|
if (png_ptr->transformations & PNG_FILLER)
|
||||||
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||||
png_ptr->flags);
|
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||||
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_PACK)
|
if (png_ptr->transformations & PNG_PACK)
|
||||||
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
png_do_pack(row_info, png_ptr->row_buf + 1,
|
||||||
(png_uint_32)png_ptr->bit_depth);
|
(png_uint_32)png_ptr->bit_depth);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||||
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_SHIFT)
|
if (png_ptr->transformations & PNG_SHIFT)
|
||||||
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
|
png_do_shift(row_info, png_ptr->row_buf + 1,
|
||||||
&(png_ptr->shift));
|
&(png_ptr->shift));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
||||||
png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||||
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_BGR_SUPPORTED
|
#ifdef PNG_WRITE_BGR_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_BGR)
|
if (png_ptr->transformations & PNG_BGR)
|
||||||
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
||||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||||
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +103,6 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
png_debug(1, "in png_do_pack");
|
png_debug(1, "in png_do_pack");
|
||||||
|
|
||||||
if (row_info->bit_depth == 8 &&
|
if (row_info->bit_depth == 8 &&
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
row_info->channels == 1)
|
row_info->channels == 1)
|
||||||
{
|
{
|
||||||
switch ((int)bit_depth)
|
switch ((int)bit_depth)
|
||||||
@ -117,9 +123,12 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
{
|
{
|
||||||
if (*sp != 0)
|
if (*sp != 0)
|
||||||
v |= mask;
|
v |= mask;
|
||||||
|
|
||||||
sp++;
|
sp++;
|
||||||
|
|
||||||
if (mask > 1)
|
if (mask > 1)
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mask = 0x80;
|
mask = 0x80;
|
||||||
@ -128,10 +137,13 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask != 0x80)
|
if (mask != 0x80)
|
||||||
*dp = (png_byte)v;
|
*dp = (png_byte)v;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
@ -143,12 +155,14 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
dp = row;
|
dp = row;
|
||||||
shift = 6;
|
shift = 6;
|
||||||
v = 0;
|
v = 0;
|
||||||
|
|
||||||
for (i = 0; i < row_width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
png_byte value;
|
png_byte value;
|
||||||
|
|
||||||
value = (png_byte)(*sp & 0x03);
|
value = (png_byte)(*sp & 0x03);
|
||||||
v |= (value << shift);
|
v |= (value << shift);
|
||||||
|
|
||||||
if (shift == 0)
|
if (shift == 0)
|
||||||
{
|
{
|
||||||
shift = 6;
|
shift = 6;
|
||||||
@ -156,14 +170,19 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
dp++;
|
dp++;
|
||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
shift -= 2;
|
shift -= 2;
|
||||||
|
|
||||||
sp++;
|
sp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shift != 6)
|
if (shift != 6)
|
||||||
*dp = (png_byte)v;
|
*dp = (png_byte)v;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
@ -175,6 +194,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
dp = row;
|
dp = row;
|
||||||
shift = 4;
|
shift = 4;
|
||||||
v = 0;
|
v = 0;
|
||||||
|
|
||||||
for (i = 0; i < row_width; i++)
|
for (i = 0; i < row_width; i++)
|
||||||
{
|
{
|
||||||
png_byte value;
|
png_byte value;
|
||||||
@ -189,16 +209,23 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
dp++;
|
dp++;
|
||||||
v = 0;
|
v = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
shift -= 4;
|
shift -= 4;
|
||||||
|
|
||||||
sp++;
|
sp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shift != 4)
|
if (shift != 4)
|
||||||
*dp = (png_byte)v;
|
*dp = (png_byte)v;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
row_info->bit_depth = (png_byte)bit_depth;
|
row_info->bit_depth = (png_byte)bit_depth;
|
||||||
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
|
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
|
||||||
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
|
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
|
||||||
@ -216,16 +243,12 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
* data to 0 to 15.
|
* data to 0 to 15.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
png_do_shift(png_row_infop row_info, png_bytep row,
|
||||||
|
png_const_color_8p bit_depth)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_shift");
|
png_debug(1, "in png_do_shift");
|
||||||
|
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
if (row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||||
if (row != NULL && row_info != NULL &&
|
|
||||||
#else
|
|
||||||
if (
|
|
||||||
#endif
|
|
||||||
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
|
||||||
{
|
{
|
||||||
int shift_start[4], shift_dec[4];
|
int shift_start[4], shift_dec[4];
|
||||||
int channels = 0;
|
int channels = 0;
|
||||||
@ -235,19 +258,23 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
||||||
shift_dec[channels] = bit_depth->red;
|
shift_dec[channels] = bit_depth->red;
|
||||||
channels++;
|
channels++;
|
||||||
|
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->green;
|
shift_start[channels] = row_info->bit_depth - bit_depth->green;
|
||||||
shift_dec[channels] = bit_depth->green;
|
shift_dec[channels] = bit_depth->green;
|
||||||
channels++;
|
channels++;
|
||||||
|
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->blue;
|
shift_start[channels] = row_info->bit_depth - bit_depth->blue;
|
||||||
shift_dec[channels] = bit_depth->blue;
|
shift_dec[channels] = bit_depth->blue;
|
||||||
channels++;
|
channels++;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->gray;
|
shift_start[channels] = row_info->bit_depth - bit_depth->gray;
|
||||||
shift_dec[channels] = bit_depth->gray;
|
shift_dec[channels] = bit_depth->gray;
|
||||||
channels++;
|
channels++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
|
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
|
||||||
{
|
{
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
||||||
@ -259,14 +286,16 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
if (row_info->bit_depth < 8)
|
if (row_info->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_bytep bp = row;
|
png_bytep bp = row;
|
||||||
png_uint_32 i;
|
png_size_t i;
|
||||||
png_byte mask;
|
png_byte mask;
|
||||||
png_uint_32 row_bytes = row_info->rowbytes;
|
png_size_t row_bytes = row_info->rowbytes;
|
||||||
|
|
||||||
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
||||||
mask = 0x55;
|
mask = 0x55;
|
||||||
|
|
||||||
else if (row_info->bit_depth == 4 && bit_depth->gray == 3)
|
else if (row_info->bit_depth == 4 && bit_depth->gray == 3)
|
||||||
mask = 0x11;
|
mask = 0x11;
|
||||||
|
|
||||||
else
|
else
|
||||||
mask = 0xff;
|
mask = 0xff;
|
||||||
|
|
||||||
@ -277,15 +306,18 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
|
|
||||||
v = *bp;
|
v = *bp;
|
||||||
*bp = 0;
|
*bp = 0;
|
||||||
|
|
||||||
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
|
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
*bp |= (png_byte)((v << j) & 0xff);
|
*bp |= (png_byte)((v << j) & 0xff);
|
||||||
|
|
||||||
else
|
else
|
||||||
*bp |= (png_byte)((v >> (-j)) & mask);
|
*bp |= (png_byte)((v >> (-j)) & mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->bit_depth == 8)
|
else if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
png_bytep bp = row;
|
png_bytep bp = row;
|
||||||
@ -301,15 +333,18 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
|
|
||||||
v = *bp;
|
v = *bp;
|
||||||
*bp = 0;
|
*bp = 0;
|
||||||
|
|
||||||
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
*bp |= (png_byte)((v << j) & 0xff);
|
*bp |= (png_byte)((v << j) & 0xff);
|
||||||
|
|
||||||
else
|
else
|
||||||
*bp |= (png_byte)((v >> (-j)) & 0xff);
|
*bp |= (png_byte)((v >> (-j)) & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_bytep bp;
|
png_bytep bp;
|
||||||
@ -324,10 +359,12 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
|
|||||||
|
|
||||||
v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
|
v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
|
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
|
||||||
|
|
||||||
else
|
else
|
||||||
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
|
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
|
||||||
}
|
}
|
||||||
@ -345,18 +382,16 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_swap_alpha");
|
png_debug(1, "in png_do_write_swap_alpha");
|
||||||
|
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
/* This converts from ARGB to RGBA */
|
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
|
/* This converts from ARGB to RGBA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
png_byte save = *(sp++);
|
png_byte save = *(sp++);
|
||||||
@ -366,9 +401,11 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = save;
|
*(dp++) = save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This converts from AARRGGBB to RRGGBBAA */
|
|
||||||
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* This converts from AARRGGBB to RRGGBBAA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@ -388,12 +425,14 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = save[1];
|
*(dp++) = save[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
{
|
{
|
||||||
/* This converts from AG to GA */
|
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
|
/* This converts from AG to GA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@ -405,9 +444,11 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = save;
|
*(dp++) = save;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This converts from AAGG to GGAA */
|
|
||||||
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* This converts from AAGG to GGAA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@ -423,6 +464,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = save[1];
|
*(dp++) = save[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,18 +476,16 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_invert_alpha");
|
png_debug(1, "in png_do_write_invert_alpha");
|
||||||
|
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
if (row != NULL && row_info != NULL)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
{
|
{
|
||||||
/* This inverts the alpha channel in RGBA */
|
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
|
/* This inverts the alpha channel in RGBA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
|
|
||||||
for (i = 0, sp = dp = row; i < row_width; i++)
|
for (i = 0, sp = dp = row; i < row_width; i++)
|
||||||
{
|
{
|
||||||
/* Does nothing
|
/* Does nothing
|
||||||
@ -457,9 +497,11 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This inverts the alpha channel in RRGGBBAA */
|
|
||||||
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* This inverts the alpha channel in RRGGBBAA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@ -479,12 +521,14 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
{
|
{
|
||||||
/* This inverts the alpha channel in GA */
|
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
|
/* This inverts the alpha channel in GA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@ -495,9 +539,11 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This inverts the alpha channel in GGAA */
|
|
||||||
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* This inverts the alpha channel in GGAA */
|
||||||
png_bytep sp, dp;
|
png_bytep sp, dp;
|
||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@ -513,10 +559,12 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
||||||
|
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
/* Undoes intrapixel differencing */
|
/* Undoes intrapixel differencing */
|
||||||
@ -525,11 +573,7 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_intrapixel");
|
png_debug(1, "in png_do_write_intrapixel");
|
||||||
|
|
||||||
if (
|
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||||
#ifdef PNG_USELESS_TESTS_SUPPORTED
|
|
||||||
row != NULL && row_info != NULL &&
|
|
||||||
#endif
|
|
||||||
(row_info->color_type & PNG_COLOR_MASK_COLOR))
|
|
||||||
{
|
{
|
||||||
int bytes_per_pixel;
|
int bytes_per_pixel;
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@ -540,17 +584,21 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
bytes_per_pixel = 3;
|
bytes_per_pixel = 3;
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
bytes_per_pixel = 4;
|
bytes_per_pixel = 4;
|
||||||
|
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
{
|
{
|
||||||
*(rp) = (png_byte)((*rp - *(rp+1))&0xff);
|
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
|
||||||
*(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff);
|
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
@ -558,24 +606,27 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||||
bytes_per_pixel = 6;
|
bytes_per_pixel = 6;
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
bytes_per_pixel = 8;
|
bytes_per_pixel = 8;
|
||||||
|
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||||
{
|
{
|
||||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
|
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||||
png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
|
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||||
png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
|
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||||
*(rp+1) = (png_byte)(red & 0xff);
|
*(rp + 1) = (png_byte)(red & 0xff);
|
||||||
*(rp+4) = (png_byte)((blue >> 8) & 0xff);
|
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||||
*(rp+5) = (png_byte)(blue & 0xff);
|
*(rp + 5) = (png_byte)(blue & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||||
|
383
jni/libpng/projects/owatcom/libpng.tgt
Normal file
@ -0,0 +1,383 @@
|
|||||||
|
40
|
||||||
|
targetIdent
|
||||||
|
0
|
||||||
|
MProject
|
||||||
|
1
|
||||||
|
MComponent
|
||||||
|
0
|
||||||
|
2
|
||||||
|
WString
|
||||||
|
3
|
||||||
|
LIB
|
||||||
|
3
|
||||||
|
WString
|
||||||
|
5
|
||||||
|
n_2sn
|
||||||
|
1
|
||||||
|
0
|
||||||
|
0
|
||||||
|
4
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
5
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
6
|
||||||
|
MItem
|
||||||
|
10
|
||||||
|
libpng.lib
|
||||||
|
7
|
||||||
|
WString
|
||||||
|
3
|
||||||
|
LIB
|
||||||
|
8
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
9
|
||||||
|
WVList
|
||||||
|
1
|
||||||
|
10
|
||||||
|
ActionStates
|
||||||
|
11
|
||||||
|
WString
|
||||||
|
5
|
||||||
|
&Make
|
||||||
|
12
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
-1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
13
|
||||||
|
WPickList
|
||||||
|
16
|
||||||
|
14
|
||||||
|
MItem
|
||||||
|
3
|
||||||
|
*.c
|
||||||
|
15
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
16
|
||||||
|
WVList
|
||||||
|
2
|
||||||
|
17
|
||||||
|
MVState
|
||||||
|
18
|
||||||
|
WString
|
||||||
|
3
|
||||||
|
WCC
|
||||||
|
19
|
||||||
|
WString
|
||||||
|
25
|
||||||
|
n????Include directories:
|
||||||
|
1
|
||||||
|
20
|
||||||
|
WString
|
||||||
|
39
|
||||||
|
"$(%zlib);$(%watcom)/h;$(%watcom)/h/nt"
|
||||||
|
0
|
||||||
|
21
|
||||||
|
MVState
|
||||||
|
22
|
||||||
|
WString
|
||||||
|
3
|
||||||
|
WCC
|
||||||
|
23
|
||||||
|
WString
|
||||||
|
25
|
||||||
|
n????Include directories:
|
||||||
|
0
|
||||||
|
24
|
||||||
|
WString
|
||||||
|
39
|
||||||
|
"$(%zlib);$(%watcom)/h;$(%watcom)/h/nt"
|
||||||
|
0
|
||||||
|
25
|
||||||
|
WVList
|
||||||
|
1
|
||||||
|
26
|
||||||
|
ActionStates
|
||||||
|
27
|
||||||
|
WString
|
||||||
|
5
|
||||||
|
&Make
|
||||||
|
28
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
-1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
29
|
||||||
|
MItem
|
||||||
|
11
|
||||||
|
..\..\png.c
|
||||||
|
30
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
31
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
32
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
33
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngerror.c
|
||||||
|
34
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
35
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
36
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
37
|
||||||
|
MItem
|
||||||
|
14
|
||||||
|
..\..\pngget.c
|
||||||
|
38
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
39
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
40
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
41
|
||||||
|
MItem
|
||||||
|
14
|
||||||
|
..\..\pngmem.c
|
||||||
|
42
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
43
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
44
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
45
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngpread.c
|
||||||
|
46
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
47
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
48
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
49
|
||||||
|
MItem
|
||||||
|
15
|
||||||
|
..\..\pngread.c
|
||||||
|
50
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
51
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
52
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
53
|
||||||
|
MItem
|
||||||
|
14
|
||||||
|
..\..\pngrio.c
|
||||||
|
54
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
55
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
56
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
57
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngrtran.c
|
||||||
|
58
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
59
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
60
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
61
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngrutil.c
|
||||||
|
62
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
63
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
64
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
65
|
||||||
|
MItem
|
||||||
|
14
|
||||||
|
..\..\pngset.c
|
||||||
|
66
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
67
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
68
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
69
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngtrans.c
|
||||||
|
70
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
71
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
72
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
73
|
||||||
|
MItem
|
||||||
|
14
|
||||||
|
..\..\pngwio.c
|
||||||
|
74
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
75
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
76
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
77
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngwrite.c
|
||||||
|
78
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
79
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
80
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
81
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngwtran.c
|
||||||
|
82
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
83
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
84
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
85
|
||||||
|
MItem
|
||||||
|
16
|
||||||
|
..\..\pngwutil.c
|
||||||
|
86
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
87
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
88
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
14
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
92
jni/libpng/projects/owatcom/libpng.wpj
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
40
|
||||||
|
projectIdent
|
||||||
|
0
|
||||||
|
VpeMain
|
||||||
|
1
|
||||||
|
WRect
|
||||||
|
256
|
||||||
|
0
|
||||||
|
8960
|
||||||
|
9284
|
||||||
|
2
|
||||||
|
MProject
|
||||||
|
3
|
||||||
|
MCommand
|
||||||
|
322
|
||||||
|
# Locations of zlib and (if required) awk (change as required:)
|
||||||
|
set zlib=..\..\..\zlib
|
||||||
|
set awk=
|
||||||
|
#
|
||||||
|
@if not exist pngconfig.dfa $(MAKE) $(__MAKEOPTS__) -f pngconfig.mak defaults
|
||||||
|
@if exist config.inf type config.inf
|
||||||
|
@echo Checking for the libpng configuration file pnglibconf.h
|
||||||
|
$(MAKE) $(__MAKEOPTS__) -f pngconfig.mak
|
||||||
|
4
|
||||||
|
MCommand
|
||||||
|
19
|
||||||
|
@type pngconfig.inf
|
||||||
|
3
|
||||||
|
5
|
||||||
|
WFileName
|
||||||
|
10
|
||||||
|
libpng.tgt
|
||||||
|
6
|
||||||
|
WFileName
|
||||||
|
11
|
||||||
|
pngtest.tgt
|
||||||
|
7
|
||||||
|
WFileName
|
||||||
|
12
|
||||||
|
pngvalid.tgt
|
||||||
|
8
|
||||||
|
WVList
|
||||||
|
3
|
||||||
|
9
|
||||||
|
VComponent
|
||||||
|
10
|
||||||
|
WRect
|
||||||
|
0
|
||||||
|
0
|
||||||
|
5632
|
||||||
|
4164
|
||||||
|
0
|
||||||
|
0
|
||||||
|
11
|
||||||
|
WFileName
|
||||||
|
10
|
||||||
|
libpng.tgt
|
||||||
|
0
|
||||||
|
0
|
||||||
|
12
|
||||||
|
VComponent
|
||||||
|
13
|
||||||
|
WRect
|
||||||
|
1280
|
||||||
|
1540
|
||||||
|
5632
|
||||||
|
4164
|
||||||
|
0
|
||||||
|
0
|
||||||
|
14
|
||||||
|
WFileName
|
||||||
|
11
|
||||||
|
pngtest.tgt
|
||||||
|
0
|
||||||
|
1
|
||||||
|
15
|
||||||
|
VComponent
|
||||||
|
16
|
||||||
|
WRect
|
||||||
|
518
|
||||||
|
487
|
||||||
|
5632
|
||||||
|
4164
|
||||||
|
0
|
||||||
|
0
|
||||||
|
17
|
||||||
|
WFileName
|
||||||
|
12
|
||||||
|
pngvalid.tgt
|
||||||
|
0
|
||||||
|
1
|
||||||
|
9
|