d2d1: Use newer blend options in d2d_device_context_SetTarget() for bitmaps of D2D1_ALPHA_MODE_IGNORE.

When bitmap alpha mode is D2D1_ALPHA_MODE_IGNORE, D3D11_BLEND_ZERO is used for SrcBlendAlpha and
D3D11_BLEND_ONE for DestBlendAlpha on Win7. However, tests show that D3D11_BLEND_ONE is used for
SrcBlendAlpha and D3D11_BLEND_INV_SRC_ALPHA for DestBlendAlpha on Win8+. The patch changes
d2d_device_context_SetTarget() to use the Win8+ behaviour.

Fix PowerPoint 2016 slideshow artifacts.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2022-03-11 14:31:55 +08:00 committed by Alexandre Julliard
parent fe4c187a7c
commit 6556ed2058
2 changed files with 2 additions and 11 deletions

View File

@ -2069,16 +2069,8 @@ static void STDMETHODCALLTYPE d2d_device_context_SetTarget(ID2D1DeviceContext *i
blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
blend_desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
if (context->desc.pixelFormat.alphaMode == D2D1_ALPHA_MODE_IGNORE)
{
blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO;
blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
}
else
{
blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
}
blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blend_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
if (FAILED(hr = ID3D11Device1_CreateBlendState(context->d3d_device, &blend_desc, &context->bs)))

View File

@ -4585,7 +4585,6 @@ static void test_alpha_mode(BOOL d3d11)
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
match = compare_surface(&ctx, "e7ee77e89745fa5d195fd78bd398738330cfcde8");
match2 = compare_surface(&ctx, "4855c7c082c8ede364cf6e2dcde83f95b88aecbe");
todo_wine
ok(match || broken(match2) /* Win7 TestBots */, "Surface does not match.\n");
IDXGISurface_Release(ctx.surface);
ctx.surface = surface;