diff options
author | Lode <lvandeve@gmail.com> | 2019-12-08 18:39:57 +0300 |
---|---|---|
committer | Lode <lvandeve@gmail.com> | 2019-12-08 18:39:57 +0300 |
commit | 2e541f53ebedf6ebae375a381ca2fd6d82b460bc (patch) | |
tree | 14ca27af5563c514da960dd55d85c285e221592b | |
parent | f78cffe5e149b84a1e390dbd46c6c1b008c7e76f (diff) |
make auto_choose_color static since it's only internal
-rw-r--r-- | lodepng.cpp | 13 | ||||
-rw-r--r-- | lodepng.h | 1 | ||||
-rw-r--r-- | lodepng_unittest.cpp | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/lodepng.cpp b/lodepng.cpp index 74c7fde..29f50c5 100644 --- a/lodepng.cpp +++ b/lodepng.cpp @@ -3829,9 +3829,16 @@ static void lodepng_color_stats_add(LodePNGColorStats* stats, } #endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ -unsigned auto_choose_color(LodePNGColorMode* mode_out, - const LodePNGColorMode* mode_in, - const LodePNGColorStats* stats) { +/*Computes a minimal PNG color model that can contain all colors as indicated by the stats. +The stats should be computed with lodepng_compute_color_stats. +mode_in is raw color profile of the image the stats were computed on, to copy palette order from when relevant. +Minimal PNG color model means the color type and bit depth that gives smallest amount of bits in the output image, +e.g. gray if only grayscale pixels, palette if less than 256 colors, color key if only single transparent color, ... +This is used if auto_convert is enabled (it is by default). +*/ +static unsigned auto_choose_color(LodePNGColorMode* mode_out, + const LodePNGColorMode* mode_in, + const LodePNGColorStats* stats) { unsigned error = 0; unsigned palettebits; size_t i, n; @@ -697,6 +697,7 @@ void lodepng_color_stats_init(LodePNGColorStats* stats); void lodepng_compute_color_stats(LodePNGColorStats* stats, const unsigned char* image, unsigned w, unsigned h, const LodePNGColorMode* mode_in); + /*Settings for the encoder.*/ typedef struct LodePNGEncoderSettings { LodePNGCompressSettings zlibsettings; /*settings for the zlib encoder, such as window size, ...*/ diff --git a/lodepng_unittest.cpp b/lodepng_unittest.cpp index ebc2d1a..372d104 100644 --- a/lodepng_unittest.cpp +++ b/lodepng_unittest.cpp @@ -75,6 +75,8 @@ g++ lodepng.cpp -W -Wall -ansi -pedantic -O3 -c -DLODEPNG_NO_COMPILE_ZLIB -DLODE g++ lodepng.cpp -W -Wall -ansi -pedantic -O3 -c -DLODEPNG_NO_COMPILE_ZLIB -DLODEPNG_NO_COMPILE_ENCODER g++ lodepng.cpp -W -Wall -ansi -pedantic -O3 -c -DLODEPNG_NO_COMPILE_PNG -DLODEPNG_NO_COMPILE_DECODER g++ lodepng.cpp -W -Wall -ansi -pedantic -O3 -c -DLODEPNG_NO_COMPILE_PNG -DLODEPNG_NO_COMPILE_ENCODER +g++ lodepng.cpp -W -Wall -ansi -pedantic -O3 -c -DLODEPNG_NO_COMPILE_DECODER -DLODEPNG_NO_COMPILE_ANCILLARY_CHUNKS -DLODEPNG_NO_COMPILE_ERROR_TEXT -DLODEPNG_NO_COMPILE_DISK +g++ lodepng.cpp -W -Wall -ansi -pedantic -O3 -c -DLODEPNG_NO_COMPILE_ENCODER -DLODEPNG_NO_COMPILE_ANCILLARY_CHUNKS -DLODEPNG_NO_COMPILE_ERROR_TEXT -DLODEPNG_NO_COMPILE_DISK rm *.o *) analyze with clang: |