Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/scaler.c | 5 ++++- dlls/windowscodecs/tests/bitmap.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c index b02f19253a..564b4ada43 100644 --- a/dlls/windowscodecs/scaler.c +++ b/dlls/windowscodecs/scaler.c @@ -130,7 +130,10 @@ static HRESULT WINAPI BitmapScaler_GetPixelFormat(IWICBitmapScaler *iface, return E_INVALIDARG;
if (!This->source) - return WINCODEC_ERR_WRONGSTATE; + { + memcpy(pPixelFormat, &GUID_WICPixelFormatDontCare, sizeof(*pPixelFormat)); + return S_OK; + }
return IWICBitmapSource_GetPixelFormat(This->source, pPixelFormat); } diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c index e4cb8637f4..486533247d 100644 --- a/dlls/windowscodecs/tests/bitmap.c +++ b/dlls/windowscodecs/tests/bitmap.c @@ -1082,6 +1082,7 @@ static void test_WICCreateBitmapFromSectionEx(void)
static void test_bitmap_scaler(void) { + WICPixelFormatGUID pixel_format; IWICBitmapScaler *scaler; IWICBitmap *bitmap; UINT width, height; @@ -1112,6 +1113,15 @@ static void test_bitmap_scaler(void) hr = IWICBitmapScaler_GetSize(scaler, &width, NULL); ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
+ hr = IWICBitmapScaler_GetPixelFormat(scaler, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + memset(&pixel_format, 0, sizeof(pixel_format)); + hr = IWICBitmapScaler_GetPixelFormat(scaler, &pixel_format); + ok(hr == S_OK, "Failed to get pixel format, hr %#x.\n", hr); + ok(IsEqualGUID(&pixel_format, &GUID_WICPixelFormatDontCare), "Unexpected pixel format %s.\n", + wine_dbgstr_guid(&pixel_format)); + width = 123; height = 321; hr = IWICBitmapScaler_GetSize(scaler, &width, &height); @@ -1170,6 +1180,15 @@ static void test_bitmap_scaler(void) hr = IWICBitmapScaler_GetSize(scaler, NULL, NULL); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ hr = IWICBitmapScaler_GetPixelFormat(scaler, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + memset(&pixel_format, 0, sizeof(pixel_format)); + hr = IWICBitmapScaler_GetPixelFormat(scaler, &pixel_format); + ok(hr == S_OK, "Failed to get pixel format, hr %#x.\n", hr); + ok(IsEqualGUID(&pixel_format, &GUID_WICPixelFormat24bppBGR), "Unexpected pixel format %s.\n", + wine_dbgstr_guid(&pixel_format)); + IWICBitmapScaler_Release(scaler);
IWICBitmap_Release(bitmap);