windowscodecs: Implement DdsFrameEncode_SetPixelFormat.

Signed-off-by: Ziqing Hui <zhui@codeweavers.com>
Signed-off-by: Esme Povirk <esme@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ziqing Hui 2021-05-29 08:27:13 +08:00 committed by Alexandre Julliard
parent 5506235cff
commit 92ad4a18e3
2 changed files with 26 additions and 7 deletions

View File

@ -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,

View File

@ -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);