comctl32: Pre-multiply static control bitmap image by alpha for GdiAlphaBlend.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jinoh Kang 2022-03-15 03:35:12 +09:00 committed by Alexandre Julliard
parent c4773e1823
commit 62df608d3e
2 changed files with 11 additions and 2 deletions

View File

@ -203,6 +203,17 @@ static HBITMAP create_alpha_bitmap( HBITMAP hbitmap )
DeleteObject( alpha );
alpha = 0;
}
else
{
/* pre-multiply by alpha */
for (i = 0, ptr = bits; i < bm.bmWidth * bm.bmHeight; i++, ptr += 4)
{
unsigned int alpha = ptr[3];
ptr[0] = (ptr[0] * alpha + 127) / 255;
ptr[1] = (ptr[1] * alpha + 127) / 255;
ptr[2] = (ptr[2] * alpha + 127) / 255;
}
}
}
DeleteDC( hdc );

View File

@ -165,7 +165,6 @@ static void test_image(HBITMAP image, BOOL is_dib, BOOL is_premult, BOOL is_alph
ok(bm.bmBits != NULL, "bmBits is NULL\n");
memcpy(bits, bm.bmBits, 4);
if (is_premult)
todo_wine
ok(bits[0] == 0x05 && bits[1] == 0x09 && bits[2] == 0x0e && bits[3] == 0x44,
"bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]);
else if (is_alpha)
@ -195,7 +194,6 @@ static void test_image(HBITMAP image, BOOL is_dib, BOOL is_premult, BOOL is_alph
DeleteDC(hdc);
if (is_premult)
todo_wine
ok(bits[0] == 0x05 && bits[1] == 0x09 && bits[2] == 0x0e && bits[3] == 0x44,
"bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]);
else if (is_alpha)