Port libpngdec to libpng (#1555)

* intial try to include libpng

* fixing libpng cmake

* cleanup structs and error codes

* building libpng , destroying pkg ;/

* fixed pkg with zlib_comp mode

* attemp to fix ci

* rewrote png encoder with libpng

* small corrections

* clang fix

* clang-fix?

* take alpha value from decode parameters

* more cleanup

* fix stride calculation

* libpng: avoid unnecessary allocation in decoding

* libpng: interlaced support

* libpng: lowered log level

* revert wrong merge

---------

Co-authored-by: Vinicius Rangel <me@viniciusrangel.dev>
This commit is contained in:
georgemoralis 2024-11-22 12:42:53 +02:00 committed by GitHub
parent 8f2d71d458
commit 8c9d7d1a08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 257 additions and 117 deletions

View file

@ -58,8 +58,10 @@ if (NOT TARGET zlib-ng::zlib)
set(WITH_GTEST OFF)
set(WITH_NEW_STRATEGIES ON)
set(WITH_NATIVE_INSTRUCTIONS ON)
set(ZLIB_COMPAT ON CACHE BOOL "" FORCE)
add_subdirectory(zlib-ng)
add_library(zlib-ng::zlib ALIAS zlib)
add_library(ZLIB::ZLIB ALIAS zlib)
endif()
# SDL3
@ -153,6 +155,17 @@ if (NOT TARGET half::half)
add_library(half::half ALIAS half)
endif()
# libpng
set(PNG_SHARED OFF CACHE BOOL "" FORCE)
set(PNG_STATIC ON CACHE BOOL "" FORCE)
set(PNG_TESTS OFF CACHE BOOL "" FORCE)
set(PNG_TOOLS OFF CACHE BOOL "" FORCE)
set(SKIP_INSTALL_ALL OFF CACHE BOOL "" FORCE)
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib-ng" CACHE STRING "" FORCE)
set(ZLIB_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/zlib-ng/zlibstatic-ngd" CACHE STRING "" FORCE)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libpng/zlib.h" "#include \"../zlib-ng/zlib.h\"")
add_subdirectory(libpng)
if (APPLE)
# date
if (NOT TARGET date::date-tz)

1
externals/libpng vendored Submodule

@ -0,0 +1 @@
Subproject commit c1cc0f3f4c3d4abd11ca68c59446a29ff6f95003