HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) { PngDecoder *This; HRESULT ret; TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; if (!libpng_handle && !load_libpng()) { ERR("Failed reading PNG because unable to find %s\n",SONAME_LIBPNG); return E_FAIL; } This = HeapAlloc(GetProcessHeap(), 0, sizeof(PngDecoder)); if (!This) return E_OUTOFMEMORY; This->IWICBitmapDecoder_iface.lpVtbl = &PngDecoder_Vtbl; This->IWICBitmapFrameDecode_iface.lpVtbl = &PngDecoder_FrameVtbl; This->IWICMetadataBlockReader_iface.lpVtbl = &PngDecoder_BlockVtbl; This->ref = 1; This->png_ptr = NULL; This->info_ptr = NULL; This->end_info = NULL; This->initialized = FALSE; This->image_bits = NULL; InitializeCriticalSection(&This->lock); This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PngDecoder.lock"); ret = IWICBitmapDecoder_QueryInterface(&This->IWICBitmapDecoder_iface, iid, ppv); IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface); return ret; }
HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) { JpegDecoder *This; HRESULT ret; TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); if (!libjpeg_handle && !load_libjpeg()) { ERR("Failed reading JPEG because unable to find %s\n", SONAME_LIBJPEG); return E_FAIL; } *ppv = NULL; This = HeapAlloc(GetProcessHeap(), 0, sizeof(JpegDecoder)); if (!This) return E_OUTOFMEMORY; This->IWICBitmapDecoder_iface.lpVtbl = &JpegDecoder_Vtbl; This->IWICBitmapFrameDecode_iface.lpVtbl = &JpegDecoder_Frame_Vtbl; This->ref = 1; This->initialized = FALSE; This->cinfo_initialized = FALSE; This->stream = NULL; This->image_data = NULL; InitializeCriticalSection(&This->lock); This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JpegDecoder.lock"); ret = IWICBitmapDecoder_QueryInterface(&This->IWICBitmapDecoder_iface, iid, ppv); IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface); return ret; }