[PATCH 3/5] d2d1: Use newer blend options in d2d_device_context_SetTarget() for bitmaps of D2D1_ALPHA_MODE_IGNORE.

Zhiyi Zhang zzhang at codeweavers.com
Fri Mar 11 00:31:55 CST 2022


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 at codeweavers.com>
---
 dlls/d2d1/device.c     | 12 ++----------
 dlls/d2d1/tests/d2d1.c |  1 -
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c
index 47da411f3b6..ea38ca41c8c 100644
--- a/dlls/d2d1/device.c
+++ b/dlls/d2d1/device.c
@@ -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)))
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 7c54f365e06..d1e8b97ed7d 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -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;
-- 
2.32.0




More information about the wine-devel mailing list