Commit 85d6be3e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wincodecs: Fix scaler return pixel format for uninitialized case.

parent 5976988b
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment