-
-
Notifications
You must be signed in to change notification settings - Fork 156
saver/png: support png saver #3874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
85cce51
to
6917a3d
Compare
3ba970d
to
174f70f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds PNG saver functionality to ThorVG with two implementation options: a static PNG saver using lodepng code and an external PNG saver using libpng. The changes include necessary PNG encoding functions copied from the loader module, meson build configuration updates, and test coverage for the new PNG saving capabilities.
Key changes:
- Added static PNG saver implementation in
savers/png
using lodepng functions - Added external PNG saver implementation in
savers/external_png
using libpng - Updated build system configuration to support PNG saver options
- Fixed a background reference leak in the saver module
Reviewed Changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/testSavers.cpp | Added PNG saver test cases and updated GIF test file names |
src/savers/png/tvgPngSaver.h | Header file for static PNG saver implementation |
src/savers/png/tvgPngSaver.cpp | Implementation of static PNG saver using lodepng |
src/savers/external_png/tvgPngSaver.h | Header file for external PNG saver implementation |
src/savers/external_png/tvgPngSaver.cpp | Implementation of external PNG saver using libpng |
src/renderer/tvgSaver.cpp | Updated saver registry to support PNG format and fixed background reference leak |
src/loaders/png/tvgLodePng.h | Added PNG encoder structures and function declarations |
src/loaders/png/tvgLodePng.cpp | Added PNG encoding functionality when saver support is enabled |
meson_options.txt | Added PNG to saver options |
meson.build | Added PNG saver configuration and dependencies |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- `Saver::background()` calls `ref()` on the incoming bg, so the old bg must be released with `unref()` (not `TVG_DELETE`).
- support: static png saver (Copied only necessary encoding functions from the lodepng opensource. See: https://lodev.org/lodepng/) - support: libpng based png saver - additional changes: tvgLodePng.cpp: enable crc when defined THORVG_PNG_SAVER_SUPPORT - issue: thorvg#3737
- lodepng_malloc -> tvg::malloc - lodepng_realloc -> tvg::realloc - lodepng_free -> tvg::free
3848504
to
e863091
Compare
c0b5a3c
to
0c67392
Compare
Changes
Fixed a saver background reference leak 102efc5
Added
Static
PNG Saver insavers/png
loaders/png/tvgLodePng.cpp
andloaders/png/tvgLodePng.h
tvgLodePng.cpp
whenTHORVG_PNG_SAVER_SUPPORT
is defined. (used only by the saver)savers/png
Added
External(libpng-based)
PNG Saver insavers/external_png
tvgLodePng
), a new libpng-based PNG saver (external_png
) was added to keep them separate.Output