[1/2] windowscodecs: Implement GetPreview and GetThumbnail in the TIFF decoder.

Dmitry Timoshkov dmitry at baikal.ru
Fri Jun 22 08:03:58 CDT 2012


---
 dlls/windowscodecs/tiffformat.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 669351d..1709cd7 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -626,8 +626,18 @@ static HRESULT WINAPI TiffDecoder_GetMetadataQueryReader(IWICBitmapDecoder *ifac
 static HRESULT WINAPI TiffDecoder_GetPreview(IWICBitmapDecoder *iface,
     IWICBitmapSource **ppIBitmapSource)
 {
-    FIXME("(%p,%p): stub\n", iface, ppIBitmapSource);
-    return E_NOTIMPL;
+    HRESULT hr;
+    IWICBitmapFrameDecode *frame;
+
+    TRACE("(%p,%p)\n", iface, ppIBitmapSource);
+
+    hr = iface->lpVtbl->GetFrame(iface, 0, &frame);
+    if (FAILED(hr)) return hr;
+
+    hr = IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICBitmapSource, (void **)ppIBitmapSource);
+    IWICBitmapFrameDecode_Release(frame);
+
+    return hr;
 }
 
 static HRESULT WINAPI TiffDecoder_GetColorContexts(IWICBitmapDecoder *iface,
@@ -640,8 +650,18 @@ static HRESULT WINAPI TiffDecoder_GetColorContexts(IWICBitmapDecoder *iface,
 static HRESULT WINAPI TiffDecoder_GetThumbnail(IWICBitmapDecoder *iface,
     IWICBitmapSource **ppIThumbnail)
 {
+    HRESULT hr;
+    IWICBitmapFrameDecode *frame;
+
     TRACE("(%p,%p)\n", iface, ppIThumbnail);
-    return WINCODEC_ERR_CODECNOTHUMBNAIL;
+
+    hr = iface->lpVtbl->GetFrame(iface, 0, &frame);
+    if (FAILED(hr)) return hr;
+
+    hr = IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICBitmapSource, (void **)ppIThumbnail);
+    IWICBitmapFrameDecode_Release(frame);
+
+    return hr;
 }
 
 static HRESULT WINAPI TiffDecoder_GetFrameCount(IWICBitmapDecoder *iface,
-- 
1.7.11




More information about the wine-patches mailing list