From e421403f3d742992bedb07b084ac6f492fd132c3 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 11 Jun 2014 22:43:05 -0700 Subject: [PATCH] fix miniz encoder - closes #1560 --- src/miniz_png.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/miniz_png.cpp b/src/miniz_png.cpp index 957dc8757..5426fb63a 100644 --- a/src/miniz_png.cpp +++ b/src/miniz_png.cpp @@ -56,7 +56,11 @@ PNGWriter::PNGWriter(int level, int strategy) { throw std::runtime_error("compression level must be between 0 and 10"); } - mz_uint flags = s_tdefl_num_probes[level] | (level <= 3) ? TDEFL_GREEDY_PARSING_FLAG : 0 | TDEFL_WRITE_ZLIB_HEADER; + mz_uint flags = s_tdefl_num_probes[level] | TDEFL_WRITE_ZLIB_HEADER; + if (level <= 3) + { + flags |= TDEFL_GREEDY_PARSING_FLAG; + } if (strategy == Z_FILTERED) flags |= TDEFL_FILTER_MATCHES; else if (strategy == Z_HUFFMAN_ONLY) flags &= ~TDEFL_MAX_PROBES_MASK; else if (strategy == Z_RLE) flags |= TDEFL_RLE_MATCHES;