wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / windowscodecs / main.c
blob4908a5f77e1579b5c4d85ff4ba1a370802ea98e0
1 /*
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
20 #define COBJMACROS
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winternl.h"
27 #include "objbase.h"
29 #include "wincodecs_private.h"
31 #include "wine/debug.h"
33 extern BOOL WINAPI WIC_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
35 HMODULE windowscodecs_module = 0;
37 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
40 switch (fdwReason)
42 case DLL_PROCESS_ATTACH:
43 DisableThreadLibraryCalls(hinstDLL);
44 windowscodecs_module = hinstDLL;
45 break;
46 case DLL_PROCESS_DETACH:
47 ReleaseComponentInfos();
48 break;
51 return WIC_DllMain(hinstDLL, fdwReason, lpvReserved);
54 HRESULT WINAPI DllCanUnloadNow(void)
56 return S_FALSE;
59 HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
61 HRESULT hr;
62 IWICComponentInfo *info;
63 IWICPixelFormatInfo *formatinfo;
65 hr = CreateComponentInfo(pixelformat, &info);
66 if (SUCCEEDED(hr))
68 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void**)&formatinfo);
70 if (SUCCEEDED(hr))
72 hr = IWICPixelFormatInfo_GetBitsPerPixel(formatinfo, bpp);
74 IWICPixelFormatInfo_Release(formatinfo);
77 IWICComponentInfo_Release(info);
80 return hr;
83 HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv)
85 HRESULT hr;
86 struct decoder *decoder;
87 struct decoder_info decoder_info;
89 hr = get_unix_decoder(&CLSID_WICTiffDecoder, &decoder_info, &decoder);
91 if (SUCCEEDED(hr))
92 hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, ppv);
94 return hr;
97 HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv)
99 HRESULT hr;
100 struct encoder *encoder;
101 struct encoder_info encoder_info;
103 hr = get_unix_encoder(&CLSID_WICTiffEncoder, &encoder_info, &encoder);
105 if (SUCCEEDED(hr))
106 hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
108 return hr;
111 HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv)
113 HRESULT hr;
114 struct decoder *decoder;
115 struct decoder_info decoder_info;
117 hr = get_unix_decoder(&CLSID_WICJpegDecoder, &decoder_info, &decoder);
119 if (SUCCEEDED(hr))
120 hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, ppv);
122 return hr;
125 HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv)
127 HRESULT hr;
128 struct encoder *encoder;
129 struct encoder_info encoder_info;
131 hr = get_unix_encoder(&CLSID_WICJpegEncoder, &encoder_info, &encoder);
133 if (SUCCEEDED(hr))
134 hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
136 return hr;
139 HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv)
141 HRESULT hr;
142 struct encoder *encoder;
143 struct encoder_info encoder_info;
145 hr = get_unix_encoder(&CLSID_WICIcnsEncoder, &encoder_info, &encoder);
147 if (SUCCEEDED(hr))
148 hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
150 return hr;