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
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

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