cwebp: fix jpg encodes on XP

correct has_alpha check; previously it was controlled by keep_alpha,
which overrode the source format check.
fixes issue #127

Change-Id: I949be90419b03610c64900be0fd37f83b70cbe73
This commit is contained in:
James Zern 2012-10-08 18:15:30 -07:00
parent 7b3eb372ad
commit ecd66f774d

View File

@ -179,9 +179,9 @@ static HRESULT ReadPictureWithWIC(const char* filename,
IFS(IWICBitmapFrameDecode_GetPixelFormat(pFrame, &srcPixelFormat)); IFS(IWICBitmapFrameDecode_GetPixelFormat(pFrame, &srcPixelFormat));
IFS(IWICBitmapDecoder_GetContainerFormat(pDecoder, &srcContainerFormat)); IFS(IWICBitmapDecoder_GetContainerFormat(pDecoder, &srcContainerFormat));
has_alpha = keep_alpha; if (keep_alpha) {
for (i = 0; for (i = 0;
has_alpha && i < sizeof(alphaContainers)/sizeof(alphaContainers[0]); i < sizeof(alphaContainers) / sizeof(alphaContainers[0]);
++i) { ++i) {
if (IsEqualGUID(MAKE_REFGUID(srcContainerFormat), if (IsEqualGUID(MAKE_REFGUID(srcContainerFormat),
MAKE_REFGUID(*alphaContainers[i]))) { MAKE_REFGUID(*alphaContainers[i]))) {
@ -193,6 +193,7 @@ static HRESULT ReadPictureWithWIC(const char* filename,
break; break;
} }
} }
}
// Prepare for pixel format conversion (if necessary). // Prepare for pixel format conversion (if necessary).
IFS(IWICImagingFactory_CreateFormatConverter(pFactory, &pConverter)); IFS(IWICImagingFactory_CreateFormatConverter(pFactory, &pConverter));