mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 05:49:49 +00:00
d2d1: Derive bitmap options from surface description in CreateBitmapFromDxgiSurface().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
828a7aa071
commit
08be8fd5ab
|
@ -495,6 +495,30 @@ HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size,
|
|||
return *bitmap ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
unsigned int d2d_get_bitmap_options_for_surface(IDXGISurface *surface)
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
unsigned int options = 0;
|
||||
ID3D11Texture2D *texture;
|
||||
|
||||
if (FAILED(IDXGISurface_QueryInterface(surface, &IID_ID3D11Texture2D, (void **)&texture)))
|
||||
return 0;
|
||||
|
||||
ID3D11Texture2D_GetDesc(texture, &desc);
|
||||
ID3D11Texture2D_Release(texture);
|
||||
|
||||
if (desc.BindFlags & D3D11_BIND_RENDER_TARGET)
|
||||
options |= D2D1_BITMAP_OPTIONS_TARGET;
|
||||
if (!(desc.BindFlags & D3D11_BIND_SHADER_RESOURCE))
|
||||
options |= D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
|
||||
if (desc.MiscFlags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE)
|
||||
options |= D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE;
|
||||
if (desc.Usage == D3D11_USAGE_STAGING && desc.CPUAccessFlags & D3D11_CPU_ACCESS_READ)
|
||||
options |= D2D1_BITMAP_OPTIONS_CPU_READ;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, void *data,
|
||||
const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap)
|
||||
{
|
||||
|
|
|
@ -409,6 +409,7 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid,
|
|||
const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
|
||||
HRESULT d2d_bitmap_create_from_wic_bitmap(struct d2d_device_context *context, IWICBitmapSource *bitmap_source,
|
||||
const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) DECLSPEC_HIDDEN;
|
||||
unsigned int d2d_get_bitmap_options_for_surface(IDXGISurface *surface) DECLSPEC_HIDDEN;
|
||||
struct d2d_bitmap *unsafe_impl_from_ID2D1Bitmap(ID2D1Bitmap *iface) DECLSPEC_HIDDEN;
|
||||
|
||||
struct d2d_state_block
|
||||
|
|
|
@ -1876,7 +1876,7 @@ static HRESULT STDMETHODCALLTYPE d2d_device_context_CreateBitmapFromDxgiSurface(
|
|||
memset(&bitmap_desc, 0, sizeof(bitmap_desc));
|
||||
bitmap_desc.pixelFormat.format = surface_desc.Format;
|
||||
bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
|
||||
bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW;
|
||||
bitmap_desc.bitmapOptions = d2d_get_bitmap_options_for_surface(surface);
|
||||
desc = &bitmap_desc;
|
||||
}
|
||||
|
||||
|
|
|
@ -11782,7 +11782,6 @@ static void test_bitmap_map(BOOL d3d11)
|
|||
hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, NULL, &bitmap);
|
||||
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
||||
options = ID2D1Bitmap1_GetOptions(bitmap);
|
||||
todo_wine
|
||||
ok(options == (D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ),
|
||||
"Unexpected options %#x.\n", options);
|
||||
ID2D1Bitmap1_Release(bitmap);
|
||||
|
|
Loading…
Reference in a new issue