Commit 92ad4a18 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

windowscodecs: Implement DdsFrameEncode_SetPixelFormat.

parent 5506235c
......@@ -1651,8 +1651,30 @@ static HRESULT WINAPI DdsFrameEncode_SetResolution(IWICBitmapFrameEncode *iface,
static HRESULT WINAPI DdsFrameEncode_SetPixelFormat(IWICBitmapFrameEncode *iface,
WICPixelFormatGUID *pixelFormat)
{
FIXME("(%p,%s): stub\n", iface, debugstr_guid(pixelFormat));
return E_NOTIMPL;
DdsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
HRESULT hr;
TRACE("(%p,%s)\n", iface, debugstr_guid(pixelFormat));
EnterCriticalSection(&This->parent->lock);
if (!This->initialized)
{
hr = WINCODEC_ERR_NOTINITIALIZED;
}
else if (This->frame_created)
{
hr = WINCODEC_ERR_WRONGSTATE;
}
else
{
*pixelFormat = GUID_WICPixelFormat32bppBGRA;
hr = S_OK;
}
LeaveCriticalSection(&This->parent->lock);
return hr;
}
static HRESULT WINAPI DdsFrameEncode_SetColorContexts(IWICBitmapFrameEncode *iface,
......
......@@ -1519,7 +1519,6 @@ static void test_dds_encoder_pixel_format(void)
IWICBitmapEncoder_CreateNewFrame(encoder, &frame, NULL);
hr = IWICBitmapFrameEncode_SetPixelFormat(frame, &format);
todo_wine
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "SetPixelFormat got unexpected hr %#x\n", hr);
IWICBitmapFrameEncode_Initialize(frame, NULL);
......@@ -1528,11 +1527,9 @@ static void test_dds_encoder_pixel_format(void)
{
format = *(test_formats[j]);
hr = IWICBitmapFrameEncode_SetPixelFormat(frame, &format);
todo_wine
ok(hr == S_OK, "Test %u: SetPixelFormat failed, hr %#x\n", j, hr);
if (hr == S_OK)
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
"Test %u: Got unexpected GUID %s\n", j, debugstr_guid(&format));
ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
"Test %u: Got unexpected GUID %s\n", j, debugstr_guid(&format));
}
IWICBitmapFrameEncode_Release(frame);
......
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