[2/2] windowscodecs: Implement QueryCapability in the TIFF decoder. Take 2.
Dmitry Timoshkov
dmitry at baikal.ru
Wed Nov 21 03:12:47 CST 2012
---
dlls/windowscodecs/tests/tiffformat.c | 7 -------
dlls/windowscodecs/tiffformat.c | 19 +++++++++++++++----
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c
index 4cbda4d..d8cb10a 100644
--- a/dlls/windowscodecs/tests/tiffformat.c
+++ b/dlls/windowscodecs/tests/tiffformat.c
@@ -212,31 +212,25 @@ static void test_QueryCapability(void)
capability = 0xdeadbeef;
hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
-todo_wine
ok(hr == S_OK, "QueryCapability error %#x\n", hr);
-todo_wine
ok(capability == exp_caps || capability == exp_caps_xp,
"expected %#x, got %#x\n", exp_caps, capability);
frame_count = 0xdeadbeef;
hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
-todo_wine
ok(frame_count == 1, "expected 1, got %u\n", frame_count);
pos.QuadPart = 0;
hr = IStream_Seek(stream, pos, SEEK_CUR, &cur_pos);
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
-todo_wine
ok(cur_pos.QuadPart > 4 && cur_pos.QuadPart < sizeof(tiff_1bpp_data),
"current stream pos is at %x/%x\n", cur_pos.u.LowPart, cur_pos.u.HighPart);
hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
-todo_wine
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand);
-todo_wine
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
IWICBitmapDecoder_Release(decoder);
@@ -261,7 +255,6 @@ todo_wine
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability);
-todo_wine
ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr);
IWICBitmapDecoder_Release(decoder);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index f22d9f6..bacc9c5 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -550,11 +550,22 @@ static ULONG WINAPI TiffDecoder_Release(IWICBitmapDecoder *iface)
return ref;
}
-static HRESULT WINAPI TiffDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *pIStream,
- DWORD *pdwCapability)
+static HRESULT WINAPI TiffDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *stream,
+ DWORD *capability)
{
- FIXME("(%p,%p,%p): stub\n", iface, pIStream, pdwCapability);
- return E_NOTIMPL;
+ HRESULT hr;
+
+ TRACE("(%p,%p,%p)\n", iface, stream, capability);
+
+ if (!stream || !capability) return E_INVALIDARG;
+
+ hr = IWICBitmapDecoder_Initialize(iface, stream, WICDecodeMetadataCacheOnDemand);
+ if (hr != S_OK) return hr;
+
+ *capability = WICBitmapDecoderCapabilityCanDecodeAllImages |
+ WICBitmapDecoderCapabilityCanDecodeSomeImages |
+ WICBitmapDecoderCapabilityCanEnumerateMetadata;
+ return S_OK;
}
static HRESULT WINAPI TiffDecoder_Initialize(IWICBitmapDecoder *iface, IStream *pIStream,
--
1.7.12.4
More information about the wine-patches
mailing list