wincodecs: Fix scaler return pixel format for uninitialized case.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5976988b1e
commit
85d6be3e9e
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue