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/brush.c | 2 +- dlls/d2d1/tests/d2d1.c | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 50754a2f21a..ea09e6eebbd 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -1385,7 +1385,7 @@ BOOL d2d_brush_fill_cb(const struct d2d_brush *brush, struct d2d_brush_cb *cb) } cb->type = brush->type; - cb->opacity = brush->opacity; + cb->opacity = max(0.0f, min(brush->opacity, 1.0f)); switch (brush->type) { diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 51b0fa856a9..2d64e8440f4 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -2543,7 +2543,6 @@ static void test_color_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); @@ -2969,7 +2968,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); @@ -2990,7 +2988,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); @@ -3020,7 +3017,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