windowscodecs: Return fail for unsupported format in DdsDecoder_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:
parent
81405aa86d
commit
f98a32ad47
|
@ -626,10 +626,26 @@ static HRESULT WINAPI DdsDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p
|
||||||
WICDecodeOptions cacheOptions)
|
WICDecodeOptions cacheOptions)
|
||||||
{
|
{
|
||||||
DdsDecoder *This = impl_from_IWICBitmapDecoder(iface);
|
DdsDecoder *This = impl_from_IWICBitmapDecoder(iface);
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions);
|
TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions);
|
||||||
|
|
||||||
return IWICWineDecoder_Initialize(&This->IWICWineDecoder_iface, pIStream, cacheOptions);
|
EnterCriticalSection(&This->lock);
|
||||||
|
|
||||||
|
hr = IWICWineDecoder_Initialize(&This->IWICWineDecoder_iface, pIStream, cacheOptions);
|
||||||
|
if (FAILED(hr)) goto end;
|
||||||
|
|
||||||
|
if (!This->info.compressed || This->info.dimension == WICDdsTextureCube) {
|
||||||
|
IStream_Release(pIStream);
|
||||||
|
This->stream = NULL;
|
||||||
|
This->initialized = FALSE;
|
||||||
|
hr = WINCODEC_ERR_BADHEADER;
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
LeaveCriticalSection(&This->lock);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI DdsDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI DdsDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
|
|
|
@ -237,7 +237,6 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
ok(hr == S_OK, "Decoder initialize failed, hr %#x\n", hr);
|
ok(hr == S_OK, "Decoder initialize failed, hr %#x\n", hr);
|
||||||
} else {
|
} else {
|
||||||
todo_wine_if(wine_init)
|
|
||||||
ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr);
|
ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,10 +250,8 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES
|
||||||
if (hr == S_OK) {
|
if (hr == S_OK) {
|
||||||
hr = IWICWineDecoder_Initialize(wine_decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
|
hr = IWICWineDecoder_Initialize(wine_decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
|
ok(hr == S_OK, "Initialize failed, hr %#x\n", hr);
|
||||||
} else {
|
} else {
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "Test %u: Initialize failed, hr %#x\n", index, hr);
|
ok(hr == S_OK, "Test %u: Initialize failed, hr %#x\n", index, hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue