2 * Copyright 2009 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
19 #define WIN32_NO_STATUS
21 #define COM_NO_WINDOWS_H
34 #include "wincodecs_private.h"
36 #include <wine/debug.h>
38 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs
);
63 IWICBitmapDecoder IWICBitmapDecoder_iface
;
68 CRITICAL_SECTION lock
; /* must be held when accessing stream */
72 IWICBitmapFrameDecode IWICBitmapFrameDecode_iface
;
79 static inline IcoDecoder
*impl_from_IWICBitmapDecoder(IWICBitmapDecoder
*iface
)
81 return CONTAINING_RECORD(iface
, IcoDecoder
, IWICBitmapDecoder_iface
);
84 static inline IcoFrameDecode
*impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode
*iface
)
86 return CONTAINING_RECORD(iface
, IcoFrameDecode
, IWICBitmapFrameDecode_iface
);
89 static HRESULT WINAPI
IcoFrameDecode_QueryInterface(IWICBitmapFrameDecode
*iface
, REFIID iid
,
92 IcoFrameDecode
*This
= impl_from_IWICBitmapFrameDecode(iface
);
93 TRACE("(%p,%s,%p)\n", iface
, debugstr_guid(iid
), ppv
);
95 if (!ppv
) return E_INVALIDARG
;
97 if (IsEqualIID(&IID_IUnknown
, iid
) ||
98 IsEqualIID(&IID_IWICBitmapSource
, iid
) ||
99 IsEqualIID(&IID_IWICBitmapFrameDecode
, iid
))
101 *ppv
= &This
->IWICBitmapFrameDecode_iface
;
106 return E_NOINTERFACE
;
109 IUnknown_AddRef((IUnknown
*)*ppv
);
113 static ULONG WINAPI
IcoFrameDecode_AddRef(IWICBitmapFrameDecode
*iface
)
115 IcoFrameDecode
*This
= impl_from_IWICBitmapFrameDecode(iface
);
116 ULONG ref
= InterlockedIncrement(&This
->ref
);
118 TRACE("(%p) refcount=%u\n", iface
, ref
);
123 static ULONG WINAPI
IcoFrameDecode_Release(IWICBitmapFrameDecode
*iface
)
125 IcoFrameDecode
*This
= impl_from_IWICBitmapFrameDecode(iface
);
126 ULONG ref
= InterlockedDecrement(&This
->ref
);
128 TRACE("(%p) refcount=%u\n", iface
, ref
);
132 HeapFree(GetProcessHeap(), 0, This
->bits
);
133 HeapFree(GetProcessHeap(), 0, This
);
139 static HRESULT WINAPI
IcoFrameDecode_GetSize(IWICBitmapFrameDecode
*iface
,
140 UINT
*puiWidth
, UINT
*puiHeight
)
142 IcoFrameDecode
*This
= impl_from_IWICBitmapFrameDecode(iface
);
144 *puiWidth
= This
->width
;
145 *puiHeight
= This
->height
;
147 TRACE("(%p) -> (%i,%i)\n", iface
, *puiWidth
, *puiHeight
);
152 static HRESULT WINAPI
IcoFrameDecode_GetPixelFormat(IWICBitmapFrameDecode
*iface
,
153 WICPixelFormatGUID
*pPixelFormat
)
155 memcpy(pPixelFormat
, &GUID_WICPixelFormat32bppBGRA
, sizeof(GUID
));
159 static HRESULT WINAPI
IcoFrameDecode_GetResolution(IWICBitmapFrameDecode
*iface
,
160 double *pDpiX
, double *pDpiY
)
162 IcoFrameDecode
*This
= impl_from_IWICBitmapFrameDecode(iface
);
167 TRACE("(%p) -> (%f,%f)\n", iface
, *pDpiX
, *pDpiY
);
172 static HRESULT WINAPI
IcoFrameDecode_CopyPalette(IWICBitmapFrameDecode
*iface
,
173 IWICPalette
*pIPalette
)
175 TRACE("(%p,%p)\n", iface
, pIPalette
);
176 return WINCODEC_ERR_PALETTEUNAVAILABLE
;
179 static HRESULT WINAPI
IcoFrameDecode_CopyPixels(IWICBitmapFrameDecode
*iface
,
180 const WICRect
*prc
, UINT cbStride
, UINT cbBufferSize
, BYTE
*pbBuffer
)
182 IcoFrameDecode
*This
= impl_from_IWICBitmapFrameDecode(iface
);
183 TRACE("(%p,%p,%u,%u,%p)\n", iface
, prc
, cbStride
, cbBufferSize
, pbBuffer
);
185 return copy_pixels(32, This
->bits
, This
->width
, This
->height
, This
->width
* 4,
186 prc
, cbStride
, cbBufferSize
, pbBuffer
);
189 static HRESULT WINAPI
IcoFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode
*iface
,
190 IWICMetadataQueryReader
**ppIMetadataQueryReader
)
192 TRACE("(%p,%p)\n", iface
, ppIMetadataQueryReader
);
193 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
196 static HRESULT WINAPI
IcoFrameDecode_GetColorContexts(IWICBitmapFrameDecode
*iface
,
197 UINT cCount
, IWICColorContext
**ppIColorContexts
, UINT
*pcActualCount
)
199 TRACE("(%p,%u,%p,%p)\n", iface
, cCount
, ppIColorContexts
, pcActualCount
);
200 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
203 static HRESULT WINAPI
IcoFrameDecode_GetThumbnail(IWICBitmapFrameDecode
*iface
,
204 IWICBitmapSource
**ppIThumbnail
)
206 FIXME("(%p,%p)\n", iface
, ppIThumbnail
);
210 static const IWICBitmapFrameDecodeVtbl IcoFrameDecode_Vtbl
= {
211 IcoFrameDecode_QueryInterface
,
212 IcoFrameDecode_AddRef
,
213 IcoFrameDecode_Release
,
214 IcoFrameDecode_GetSize
,
215 IcoFrameDecode_GetPixelFormat
,
216 IcoFrameDecode_GetResolution
,
217 IcoFrameDecode_CopyPalette
,
218 IcoFrameDecode_CopyPixels
,
219 IcoFrameDecode_GetMetadataQueryReader
,
220 IcoFrameDecode_GetColorContexts
,
221 IcoFrameDecode_GetThumbnail
224 static inline void pixel_set_trans(DWORD
* pixel
, BOOL transparent
)
226 if (transparent
) *pixel
= 0;
227 else *pixel
|= 0xff000000;
230 static HRESULT
ReadIcoDib(IStream
*stream
, IcoFrameDecode
*result
)
233 BmpDecoder
*bmp_decoder
;
234 IWICBitmapDecoder
*decoder
;
235 IWICBitmapFrameDecode
*framedecode
;
236 WICPixelFormatGUID pixelformat
;
237 IWICBitmapSource
*source
;
238 int has_alpha
=FALSE
; /* if TRUE, alpha data might be in the image data */
241 hr
= IcoDibDecoder_CreateInstance(&bmp_decoder
);
244 BmpDecoder_GetWICDecoder(bmp_decoder
, &decoder
);
245 hr
= IWICBitmapDecoder_Initialize(decoder
, stream
, WICDecodeMetadataCacheOnLoad
);
248 hr
= IWICBitmapDecoder_GetFrame(decoder
, 0, &framedecode
);
252 hr
= IWICBitmapFrameDecode_GetSize(framedecode
, &result
->width
, &result
->height
);
256 result
->bits
= HeapAlloc(GetProcessHeap(), 0, result
->width
* result
->height
* 4);
257 if (!result
->bits
) hr
= E_OUTOFMEMORY
;
261 hr
= IWICBitmapFrameDecode_GetPixelFormat(framedecode
, &pixelformat
);
263 if (IsEqualGUID(&pixelformat
, &GUID_WICPixelFormat32bppBGR
) ||
264 IsEqualGUID(&pixelformat
, &GUID_WICPixelFormat32bppBGRA
))
266 source
= (IWICBitmapSource
*)framedecode
;
267 IWICBitmapSource_AddRef(source
);
272 hr
= WICConvertBitmapSource(&GUID_WICPixelFormat32bppBGRA
,
273 (IWICBitmapSource
*)framedecode
, &source
);
281 rc
.Width
= result
->width
;
282 rc
.Height
= result
->height
;
283 hr
= IWICBitmapSource_CopyPixels(source
, &rc
, result
->width
* 4,
284 result
->width
* result
->height
* 4, result
->bits
);
286 IWICBitmapSource_Release(source
);
290 hr
= IWICBitmapFrameDecode_GetResolution(framedecode
, &result
->dpiX
, &result
->dpiY
);
292 IWICBitmapFrameDecode_Release(framedecode
);
295 if (SUCCEEDED(hr
) && has_alpha
)
297 /* If the alpha channel is fully transparent, we should ignore it. */
298 int nonzero_alpha
= 0;
301 for (i
=0; i
<(result
->height
*result
->width
); i
++)
303 if (result
->bits
[i
*4+3] != 0)
312 for (i
=0; i
<(result
->height
*result
->width
); i
++)
313 result
->bits
[i
*4+3] = 0xff;
319 if (SUCCEEDED(hr
) && !has_alpha
)
321 /* set alpha data based on the AND mask */
322 UINT andBytesPerRow
= (result
->width
+31)/32*4;
323 UINT andBytes
= andBytesPerRow
* result
->height
;
328 UINT bitsStride
= result
->width
* 4;
335 BmpDecoder_FindIconMask(bmp_decoder
, &offset
, &topdown
);
339 seek
.QuadPart
= offset
;
341 hr
= IStream_Seek(stream
, seek
, STREAM_SEEK_SET
, 0);
345 tempdata
= HeapAlloc(GetProcessHeap(), 0, andBytes
);
346 if (!tempdata
) hr
= E_OUTOFMEMORY
;
350 hr
= IStream_Read(stream
, tempdata
, andBytes
, &bytesread
);
352 if (SUCCEEDED(hr
) && bytesread
== andBytes
)
356 andStride
= andBytesPerRow
;
361 andStride
= -andBytesPerRow
;
362 andRow
= tempdata
+ (result
->height
-1)*andBytesPerRow
;
365 bitsRow
= result
->bits
;
366 for (y
=0; y
<result
->height
; y
++) {
367 BYTE
*andByte
=andRow
;
368 DWORD
*bitsPixel
=(DWORD
*)bitsRow
;
369 for (x
=0; x
<result
->width
; x
+=8) {
370 BYTE andVal
=*andByte
++;
371 pixel_set_trans(bitsPixel
++, andVal
>>7&1);
372 if (x
+1 < result
->width
) pixel_set_trans(bitsPixel
++, andVal
>>6&1);
373 if (x
+2 < result
->width
) pixel_set_trans(bitsPixel
++, andVal
>>5&1);
374 if (x
+3 < result
->width
) pixel_set_trans(bitsPixel
++, andVal
>>4&1);
375 if (x
+4 < result
->width
) pixel_set_trans(bitsPixel
++, andVal
>>3&1);
376 if (x
+5 < result
->width
) pixel_set_trans(bitsPixel
++, andVal
>>2&1);
377 if (x
+6 < result
->width
) pixel_set_trans(bitsPixel
++, andVal
>>1&1);
378 if (x
+7 < result
->width
) pixel_set_trans(bitsPixel
++, andVal
&1);
381 bitsRow
+= bitsStride
;
385 HeapFree(GetProcessHeap(), 0, tempdata
);
389 IWICBitmapDecoder_Release(decoder
);
395 static HRESULT
ReadIcoPng(IStream
*stream
, IcoFrameDecode
*result
)
397 IWICBitmapDecoder
*decoder
= NULL
;
398 IWICBitmapFrameDecode
*sourceFrame
= NULL
;
399 IWICBitmapSource
*sourceBitmap
= NULL
;
403 hr
= PngDecoder_CreateInstance(NULL
, &IID_IWICBitmapDecoder
, (void**)&decoder
);
406 hr
= IWICBitmapDecoder_Initialize(decoder
, stream
, WICDecodeMetadataCacheOnLoad
);
409 hr
= IWICBitmapDecoder_GetFrame(decoder
, 0, &sourceFrame
);
412 hr
= WICConvertBitmapSource(&GUID_WICPixelFormat32bppBGRA
, (IWICBitmapSource
*)sourceFrame
, &sourceBitmap
);
415 hr
= IWICBitmapFrameDecode_GetSize(sourceFrame
, &result
->width
, &result
->height
);
418 hr
= IWICBitmapFrameDecode_GetResolution(sourceFrame
, &result
->dpiX
, &result
->dpiY
);
421 result
->bits
= HeapAlloc(GetProcessHeap(), 0, 4 * result
->width
* result
->height
);
422 if (result
->bits
== NULL
)
429 rect
.Width
= result
->width
;
430 rect
.Height
= result
->height
;
431 hr
= IWICBitmapSource_CopyPixels(sourceBitmap
, &rect
, 4*result
->width
,
432 4*result
->width
*result
->height
, result
->bits
);
436 IWICBitmapDecoder_Release(decoder
);
437 if (sourceFrame
!= NULL
)
438 IWICBitmapFrameDecode_Release(sourceFrame
);
439 if (sourceBitmap
!= NULL
)
440 IWICBitmapSource_Release(sourceBitmap
);
444 static HRESULT WINAPI
IcoDecoder_QueryInterface(IWICBitmapDecoder
*iface
, REFIID iid
,
447 IcoDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
448 TRACE("(%p,%s,%p)\n", iface
, debugstr_guid(iid
), ppv
);
450 if (!ppv
) return E_INVALIDARG
;
452 if (IsEqualIID(&IID_IUnknown
, iid
) ||
453 IsEqualIID(&IID_IWICBitmapDecoder
, iid
))
455 *ppv
= &This
->IWICBitmapDecoder_iface
;
460 return E_NOINTERFACE
;
463 IUnknown_AddRef((IUnknown
*)*ppv
);
467 static ULONG WINAPI
IcoDecoder_AddRef(IWICBitmapDecoder
*iface
)
469 IcoDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
470 ULONG ref
= InterlockedIncrement(&This
->ref
);
472 TRACE("(%p) refcount=%u\n", iface
, ref
);
477 static ULONG WINAPI
IcoDecoder_Release(IWICBitmapDecoder
*iface
)
479 IcoDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
480 ULONG ref
= InterlockedDecrement(&This
->ref
);
482 TRACE("(%p) refcount=%u\n", iface
, ref
);
486 This
->lock
.DebugInfo
->Spare
[0] = 0;
487 DeleteCriticalSection(&This
->lock
);
488 if (This
->stream
) IStream_Release(This
->stream
);
489 HeapFree(GetProcessHeap(), 0, This
);
495 static HRESULT WINAPI
IcoDecoder_QueryCapability(IWICBitmapDecoder
*iface
, IStream
*stream
,
500 TRACE("(%p,%p,%p)\n", iface
, stream
, capability
);
502 if (!stream
|| !capability
) return E_INVALIDARG
;
504 hr
= IWICBitmapDecoder_Initialize(iface
, stream
, WICDecodeMetadataCacheOnDemand
);
505 if (hr
!= S_OK
) return hr
;
507 *capability
= WICBitmapDecoderCapabilityCanDecodeAllImages
;
511 static HRESULT WINAPI
IcoDecoder_Initialize(IWICBitmapDecoder
*iface
, IStream
*pIStream
,
512 WICDecodeOptions cacheOptions
)
514 IcoDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
518 TRACE("(%p,%p,%x)\n", iface
, pIStream
, cacheOptions
);
520 EnterCriticalSection(&This
->lock
);
522 if (This
->initialized
)
524 hr
= WINCODEC_ERR_WRONGSTATE
;
529 hr
= IStream_Seek(pIStream
, seek
, STREAM_SEEK_SET
, NULL
);
530 if (FAILED(hr
)) goto end
;
532 hr
= IStream_Read(pIStream
, &This
->header
, sizeof(ICONHEADER
), &bytesread
);
533 if (FAILED(hr
)) goto end
;
534 if (bytesread
!= sizeof(ICONHEADER
) ||
535 This
->header
.idReserved
!= 0 ||
536 This
->header
.idType
!= 1)
542 This
->initialized
= TRUE
;
543 This
->stream
= pIStream
;
544 IStream_AddRef(pIStream
);
548 LeaveCriticalSection(&This
->lock
);
553 static HRESULT WINAPI
IcoDecoder_GetContainerFormat(IWICBitmapDecoder
*iface
,
554 GUID
*pguidContainerFormat
)
556 memcpy(pguidContainerFormat
, &GUID_ContainerFormatIco
, sizeof(GUID
));
560 static HRESULT WINAPI
IcoDecoder_GetDecoderInfo(IWICBitmapDecoder
*iface
,
561 IWICBitmapDecoderInfo
**ppIDecoderInfo
)
564 IWICComponentInfo
*compinfo
;
566 TRACE("(%p,%p)\n", iface
, ppIDecoderInfo
);
568 hr
= CreateComponentInfo(&CLSID_WICIcoDecoder
, &compinfo
);
569 if (FAILED(hr
)) return hr
;
571 hr
= IWICComponentInfo_QueryInterface(compinfo
, &IID_IWICBitmapDecoderInfo
,
572 (void**)ppIDecoderInfo
);
574 IWICComponentInfo_Release(compinfo
);
579 static HRESULT WINAPI
IcoDecoder_CopyPalette(IWICBitmapDecoder
*iface
,
580 IWICPalette
*pIPalette
)
582 TRACE("(%p,%p)\n", iface
, pIPalette
);
583 return WINCODEC_ERR_PALETTEUNAVAILABLE
;
586 static HRESULT WINAPI
IcoDecoder_GetMetadataQueryReader(IWICBitmapDecoder
*iface
,
587 IWICMetadataQueryReader
**ppIMetadataQueryReader
)
589 TRACE("(%p,%p)\n", iface
, ppIMetadataQueryReader
);
590 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
593 static HRESULT WINAPI
IcoDecoder_GetPreview(IWICBitmapDecoder
*iface
,
594 IWICBitmapSource
**ppIBitmapSource
)
596 TRACE("(%p,%p)\n", iface
, ppIBitmapSource
);
597 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
600 static HRESULT WINAPI
IcoDecoder_GetColorContexts(IWICBitmapDecoder
*iface
,
601 UINT cCount
, IWICColorContext
**ppIColorContexts
, UINT
*pcActualCount
)
603 TRACE("(%p,%u,%p,%p)\n", iface
, cCount
, ppIColorContexts
, pcActualCount
);
604 return WINCODEC_ERR_UNSUPPORTEDOPERATION
;
607 static HRESULT WINAPI
IcoDecoder_GetThumbnail(IWICBitmapDecoder
*iface
,
608 IWICBitmapSource
**ppIThumbnail
)
610 TRACE("(%p,%p)\n", iface
, ppIThumbnail
);
611 return WINCODEC_ERR_CODECNOTHUMBNAIL
;
614 static HRESULT WINAPI
IcoDecoder_GetFrameCount(IWICBitmapDecoder
*iface
,
617 IcoDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
619 if (!pCount
) return E_INVALIDARG
;
621 EnterCriticalSection(&This
->lock
);
622 *pCount
= This
->initialized
? This
->header
.idCount
: 0;
623 LeaveCriticalSection(&This
->lock
);
625 TRACE("(%p) <-- %d\n", iface
, *pCount
);
630 static HRESULT WINAPI
IcoDecoder_GetFrame(IWICBitmapDecoder
*iface
,
631 UINT index
, IWICBitmapFrameDecode
**ppIBitmapFrame
)
633 IcoDecoder
*This
= impl_from_IWICBitmapDecoder(iface
);
634 IcoFrameDecode
*result
=NULL
;
636 ULARGE_INTEGER offset
, length
;
640 IWICStream
*substream
=NULL
;
642 TRACE("(%p,%u,%p)\n", iface
, index
, ppIBitmapFrame
);
644 EnterCriticalSection(&This
->lock
);
646 if (!This
->initialized
)
648 hr
= WINCODEC_ERR_FRAMEMISSING
;
652 if (This
->header
.idCount
< index
)
658 result
= HeapAlloc(GetProcessHeap(), 0, sizeof(IcoFrameDecode
));
665 result
->IWICBitmapFrameDecode_iface
.lpVtbl
= &IcoFrameDecode_Vtbl
;
669 /* read the icon entry */
670 seek
.QuadPart
= sizeof(ICONHEADER
) + sizeof(ICONDIRENTRY
) * index
;
671 hr
= IStream_Seek(This
->stream
, seek
, STREAM_SEEK_SET
, 0);
672 if (FAILED(hr
)) goto fail
;
674 hr
= IStream_Read(This
->stream
, &entry
, sizeof(ICONDIRENTRY
), &bytesread
);
675 if (FAILED(hr
) || bytesread
!= sizeof(ICONDIRENTRY
)) goto fail
;
677 /* create a stream object for this icon */
678 hr
= StreamImpl_Create(&substream
);
679 if (FAILED(hr
)) goto fail
;
681 offset
.QuadPart
= entry
.dwDIBOffset
;
682 length
.QuadPart
= entry
.dwDIBSize
;
683 hr
= IWICStream_InitializeFromIStreamRegion(substream
, This
->stream
, offset
, length
);
684 if (FAILED(hr
)) goto fail
;
686 /* read the bitmapinfo size or magic number */
687 hr
= IWICStream_Read(substream
, &magic
, sizeof(magic
), &bytesread
);
688 if (FAILED(hr
) || bytesread
!= sizeof(magic
)) goto fail
;
690 /* forward to the appropriate decoding function based on the magic number */
693 case sizeof(BITMAPCOREHEADER
):
694 case 64: /* sizeof(BITMAPCOREHEADER2) */
695 case sizeof(BITMAPINFOHEADER
):
696 case sizeof(BITMAPV4HEADER
):
697 case sizeof(BITMAPV5HEADER
):
698 hr
= ReadIcoDib((IStream
*)substream
, result
);
701 hr
= ReadIcoPng((IStream
*)substream
, result
);
704 FIXME("Unrecognized ICO frame magic: %x\n", magic
);
708 if (FAILED(hr
)) goto fail
;
710 *ppIBitmapFrame
= &result
->IWICBitmapFrameDecode_iface
;
712 LeaveCriticalSection(&This
->lock
);
714 IWICStream_Release(substream
);
719 LeaveCriticalSection(&This
->lock
);
720 HeapFree(GetProcessHeap(), 0, result
);
721 if (substream
) IWICStream_Release(substream
);
722 if (SUCCEEDED(hr
)) hr
= E_FAIL
;
723 TRACE("<-- %x\n", hr
);
727 static const IWICBitmapDecoderVtbl IcoDecoder_Vtbl
= {
728 IcoDecoder_QueryInterface
,
731 IcoDecoder_QueryCapability
,
732 IcoDecoder_Initialize
,
733 IcoDecoder_GetContainerFormat
,
734 IcoDecoder_GetDecoderInfo
,
735 IcoDecoder_CopyPalette
,
736 IcoDecoder_GetMetadataQueryReader
,
737 IcoDecoder_GetPreview
,
738 IcoDecoder_GetColorContexts
,
739 IcoDecoder_GetThumbnail
,
740 IcoDecoder_GetFrameCount
,
744 HRESULT
IcoDecoder_CreateInstance(IUnknown
*pUnkOuter
, REFIID iid
, void** ppv
)
749 TRACE("(%p,%s,%p)\n", pUnkOuter
, debugstr_guid(iid
), ppv
);
753 if (pUnkOuter
) return CLASS_E_NOAGGREGATION
;
755 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(IcoDecoder
));
756 if (!This
) return E_OUTOFMEMORY
;
758 This
->IWICBitmapDecoder_iface
.lpVtbl
= &IcoDecoder_Vtbl
;
761 This
->initialized
= FALSE
;
762 InitializeCriticalSection(&This
->lock
);
763 This
->lock
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": IcoDecoder.lock");
765 ret
= IWICBitmapDecoder_QueryInterface(&This
->IWICBitmapDecoder_iface
, iid
, ppv
);
766 IWICBitmapDecoder_Release(&This
->IWICBitmapDecoder_iface
);