From: Zhiyi Zhang <zzhang@codeweavers.com> Some applications call DrawBitmap() with the opacity value set to 255.0f and end up showing white in the end result. Tests show that the opacity value should be clamped to legitimate values. Command lists store the original opacity value according to tests. --- dlls/d2d1/device.c | 2 +- dlls/d2d1/tests/d2d1.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index 74607dc8ea4..9476341f061 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1226,7 +1226,7 @@ static void d2d_device_context_draw_bitmap(struct d2d_device_context *context, I bitmap_brush_desc.extendModeY = D2D1_EXTEND_MODE_CLAMP; bitmap_brush_desc.interpolationMode = interpolation_mode; - brush_desc.opacity = opacity; + brush_desc.opacity = max(0.0f, min(opacity, 1.0f)); brush_desc.transform._11 = fabsf((d.right - d.left) / (s.right - s.left)); brush_desc.transform._21 = 0.0f; brush_desc.transform._31 = min(d.left, d.right) - min(s.left, s.right) * brush_desc.transform._11; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index f85c65ad9c3..aabfdc7d7dd 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -3159,7 +3159,6 @@ static void test_bitmap_brush(BOOL d3d11) get_surface_readback(&ctx, &rb); colour = get_readback_colour(&rb, 0, 0); - todo_wine ok(compare_colour(colour, 0xff7f0000, 1), "Got unexpected colour 0x%08lx.\n", colour); colour = get_readback_colour(&rb, 1, 0); ok(compare_colour(colour, 0xff010000, 1), "Got unexpected colour 0x%08lx.\n", colour); @@ -3180,7 +3179,6 @@ static void test_bitmap_brush(BOOL d3d11) get_surface_readback(&ctx, &rb); colour = get_readback_colour(&rb, 0, 0); - todo_wine ok(compare_colour(colour, 0xff7f0000, 1), "Got unexpected colour 0x%08lx.\n", colour); colour = get_readback_colour(&rb, 1, 0); ok(compare_colour(colour, 0xff010000, 1), "Got unexpected colour 0x%08lx.\n", colour); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10162