MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / _GetWIC

Function _GetWIC

SampleFramework11/v1.02/Graphics/WICTextureLoader.cpp:172–226  ·  view source on GitHub ↗

--------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

170
171//--------------------------------------------------------------------------------------
172static IWICImagingFactory* _GetWIC()
173{
174 static IWICImagingFactory* s_Factory = nullptr;
175
176 if ( s_Factory )
177 return s_Factory;
178
179#if(_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE)
180 HRESULT hr = CoCreateInstance(
181 CLSID_WICImagingFactory2,
182 nullptr,
183 CLSCTX_INPROC_SERVER,
184 __uuidof(IWICImagingFactory2),
185 (LPVOID*)&s_Factory
186 );
187
188 if ( SUCCEEDED(hr) )
189 {
190 // WIC2 is available on Windows 8 and Windows 7 SP1 with KB 2670838 installed
191 g_WIC2 = true;
192 }
193 else
194 {
195 hr = CoCreateInstance(
196 CLSID_WICImagingFactory1,
197 nullptr,
198 CLSCTX_INPROC_SERVER,
199 __uuidof(IWICImagingFactory),
200 (LPVOID*)&s_Factory
201 );
202
203 if ( FAILED(hr) )
204 {
205 s_Factory = nullptr;
206 return nullptr;
207 }
208 }
209#else
210 HRESULT hr = CoCreateInstance(
211 CLSID_WICImagingFactory,
212 nullptr,
213 CLSCTX_INPROC_SERVER,
214 __uuidof(IWICImagingFactory),
215 (LPVOID*)&s_Factory
216 );
217
218 if ( FAILED(hr) )
219 {
220 s_Factory = nullptr;
221 return nullptr;
222 }
223#endif
224
225 return s_Factory;
226}
227
228//---------------------------------------------------------------------------------
229static DXGI_FORMAT _WICToDXGI( const GUID& guid )

Callers 4

_WICBitsPerPixelFunction · 0.85
CreateTextureFromWICFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected