mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
img2webp,get_disto: fix image decode w/WIC builds
similar to cwebp, attempt ReadPictureWithWIC() first Change-Id: Ifb83aaa457be59c95b201bf8bd6b0877a6a253ed
This commit is contained in:
parent
92504d214c
commit
6451709e72
@ -69,6 +69,12 @@ static int ReadImage(const char filename[], WebPPicture* const pic) {
|
||||
size_t data_size = 0;
|
||||
WebPImageReader reader;
|
||||
int ok;
|
||||
#ifdef HAVE_WINCODEC_H
|
||||
// Try to decode the file using WIC falling back to the other readers for
|
||||
// e.g., WebP.
|
||||
ok = ReadPictureWithWIC(filename, pic, 1, NULL);
|
||||
if (ok) return 1;
|
||||
#endif
|
||||
if (!ImgIoUtilReadFile(filename, &data, &data_size)) return 0;
|
||||
reader = WebPGuessImageReader(data, data_size);
|
||||
ok = reader(data, data_size, pic, 1, NULL);
|
||||
|
@ -32,11 +32,19 @@ static int ReadPicture(const char* const filename, WebPPicture* const pic,
|
||||
const uint8_t* data = NULL;
|
||||
size_t data_size = 0;
|
||||
WebPImageReader reader = NULL;
|
||||
int ok = ImgIoUtilReadFile(filename, &data, &data_size);
|
||||
if (!ok) goto Error;
|
||||
int ok;
|
||||
|
||||
pic->use_argb = 1; // force ARGB
|
||||
|
||||
#ifdef HAVE_WINCODEC_H
|
||||
// Try to decode the file using WIC falling back to the other readers for
|
||||
// e.g., WebP.
|
||||
ok = ReadPictureWithWIC(filename, pic, keep_alpha, NULL);
|
||||
if (ok) return 1;
|
||||
#endif
|
||||
ok = ImgIoUtilReadFile(filename, &data, &data_size);
|
||||
if (!ok) goto Error;
|
||||
|
||||
reader = WebPGuessImageReader(data, data_size);
|
||||
ok = reader(data, data_size, pic, keep_alpha, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user