From 503da57b6ee46cf655b37d49b13d1ac3e1bba6a7 Mon Sep 17 00:00:00 2001 From: homm Date: Fri, 17 Jan 2014 17:20:11 +0400 Subject: [PATCH] do not use loseless abi until it supported --- _webp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/_webp.c b/_webp.c index 6381e1a56..c201813d7 100644 --- a/_webp.c +++ b/_webp.c @@ -34,18 +34,24 @@ PyObject* WebPEncode_wrapper(PyObject* self, PyObject* args) if (size < width * height * 4){ Py_RETURN_NONE; } + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 if (lossless) { ret_size = WebPEncodeLosslessRGBA(rgb, width, height, 4* width, &output); - } else { + } else + #endif + { ret_size = WebPEncodeRGBA(rgb, width, height, 4* width, quality_factor, &output); } } else if (strcmp(mode, "RGB")==0){ if (size < width * height * 3){ Py_RETURN_NONE; } + #if WEBP_ENCODER_ABI_VERSION >= 0x0100 if (lossless) { ret_size = WebPEncodeLosslessRGB(rgb, width, height, 3* width, &output); - } else { + } else + #endif + { ret_size = WebPEncodeRGB(rgb, width, height, 3* width, quality_factor, &output); } } else {