2 * Copyright 2010 Vincent Povirk for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/port.h"
37 #include "wincodecs_private.h"
39 #include "wine/debug.h"
40 #include "wine/library.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs
);
46 static CRITICAL_SECTION init_tiff_cs
;
47 static CRITICAL_SECTION_DEBUG init_tiff_cs_debug
=
50 { &init_tiff_cs_debug
.ProcessLocksList
,
51 &init_tiff_cs_debug
.ProcessLocksList
},
52 0, 0, { (DWORD_PTR
)(__FILE__
": init_tiff_cs") }
54 static CRITICAL_SECTION init_tiff_cs
= { &init_tiff_cs_debug
, -1, 0, 0, 0, 0 };
56 static void *libtiff_handle
;
57 #define MAKE_FUNCPTR(f) static typeof(f) * p##f
58 MAKE_FUNCPTR(TIFFClientOpen
);
59 MAKE_FUNCPTR(TIFFClose
);
60 MAKE_FUNCPTR(TIFFCurrentDirectory
);
61 MAKE_FUNCPTR(TIFFGetField
);
62 MAKE_FUNCPTR(TIFFReadDirectory
);
63 MAKE_FUNCPTR(TIFFReadEncodedStrip
);
64 MAKE_FUNCPTR(TIFFSetDirectory
);
67 static void *load_libtiff(void)
71 EnterCriticalSection(&init_tiff_cs
);
73 if (!libtiff_handle
&&
74 (libtiff_handle
= wine_dlopen(SONAME_LIBTIFF
, RTLD_NOW
, NULL
, 0)) != NULL
)
77 #define LOAD_FUNCPTR(f) \
78 if((p##f = wine_dlsym(libtiff_handle, #f, NULL, 0)) == NULL) { \
79 ERR("failed to load symbol %s\n", #f); \
80 libtiff_handle = NULL; \
81 LeaveCriticalSection(&init_tiff_cs); \
84 LOAD_FUNCPTR(TIFFClientOpen
);
85 LOAD_FUNCPTR(TIFFClose
);
86 LOAD_FUNCPTR(TIFFCurrentDirectory
);
87 LOAD_FUNCPTR(TIFFGetField
);
88 LOAD_FUNCPTR(TIFFReadDirectory
);
89 LOAD_FUNCPTR(TIFFReadEncodedStrip
);
90 LOAD_FUNCPTR(TIFFSetDirectory
);
95 result
= libtiff_handle
;
97 LeaveCriticalSection(&init_tiff_cs
);
101 static tsize_t
tiff_stream_read(thandle_t client_data
, tdata_t data
, tsize_t size
)
103 IStream
*stream
= (IStream
*)client_data
;
107 hr
= IStream_Read(stream
, data
, size
, &bytes_read
);
108 if (FAILED(hr
)) bytes_read
= 0;
112 static tsize_t
tiff_stream_write(thandle_t client_data
, tdata_t data
, tsize_t size
)
114 IStream
*stream
= (IStream
*)client_data
;
118 hr
= IStream_Write(stream
, data
, size
, &bytes_written
);
119 if (FAILED(hr
)) bytes_written
= 0;
120 return bytes_written
;
123 static toff_t
tiff_stream_seek(thandle_t client_data
, toff_t offset
, int whence
)
125 IStream
*stream
= (IStream
*)client_data
;
128 ULARGE_INTEGER new_position
;
131 move
.QuadPart
= offset
;
135 origin
= STREAM_SEEK_SET
;
138 origin
= STREAM_SEEK_CUR
;
141 origin
= STREAM_SEEK_END
;
144 ERR("unknown whence value %i\n", whence
);
148 hr
= IStream_Seek(stream
, move
, origin
, &new_position
);
149 if (SUCCEEDED(hr
)) return new_position
.QuadPart
;
153 static int tiff_stream_close(thandle_t client_data
)
155 /* Caller is responsible for releasing the stream object. */
159 static toff_t
tiff_stream_size(thandle_t client_data
)
161 IStream
*stream
= (IStream
*)client_data
;
165 hr
= IStream_Stat(stream
, &statstg
, STATFLAG_NONAME
);
167 if (SUCCEEDED(hr
)) return statstg
.cbSize
.QuadPart
;
171 static int tiff_stream_map(thandle_t client_data
, tdata_t
*addr
, toff_t
*size
)
173 /* Cannot mmap streams */
177 static void tiff_stream_unmap(thandle_t client_data
, tdata_t addr
, toff_t size
)
179 /* No need to ever do this, since we can't map things. */
182 static TIFF
* tiff_open_stream(IStream
*stream
, const char *mode
)
184 return pTIFFClientOpen("<IStream object>", mode
, stream
, tiff_stream_read
,
185 tiff_stream_write
, tiff_stream_seek
, tiff_stream_close
,
186 tiff_stream_size
, tiff_stream_map
, tiff_stream_unmap
);
190 const IWICBitmapDecoderVtbl
*lpVtbl
;
193 CRITICAL_SECTION lock
; /* Must be held when tiff is used or initiailzed is set */
199 const WICPixelFormatGUID
*format
;
204 UINT tile_width
, tile_height
;
210 const IWICBitmapFrameDecodeVtbl
*lpVtbl
;
214 tiff_decode_info decode_info
;
215 INT cached_tile_x
, cached_tile_y
;
219 static const IWICBitmapFrameDecodeVtbl TiffFrameDecode_Vtbl
;
221 static HRESULT
tiff_get_decode_info(TIFF
*tiff
, tiff_decode_info
*decode_info
)
223 uint16 photometric
, bps
, samples
, planar
;
226 decode_info
->indexed
= 0;
227 decode_info
->reverse_bgr
= 0;
229 ret
= pTIFFGetField(tiff
, TIFFTAG_PHOTOMETRIC
, &photometric
);
232 WARN("missing PhotometricInterpretation tag\n");
236 ret
= pTIFFGetField(tiff
, TIFFTAG_BITSPERSAMPLE
, &bps
);
241 case 1: /* BlackIsZero */
242 decode_info
->bpp
= bps
;
246 decode_info
->format
= &GUID_WICPixelFormatBlackWhite
;
249 decode_info
->format
= &GUID_WICPixelFormat4bppGray
;
252 decode_info
->format
= &GUID_WICPixelFormat8bppGray
;
255 FIXME("unhandled greyscale bit count %u\n", bps
);
260 ret
= pTIFFGetField(tiff
, TIFFTAG_PLANARCONFIG
, &planar
);
261 if (!ret
) planar
= 1;
264 FIXME("unhandled planar configuration %u\n", planar
);
267 ret
= pTIFFGetField(tiff
, TIFFTAG_SAMPLESPERPIXEL
, &samples
);
270 FIXME("unhandled RGB sample count %u\n", samples
);
274 decode_info
->bpp
= bps
* samples
;
279 decode_info
->reverse_bgr
= 1;
280 decode_info
->format
= &GUID_WICPixelFormat24bppBGR
;
283 decode_info
->format
= &GUID_WICPixelFormat48bppRGB
;
286 FIXME("unhandled RGB bit count %u\n", bps
);
290 case 3: /* RGB Palette */
291 decode_info
->indexed
= 1;
292 decode_info
->bpp
= bps
;
296 decode_info
->format
= &GUID_WICPixelFormat4bppIndexed
;
299 decode_info
->format
= &GUID_WICPixelFormat8bppIndexed
;
302 FIXME("unhandled indexed bit count %u\n", bps
);
306 case 0: /* WhiteIsZero */
307 case 4: /* Transparency mask */
312 FIXME("unhandled PhotometricInterpretation %u\n", photometric
);
316 ret
= pTIFFGetField(tiff
, TIFFTAG_IMAGEWIDTH
, &decode_info
->width
);
319 WARN("missing image width\n");
323 ret
= pTIFFGetField(tiff
, TIFFTAG_IMAGELENGTH
, &decode_info
->height
);
326 WARN("missing image length\n");
330 ret
= pTIFFGetField(tiff
, TIFFTAG_ROWSPERSTRIP
, &decode_info
->tile_height
);
333 decode_info
->tile_width
= decode_info
->width
;
334 decode_info
->tile_stride
= ((decode_info
->bpp
* decode_info
->tile_width
+ 7)/8);
335 decode_info
->tile_size
= decode_info
->tile_height
* decode_info
->tile_stride
;
339 /* Probably a tiled image */
340 FIXME("missing RowsPerStrip value\n");
347 static HRESULT WINAPI
TiffDecoder_QueryInterface(IWICBitmapDecoder
*iface
, REFIID iid
,
350 TiffDecoder
*This
= (TiffDecoder
*)iface
;
351 TRACE("(%p,%s,%p)\n", iface
, debugstr_guid(iid
), ppv
);
353 if (!ppv
) return E_INVALIDARG
;
355 if (IsEqualIID(&IID_IUnknown
, iid
) || IsEqualIID(&IID_IWICBitmapDecoder
, iid
))
362 return E_NOINTERFACE
;
365 IUnknown_AddRef((IUnknown
*)*ppv
);
369 static ULONG WINAPI
TiffDecoder_AddRef(IWICBitmapDecoder
*iface
)
371 TiffDecoder
*This
= (TiffDecoder
*)iface
;
372 ULONG ref
= InterlockedIncrement(&This
->ref
);
374 TRACE("(%p) refcount=%u\n", iface
, ref
);
379 static ULONG WINAPI
TiffDecoder_Release(IWICBitmapDecoder
*iface
)
381 TiffDecoder
*This
= (TiffDecoder
*)iface
;
382 ULONG ref
= InterlockedDecrement(&This
->ref
);
384 TRACE("(%p) refcount=%u\n", iface
, ref
);
388 if (This
->tiff
) pTIFFClose(This
->tiff
);
389 if (This
->stream
) IStream_Release(This
->stream
);
390 This
->lock
.DebugInfo
->Spare
[0] = 0;
391 DeleteCriticalSection(&This
->lock
);
392 HeapFree(GetProcessHeap(), 0, This
);
398 static HRESULT WINAPI
TiffDecoder_QueryCapability(IWICBitmapDecoder
*iface
, IStream
*pIStream
,
399 DWORD
*pdwCapability
)
401 FIXME("(%p,%p,%p): stub\n", iface
, pIStream
, pdwCapability
);
405 static HRESULT WINAPI
TiffDecoder_Initialize(IWICBitmapDecoder
*iface
, IStream
*pIStream
,
406 WICDecodeOptions cacheOptions
)
408 TiffDecoder
*This
= (TiffDecoder
*)iface
;
412 TRACE("(%p,%p,%x): stub\n", iface
, pIStream
, cacheOptions
);
414 EnterCriticalSection(&This
->lock
);
416 if (This
->initialized
)
418 hr
= WINCODEC_ERR_WRONGSTATE
;
422 tiff
= tiff_open_stream(pIStream
, "r");
431 This
->stream
= pIStream
;
432 IStream_AddRef(pIStream
);
433 This
->initialized
= TRUE
;
436 LeaveCriticalSection(&This
->lock
);
440 static HRESULT WINAPI
TiffDecoder_GetContainerFormat(IWICBitmapDecoder
*iface
,
441 GUID
*pguidContainerFormat
)
443 memcpy(pguidContainerFormat
, &GUID_ContainerFormatTiff
, sizeof(GUID
));
447 static HRESULT WINAPI
TiffDecoder_GetDecoderInfo(IWICBitmapDecoder
*iface
,
448 IWICBitmapDecoderInfo
**ppIDecoderInfo
)
450 FIXME("(%p,%p): stub\n", iface
, ppIDecoderInfo
);
454 static HRESULT WINAPI
TiffDecoder_CopyPalette(IWICBitmapDecoder
*iface
,
455 IWICPalette
*pIPalette
)
457 FIXME("(%p,%p): stub\n", iface
, pIPalette
);
461 static HRESULT WINAPI
TiffDecoder_GetMetadataQueryReader(IWICBitmapDecoder
*iface
,
462 IWICMetadataQueryReader
**ppIMetadataQueryReader
)
464 FIXME("(%p,%p): stub\n", iface
, ppIMetadataQueryReader
);
468 static HRESULT WINAPI
TiffDecoder_GetPreview(IWICBitmapDecoder
*iface
,
469 IWICBitmapSource
**ppIBitmapSource
)
471 FIXME("(%p,%p): stub\n", iface
, ppIBitmapSource
);
475 static HRESULT WINAPI
TiffDecoder_GetColorContexts(IWICBitmapDecoder
*iface
,
476 UINT cCount
, IWICColorContext
**ppIColorContexts
, UINT
*pcActualCount
)
478 FIXME("(%p,%u,%p,%p)\n", iface
, cCount
, ppIColorContexts
, pcActualCount
);
482 static HRESULT WINAPI
TiffDecoder_GetThumbnail(IWICBitmapDecoder
*iface
,
483 IWICBitmapSource
**ppIThumbnail
)
485 TRACE("(%p,%p)\n", iface
, ppIThumbnail
);
486 return WINCODEC_ERR_CODECNOTHUMBNAIL
;
489 static HRESULT WINAPI
TiffDecoder_GetFrameCount(IWICBitmapDecoder
*iface
,
492 TiffDecoder
*This
= (TiffDecoder
*)iface
;
496 WARN("(%p) <-- WINCODEC_ERR_WRONGSTATE\n", iface
);
497 return WINCODEC_ERR_WRONGSTATE
;
500 EnterCriticalSection(&This
->lock
);
501 while (pTIFFReadDirectory(This
->tiff
)) { }
502 *pCount
= pTIFFCurrentDirectory(This
->tiff
)+1;
503 LeaveCriticalSection(&This
->lock
);
505 TRACE("(%p) <-- %i\n", iface
, *pCount
);
510 static HRESULT WINAPI
TiffDecoder_GetFrame(IWICBitmapDecoder
*iface
,
511 UINT index
, IWICBitmapFrameDecode
**ppIBitmapFrame
)
513 TiffDecoder
*This
= (TiffDecoder
*)iface
;
514 TiffFrameDecode
*result
;
516 tiff_decode_info decode_info
;
519 TRACE("(%p,%u,%p)\n", iface
, index
, ppIBitmapFrame
);
522 return WINCODEC_ERR_WRONGSTATE
;
524 EnterCriticalSection(&This
->lock
);
525 res
= pTIFFSetDirectory(This
->tiff
, index
);
526 if (!res
) hr
= E_INVALIDARG
;
527 else hr
= tiff_get_decode_info(This
->tiff
, &decode_info
);
528 LeaveCriticalSection(&This
->lock
);
532 result
= HeapAlloc(GetProcessHeap(), 0, sizeof(TiffFrameDecode
));
536 result
->lpVtbl
= &TiffFrameDecode_Vtbl
;
538 result
->parent
= This
;
539 result
->index
= index
;
540 result
->decode_info
= decode_info
;
541 result
->cached_tile_x
= -1;
542 result
->cached_tile
= HeapAlloc(GetProcessHeap(), 0, decode_info
.tile_size
);
544 if (result
->cached_tile
)
545 *ppIBitmapFrame
= (IWICBitmapFrameDecode
*)result
;
549 HeapFree(GetProcessHeap(), 0, result
);
552 else hr
= E_OUTOFMEMORY
;
555 if (FAILED(hr
)) *ppIBitmapFrame
= NULL
;
560 static const IWICBitmapDecoderVtbl TiffDecoder_Vtbl
= {
561 TiffDecoder_QueryInterface
,
564 TiffDecoder_QueryCapability
,
565 TiffDecoder_Initialize
,
566 TiffDecoder_GetContainerFormat
,
567 TiffDecoder_GetDecoderInfo
,
568 TiffDecoder_CopyPalette
,
569 TiffDecoder_GetMetadataQueryReader
,
570 TiffDecoder_GetPreview
,
571 TiffDecoder_GetColorContexts
,
572 TiffDecoder_GetThumbnail
,
573 TiffDecoder_GetFrameCount
,
577 static HRESULT WINAPI
TiffFrameDecode_QueryInterface(IWICBitmapFrameDecode
*iface
, REFIID iid
,
580 TiffFrameDecode
*This
= (TiffFrameDecode
*)iface
;
581 TRACE("(%p,%s,%p)\n", iface
, debugstr_guid(iid
), ppv
);
583 if (!ppv
) return E_INVALIDARG
;
585 if (IsEqualIID(&IID_IUnknown
, iid
) ||
586 IsEqualIID(&IID_IWICBitmapSource
, iid
) ||
587 IsEqualIID(&IID_IWICBitmapFrameDecode
, iid
))
594 return E_NOINTERFACE
;
597 IUnknown_AddRef((IUnknown
*)*ppv
);
601 static ULONG WINAPI
TiffFrameDecode_AddRef(IWICBitmapFrameDecode
*iface
)
603 TiffFrameDecode
*This
= (TiffFrameDecode
*)iface
;
604 ULONG ref
= InterlockedIncrement(&This
->ref
);
606 TRACE("(%p) refcount=%u\n", iface
, ref
);
611 static ULONG WINAPI
TiffFrameDecode_Release(IWICBitmapFrameDecode
*iface
)
613 TiffFrameDecode
*This
= (TiffFrameDecode
*)iface
;
614 ULONG ref
= InterlockedDecrement(&This
->ref
);
616 TRACE("(%p) refcount=%u\n", iface
, ref
);
620 HeapFree(GetProcessHeap(), 0, This
->cached_tile
);
621 HeapFree(GetProcessHeap(), 0, This
);
627 static HRESULT WINAPI
TiffFrameDecode_GetSize(IWICBitmapFrameDecode
*iface
,
628 UINT
*puiWidth
, UINT
*puiHeight
)
630 TiffFrameDecode
*This
= (TiffFrameDecode
*)iface
;
632 *puiWidth
= This
->decode_info
.width
;
633 *puiHeight
= This
->decode_info
.height
;
635 TRACE("(%p) <-- %ux%u\n", iface
, *puiWidth
, *puiHeight
);
640 static HRESULT WINAPI
TiffFrameDecode_GetPixelFormat(IWICBitmapFrameDecode
*iface
,
641 WICPixelFormatGUID
*pPixelFormat
)
643 TiffFrameDecode
*This
= (TiffFrameDecode
*)iface
;
645 memcpy(pPixelFormat
, This
->decode_info
.format
, sizeof(GUID
));
647 TRACE("(%p) <-- %s\n", This
, debugstr_guid(This
->decode_info
.format
));
652 static HRESULT WINAPI
TiffFrameDecode_GetResolution(IWICBitmapFrameDecode
*iface
,
653 double *pDpiX
, double *pDpiY
)
655 FIXME("(%p,%p,%p)\n", iface
, pDpiX
, pDpiY
);
659 static HRESULT WINAPI
TiffFrameDecode_CopyPalette(IWICBitmapFrameDecode
*iface
,
660 IWICPalette
*pIPalette
)
662 FIXME("(%p,%p)\n", iface
, pIPalette
);
666 static HRESULT
TiffFrameDecode_ReadTile(TiffFrameDecode
*This
, UINT tile_x
, UINT tile_y
)
671 ret
= pTIFFSetDirectory(This
->parent
->tiff
, This
->index
);
678 ret
= pTIFFReadEncodedStrip(This
->parent
->tiff
, tile_y
, This
->cached_tile
, This
->decode_info
.tile_size
);
684 if (hr
== S_OK
&& This
->decode_info
.reverse_bgr
)
686 if (This
->decode_info
.format
== &GUID_WICPixelFormat24bppBGR
)
688 UINT i
, total_pixels
;
691 total_pixels
= This
->decode_info
.tile_width
* This
->decode_info
.tile_height
;
692 pixel
= This
->cached_tile
;
693 for (i
=0; i
<total_pixels
; i
++)
705 This
->cached_tile_x
= tile_x
;
706 This
->cached_tile_y
= tile_y
;
712 static HRESULT WINAPI
TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode
*iface
,
713 const WICRect
*prc
, UINT cbStride
, UINT cbBufferSize
, BYTE
*pbBuffer
)
715 TiffFrameDecode
*This
= (TiffFrameDecode
*)iface
;
716 UINT min_tile_x
, max_tile_x
, min_tile_y
, max_tile_y
;
723 TRACE("(%p,%p,%u,%u,%p)\n", iface
, prc
, cbStride
, cbBufferSize
, pbBuffer
);
725 if (prc
->X
< 0 || prc
->Y
< 0 || prc
->X
+prc
->Width
> This
->decode_info
.width
||
726 prc
->Y
+prc
->Height
> This
->decode_info
.height
)
729 bytesperrow
= ((This
->decode_info
.bpp
* prc
->Width
)+7)/8;
731 if (cbStride
< bytesperrow
)
734 if ((cbStride
* prc
->Height
) > cbBufferSize
)
737 min_tile_x
= prc
->X
/ This
->decode_info
.tile_width
;
738 min_tile_y
= prc
->Y
/ This
->decode_info
.tile_height
;
739 max_tile_x
= (prc
->X
+prc
->Width
-1) / This
->decode_info
.tile_width
;
740 max_tile_y
= (prc
->Y
+prc
->Height
-1) / This
->decode_info
.tile_height
;
742 EnterCriticalSection(&This
->parent
->lock
);
744 for (tile_x
=min_tile_x
; tile_x
<= max_tile_x
; tile_x
++)
746 for (tile_y
=min_tile_y
; tile_y
<= max_tile_y
; tile_y
++)
748 if (tile_x
!= This
->cached_tile_x
|| tile_y
!= This
->cached_tile_y
)
750 hr
= TiffFrameDecode_ReadTile(This
, tile_x
, tile_y
);
755 if (prc
->X
< tile_x
* This
->decode_info
.tile_width
)
758 rc
.X
= prc
->X
- tile_x
* This
->decode_info
.tile_width
;
760 if (prc
->Y
< tile_y
* This
->decode_info
.tile_height
)
763 rc
.Y
= prc
->Y
- tile_y
* This
->decode_info
.tile_height
;
765 if (prc
->X
+prc
->Width
> (tile_x
+1) * This
->decode_info
.tile_width
)
766 rc
.Width
= This
->decode_info
.tile_width
- rc
.X
;
767 else if (prc
->X
< tile_x
* This
->decode_info
.tile_width
)
768 rc
.Width
= prc
->Width
+ prc
->X
- tile_x
* This
->decode_info
.tile_width
;
770 rc
.Width
= prc
->Width
;
772 if (prc
->Y
+prc
->Height
> (tile_y
+1) * This
->decode_info
.tile_height
)
773 rc
.Height
= This
->decode_info
.tile_height
- rc
.Y
;
774 else if (prc
->Y
< tile_y
* This
->decode_info
.tile_height
)
775 rc
.Height
= prc
->Height
+ prc
->Y
- tile_y
* This
->decode_info
.tile_height
;
777 rc
.Height
= prc
->Height
;
779 dst_tilepos
= pbBuffer
+ (cbStride
* ((rc
.Y
+ tile_y
* This
->decode_info
.tile_height
) - prc
->Y
)) +
780 ((This
->decode_info
.bpp
* ((rc
.X
+ tile_x
* This
->decode_info
.tile_width
) - prc
->X
) + 7) / 8);
782 hr
= copy_pixels(This
->decode_info
.bpp
, This
->cached_tile
,
783 This
->decode_info
.tile_width
, This
->decode_info
.tile_height
, This
->decode_info
.tile_stride
,
784 &rc
, cbStride
, cbBufferSize
, dst_tilepos
);
789 LeaveCriticalSection(&This
->parent
->lock
);
790 TRACE("<-- 0x%x\n", hr
);
796 LeaveCriticalSection(&This
->parent
->lock
);
801 static HRESULT WINAPI
TiffFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode
*iface
,
802 IWICMetadataQueryReader
**ppIMetadataQueryReader
)
804 FIXME("(%p,%p): stub\n", iface
, ppIMetadataQueryReader
);
808 static HRESULT WINAPI
TiffFrameDecode_GetColorContexts(IWICBitmapFrameDecode
*iface
,
809 UINT cCount
, IWICColorContext
**ppIColorContexts
, UINT
*pcActualCount
)
811 FIXME("(%p,%u,%p,%p): stub\n", iface
, cCount
, ppIColorContexts
, pcActualCount
);
815 static HRESULT WINAPI
TiffFrameDecode_GetThumbnail(IWICBitmapFrameDecode
*iface
,
816 IWICBitmapSource
**ppIThumbnail
)
818 FIXME("(%p,%p): stub\n", iface
, ppIThumbnail
);
822 static const IWICBitmapFrameDecodeVtbl TiffFrameDecode_Vtbl
= {
823 TiffFrameDecode_QueryInterface
,
824 TiffFrameDecode_AddRef
,
825 TiffFrameDecode_Release
,
826 TiffFrameDecode_GetSize
,
827 TiffFrameDecode_GetPixelFormat
,
828 TiffFrameDecode_GetResolution
,
829 TiffFrameDecode_CopyPalette
,
830 TiffFrameDecode_CopyPixels
,
831 TiffFrameDecode_GetMetadataQueryReader
,
832 TiffFrameDecode_GetColorContexts
,
833 TiffFrameDecode_GetThumbnail
836 HRESULT
TiffDecoder_CreateInstance(IUnknown
*pUnkOuter
, REFIID iid
, void** ppv
)
841 TRACE("(%p,%s,%p)\n", pUnkOuter
, debugstr_guid(iid
), ppv
);
845 if (pUnkOuter
) return CLASS_E_NOAGGREGATION
;
849 ERR("Failed reading TIFF because unable to load %s\n",SONAME_LIBTIFF
);
853 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(TiffDecoder
));
854 if (!This
) return E_OUTOFMEMORY
;
856 This
->lpVtbl
= &TiffDecoder_Vtbl
;
859 InitializeCriticalSection(&This
->lock
);
860 This
->lock
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": TiffDecoder.lock");
862 This
->initialized
= FALSE
;
864 ret
= IUnknown_QueryInterface((IUnknown
*)This
, iid
, ppv
);
865 IUnknown_Release((IUnknown
*)This
);
870 #else /* !SONAME_LIBTIFF */
872 HRESULT
TiffDecoder_CreateInstance(IUnknown
*pUnkOuter
, REFIID iid
, void** ppv
)
874 ERR("Trying to load TIFF picture, but Wine was compiled without TIFF support.\n");