img2webp,get_disto: fix image decode w/WIC builds

similar to cwebp, attempt ReadPictureWithWIC() first

Change-Id: Ifb83aaa457be59c95b201bf8bd6b0877a6a253ed
This commit is contained in:
James Zern
2017-01-24 14:28:58 -08:00
parent 92504d214c
commit 6451709e72
2 changed files with 16 additions and 2 deletions

View File

@ -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);