-
-
Notifications
You must be signed in to change notification settings - Fork 162
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/pngusing lodepng functions - Added external PNG saver implementation in
savers/external_pngusing 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.
3848504 to
e863091
Compare
d471af2 to
0aaa738
Compare
f8b6dff to
7fa65c4
Compare
7fa65c4 to
ceffcf5
Compare
|
submitted separately -> aca4a24 |
|
@Nor-s Hello, I just skimmed through your main commit to decide the approach first. Basic approach would be like this:
So that two modules have no dependency and for clean maintenance. The key decision point for the design here would be how much this increases the binary size. After making visible data, we can decide the approach with:
No remarkable binary size diff, I might prefer to separate implementation. Thanks for your contribution. |
|
Hello, thank you for the review. For now, I’ve made a temporary commit to separate the implementation into tvgPngEncoder and tvgPngDecoder. To estimate the size of the common code, I’ve temporarily added the encoder-related logic to tvgPngEncoder2.
I haven’t compared the binary size yet, but I’ll leave a comment later after checking it. Thank you. Common Functions
|
163382f to
d810dca
Compare
|
Hello, I’ve checked the binary size differences. Would you consider this size difference negligible? Thanks for your feedback!
details...1. Loader + Saver2. Only Saver3. Only Loader4. No Png5. before d810dca |
@Nor-s Thanks for the detailed information. I think we need to proceed with a unified version -> (common/tvgPngCodec.h and .cpp) I think you can first add a commit to refactor the PNG loader (png/tvgLodePng → common/tvgPngCodec). We can then build the saver feature on top of it. |
d810dca to
884dbef
Compare
This patch replaces the previous decode-only lodePng-based implementation (`tvgLodePng`) with a unified `tvgPngCodec` used by both the PNG loader and saver modules. Key updates: - Added static PNG saver support (copied only necessary encoding functions from lodepng: https://lodev.org/lodepng/) - Added external PNG saver support using libpng issue: thorvg#3737
884dbef to
aab4320
Compare
|
Hello, sorry for the delay. Below are the binary size measurements after the update: Binary Size
Please let me know if you notice any issues or have further suggestions. |
9c9fe06 to
1b33069
Compare
Changes
Fixed a saver background reference leak 102efc5
Added
StaticPNG Saver insavers/pngloaders/png/tvgLodePng.cppandloaders/png/tvgLodePng.htvgLodePng.cppwhenTHORVG_PNG_SAVER_SUPPORTis defined. (used only by the saver)savers/pngAdded
External(libpng-based)PNG Saver insavers/external_pngtvgLodePng), a new libpng-based PNG saver (external_png) was added to keep them separate.Output