Skip to content

Conversation

@dudantas
Copy link
Collaborator

Replaces the custom APNG loading and saving logic in apngloader.cpp with a new implementation based on libpng, moved to apng_png.hpp. Updates CMakeLists.txt to require PNG, and ensures libpng is built with APNG support. This change modernizes and simplifies APNG handling, improving maintainability and leveraging standard library support.

@kokekanon
Copy link
Collaborator

I don't know if my baseline is outdated, but I'm getting this compilation error, vs community 2022 solution

1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(164,71): warning C4003: not enough arguments for function-like macro invocation 'max'
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(164,71): error C2589: '(': illegal token on right side of '::'
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(164,40): error C2062: type 'unknown-type' unexpected
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(164,40): error C2144: syntax error: 'unknown-type' should be preceded by '('
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(164,77): error C2059: syntax error: ')'
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(263,52): warning C4003: not enough arguments for function-like macro invocation 'max'
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(263,52): error C2589: '(': illegal token on right side of '::'
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(263,23): error C2062: type 'unknown-type' unexpected
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')
1>D:\github\otclient.readme\src\framework\graphics\apng_png.hpp(263,71): error C2059: syntax error: ')'
1>(compiling source file 'otclient/x64/OpenGL/unity_QAHRA73EM9MJH98D.cpp')

https://github.com/dudantas/otclient/blob/358e66fa93c96e1187522057a850e239a22d3563/src/framework/graphics/apng_png.hpp#L163-L165

https://github.com/dudantas/otclient/blob/358e66fa93c96e1187522057a850e239a22d3563/src/framework/graphics/apng_png.hpp#L262-L263

posible fix: ( )

-      std::min<uint32_t>(milliseconds, std::numeric_limits<uint16_t>::max()));
+      std::min<uint32_t>(milliseconds, (std::numeric_limits<uint16_t>::max)()));
-  totalFrames > std::numeric_limits<size_t>::max() / frameStride)
+  totalFrames > (std::numeric_limits<size_t>::max)() / frameStride)

@majestyotbr majestyotbr changed the title Refactor APNG loader to use libpng-based implementation improve: refactor APNG loader to use libpng-based implementation Oct 8, 2025
@libergod libergod force-pushed the use-libpng branch 2 times, most recently from 35bc000 to e5a42be Compare October 13, 2025 17:58
@libergod libergod self-requested a review October 13, 2025 17:59
@sonarqubecloud
Copy link

@github-actions
Copy link

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Nov 14, 2025
Replaces the custom APNG loading and saving logic in apngloader.cpp with a new implementation based on libpng, moved to apng_png.hpp. Updates CMakeLists.txt to require PNG, and ensures libpng is built with APNG support. This change modernizes and simplifies APNG handling, improving maintainability and leveraging standard library support.
@sonarqubecloud
Copy link

@dudantas dudantas marked this pull request as draft November 14, 2025 21:37
@github-actions github-actions bot removed the Stale label Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants