Commit 225daac8 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

d2d1: Use D2D1_ALPHA_MODE_IGNORE if D2D1_ALPHA_MODE_UNKNOWN is used for creating…

d2d1: Use D2D1_ALPHA_MODE_IGNORE if D2D1_ALPHA_MODE_UNKNOWN is used for creating hwnd render targets. Also, alpha mode should not be overwritten with D2D1_ALPHA_MODE_IGNORE just because DXGI_FORMAT_UNKNOWN is specified.
parent 1e4d3119
......@@ -835,10 +835,10 @@ HRESULT d2d_hwnd_render_target_init(struct d2d_hwnd_render_target *render_target
ID2D1Factory1_GetDesktopDpi(factory, &dxgi_rt_desc.dpiX, &dxgi_rt_desc.dpiY);
if (dxgi_rt_desc.pixelFormat.format == DXGI_FORMAT_UNKNOWN)
{
dxgi_rt_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
if (dxgi_rt_desc.pixelFormat.alphaMode == D2D1_ALPHA_MODE_UNKNOWN)
dxgi_rt_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE;
}
swapchain_desc.BufferDesc.Width = hwnd_rt_desc->pixelSize.width;
swapchain_desc.BufferDesc.Height = hwnd_rt_desc->pixelSize.height;
......
......@@ -6088,15 +6088,14 @@ static void test_hwnd_target(BOOL d3d11)
D2D1_PIXEL_FORMAT format;
D2D1_PIXEL_FORMAT expected_format;
BOOL expected_failure;
BOOL todo;
}
format_tests[] =
{
{{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
{{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}, FALSE, TRUE},
{{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}},
{{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT}, TRUE},
{{DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
{{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}, FALSE, TRUE},
{{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
{{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED}},
{{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT}, TRUE},
{{DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}, {DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE}},
......@@ -6172,7 +6171,6 @@ static void test_hwnd_target(BOOL d3d11)
pixel_format = ID2D1HwndRenderTarget_GetPixelFormat(rt);
ok(pixel_format.format == format_tests[i].expected_format.format,
"Got unexpected format %#x.\n", pixel_format.format);
todo_wine_if(format_tests[i].todo)
ok(pixel_format.alphaMode == format_tests[i].expected_format.alphaMode,
"Got unexpected alpha mode %d.\n", pixel_format.alphaMode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment