From eb26db27a75bb0332f8877feec06558aaeab9db1 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 23 Nov 2012 11:48:04 +0800 Subject: [PATCH] windowscodecs: Reimplement QueryCapability of the BMP decoder. --- dlls/windowscodecs/bmpdecode.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c index 54de0f1b1a7..e0293691272 100644 --- a/dlls/windowscodecs/bmpdecode.c +++ b/dlls/windowscodecs/bmpdecode.c @@ -1010,22 +1010,20 @@ static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface) return ref; } -static HRESULT WINAPI BmpDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *pIStream, - DWORD *pdwCapability) +static HRESULT WINAPI BmpDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *stream, + DWORD *capability) { HRESULT hr; BmpDecoder *This = impl_from_IWICBitmapDecoder(iface); - EnterCriticalSection(&This->lock); - hr = BmpDecoder_ReadHeaders(This, pIStream); - LeaveCriticalSection(&This->lock); - if (FAILED(hr)) return hr; + TRACE("(%p,%p,%p)\n", iface, stream, capability); - if (This->read_data_func == BmpFrameDecode_ReadUnsupported) - *pdwCapability = 0; - else - *pdwCapability = WICBitmapDecoderCapabilityCanDecodeAllImages; + if (!stream || !capability) return E_INVALIDARG; + hr = IWICBitmapDecoder_Initialize(iface, stream, WICDecodeMetadataCacheOnDemand); + if (hr != S_OK) return hr; + + *capability = This->read_data_func == BmpFrameDecode_ReadUnsupported ? 0 : WICBitmapDecoderCapabilityCanDecodeAllImages; return S_OK; }