diff options
author | 2024-10-29 17:53:57 -0700 | |
---|---|---|
committer | 2024-10-29 18:01:03 -0700 | |
commit | c94140824cee443f9caf8d7217903aba2bd1f23d (patch) | |
tree | 30b5788eb873af3889197b0a9c8f0dae06f7f733 /libs/androidfw/PngCrunch.cpp | |
parent | c10aa455762e84a3bb51fdb061b85f7712c42f80 (diff) |
[aapt2] Add a compression control option to 'compile'
aapt2 recompresses all PNGs it compiles, and by default it
uses the best (and slowest) zlib compression level, 9.
This change adds a command line option --png-compression-level
to control that, so it's possible to set it to something faster
e.g. 6 which is usually 5x faster and around 101% of the size
of level 9 PNGs
Test: manual, compile Framework
Flag: EXEMPT tool
Change-Id: Ibe5f47b82e1c13be0a4ffff0e07e675871abc956
Diffstat (limited to 'libs/androidfw/PngCrunch.cpp')
-rw-r--r-- | libs/androidfw/PngCrunch.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libs/androidfw/PngCrunch.cpp b/libs/androidfw/PngCrunch.cpp index cf3c0eeff402..e94540544cf5 100644 --- a/libs/androidfw/PngCrunch.cpp +++ b/libs/androidfw/PngCrunch.cpp @@ -506,8 +506,7 @@ bool WritePng(const Image* image, const NinePatch* nine_patch, OutputStream* out // Set up the write functions which write to our custom data sources. png_set_write_fn(write_ptr, (png_voidp)out, WriteDataToStream, nullptr); - // We want small files and can take the performance hit to achieve this goal. - png_set_compression_level(write_ptr, Z_BEST_COMPRESSION); + png_set_compression_level(write_ptr, options.compression_level); // Begin analysis of the image data. // Scan the entire image and determine if: |