webp: WebPConfig.lossless, WebPPicture.use_argb, and WebPPictureImportRGBX all became available in libwebp v0.1.99 or ABI v1 - refs #1986
This commit is contained in:
parent
1a8287da06
commit
42d3bb11af
1 changed files with 6 additions and 2 deletions
|
@ -83,7 +83,7 @@ void save_as_webp(T1& file,
|
||||||
|
|
||||||
// Add additional tuning
|
// Add additional tuning
|
||||||
if (method >= 0) config.method = method;
|
if (method >= 0) config.method = method;
|
||||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 2
|
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||||
config.lossless = !!lossless;
|
config.lossless = !!lossless;
|
||||||
config.image_hint = static_cast<WebPImageHint>(image_hint);
|
config.image_hint = static_cast<WebPImageHint>(image_hint);
|
||||||
#else
|
#else
|
||||||
|
@ -106,7 +106,7 @@ void save_as_webp(T1& file,
|
||||||
}
|
}
|
||||||
pic.width = image.width();
|
pic.width = image.width();
|
||||||
pic.height = image.height();
|
pic.height = image.height();
|
||||||
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 2
|
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||||
pic.use_argb = !!lossless;
|
pic.use_argb = !!lossless;
|
||||||
#endif
|
#endif
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
@ -120,7 +120,11 @@ void save_as_webp(T1& file,
|
||||||
{
|
{
|
||||||
int stride = sizeof(typename T2::pixel_type) * image.width();
|
int stride = sizeof(typename T2::pixel_type) * image.width();
|
||||||
uint8_t const* bytes = reinterpret_cast<uint8_t const*>(image.getBytes());
|
uint8_t const* bytes = reinterpret_cast<uint8_t const*>(image.getBytes());
|
||||||
|
#if (WEBP_ENCODER_ABI_VERSION >> 8) >= 1
|
||||||
ok = WebPPictureImportRGBX(&pic, bytes, stride);
|
ok = WebPPictureImportRGBX(&pic, bytes, stride);
|
||||||
|
#else
|
||||||
|
ok = WebPPictureImportRGBA(&pic, bytes, stride);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
|
Loading…
Reference in a new issue