windowscodecs: Implement DdsEncoder_Initialize.

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-01 11:14:50 +08:00 committed by Alexandre Julliard
parent b719f00a3d
commit 0500d4906b
2 changed files with 28 additions and 7 deletions

View File

@ -1754,10 +1754,35 @@ static ULONG WINAPI DdsEncoder_Release(IWICBitmapEncoder *iface)
}
static HRESULT WINAPI DdsEncoder_Initialize(IWICBitmapEncoder *iface,
IStream *pIStream, WICBitmapEncoderCacheOption cacheOption)
IStream *stream, WICBitmapEncoderCacheOption cacheOption)
{
FIXME("(%p,%p,%u): stub\n", iface, pIStream, cacheOption);
return E_NOTIMPL;
DdsEncoder *This = impl_from_IWICBitmapEncoder(iface);
HRESULT hr;
TRACE("(%p,%p,%u)\n", iface, stream, cacheOption);
if (cacheOption != WICBitmapEncoderNoCache)
FIXME("Cache option %#x is not supported.\n", cacheOption);
if (!stream) return E_INVALIDARG;
EnterCriticalSection(&This->lock);
if (This->stream)
{
hr = WINCODEC_ERR_WRONGSTATE;
goto end;
}
This->stream = stream;
IStream_AddRef(stream);
hr = S_OK;
end:
LeaveCriticalSection(&This->lock);
return hr;
}
static HRESULT WINAPI DdsEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format)

View File

@ -1287,11 +1287,9 @@ static void test_dds_encoder_initialize(void)
if (!encoder) goto end;
hr = IWICBitmapEncoder_Initialize(encoder, NULL, WICBitmapEncoderNoCache);
todo_wine
ok(hr == E_INVALIDARG, "Initialize got unexpected hr %#x\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
todo_wine
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
IWICBitmapEncoder_Release(encoder);
@ -1302,11 +1300,9 @@ static void test_dds_encoder_initialize(void)
if (!encoder) goto end;
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
todo_wine
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
todo_wine
ok(hr == WINCODEC_ERR_WRONGSTATE, "Initialize got unexpected hr %#x\n", hr);
end: