154{
160
162
164 {
165 WARN(
"Failed to get bitmap dimensions, hr %#lx.\n",
hr);
167 }
168
173
174 texture_desc.
Format =
desc->pixelFormat.format;
176 {
178
179 if (
FAILED(
hr = IWICBitmap_GetPixelFormat(
bitmap, &bitmap_format)))
180 {
181 WARN(
"Failed to get bitmap format, hr %#lx.\n",
hr);
183 }
184
185 if (
IsEqualGUID(&bitmap_format, &GUID_WICPixelFormat32bppPBGRA)
186 ||
IsEqualGUID(&bitmap_format, &GUID_WICPixelFormat32bppBGR))
187 {
189 }
190 else if (
IsEqualGUID(&bitmap_format, &GUID_WICPixelFormat32bppPRGBA)
191 ||
IsEqualGUID(&bitmap_format, &GUID_WICPixelFormat32bppRGB))
192 {
194 }
195 else
196 {
199 }
200 }
201
202 switch (texture_desc.
Format)
203 {
206 render_target->
bpp = 4;
207 break;
208
209 default:
210 FIXME(
"Unhandled format %#x.\n", texture_desc.
Format);
212 }
213
221
223 {
224 WARN(
"Failed to create texture, hr %#lx.\n",
hr);
226 }
227
228 hr = ID3D10Texture2D_QueryInterface(
texture, &IID_IDXGISurface, (
void **)&render_target->
dxgi_surface);
229 ID3D10Texture2D_Release(
texture);
231 {
232 WARN(
"Failed to get DXGI surface interface, hr %#lx.\n",
hr);
234 }
235
240
242 {
243 WARN(
"Failed to create readback texture, hr %#lx.\n",
hr);
246 }
247
249 {
250 WARN(
"Failed to get DXGI device, hr %#lx.\n",
hr);
253 }
254
258 {
259 WARN(
"Failed to create D2D device, hr %#lx.\n",
hr);
262 }
263
267 ID2D1Device_Release(
device);
269 {
270 WARN(
"Failed to create DXGI surface render target, hr %#lx.\n",
hr);
274 }
275
277 &IID_ID2D1RenderTarget, (
void **)&render_target->
dxgi_target)))
278 {
279 WARN(
"Failed to retrieve ID2D1RenderTarget interface, hr %#lx.\n",
hr);
284 }
285
287 IWICBitmap_AddRef(
bitmap);
288
290}
@ D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE
struct d2d_device * unsafe_impl_from_ID2D1Device(ID2D1Device1 *iface)
HRESULT d2d_d3d_create_render_target(struct d2d_device *device, IDXGISurface *surface, IUnknown *outer_unknown, const struct d2d_device_context_ops *ops, const D2D1_RENDER_TARGET_PROPERTIES *desc, void **render_target)
HRESULT d2d_factory_create_device(ID2D1Factory1 *factory, IDXGIDevice *dxgi_device, bool allow_get_dxgi_device, REFIID iid, void **device)
#define D2DERR_UNSUPPORTED_PIXEL_FORMAT
@ D3D10_RESOURCE_MISC_GDI_COMPATIBLE
@ D3D10_BIND_SHADER_RESOURCE
@ D3D10_BIND_RENDER_TARGET
D3D11_SHADER_VARIABLE_DESC desc
#define IsEqualGUID(rguid1, rguid2)
DXGI_SAMPLE_DESC SampleDesc
ID3D10Texture2D * readback_texture
ID2D1RenderTarget * dxgi_target
IDXGISurface * dxgi_surface
static const struct IUnknownVtbl d2d_wic_render_target_vtbl
static const struct d2d_device_context_ops d2d_wic_render_target_ops