Commit 62df608d authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

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

parent c4773e18
...@@ -203,6 +203,17 @@ static HBITMAP create_alpha_bitmap( HBITMAP hbitmap ) ...@@ -203,6 +203,17 @@ static HBITMAP create_alpha_bitmap( HBITMAP hbitmap )
DeleteObject( alpha ); DeleteObject( alpha );
alpha = 0; 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 ); DeleteDC( hdc );
......
...@@ -165,7 +165,6 @@ static void test_image(HBITMAP image, BOOL is_dib, BOOL is_premult, BOOL is_alph ...@@ -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"); ok(bm.bmBits != NULL, "bmBits is NULL\n");
memcpy(bits, bm.bmBits, 4); memcpy(bits, bm.bmBits, 4);
if (is_premult) if (is_premult)
todo_wine
ok(bits[0] == 0x05 && bits[1] == 0x09 && bits[2] == 0x0e && bits[3] == 0x44, 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]); "bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]);
else if (is_alpha) else if (is_alpha)
...@@ -195,7 +194,6 @@ static void test_image(HBITMAP image, BOOL is_dib, BOOL is_premult, BOOL is_alph ...@@ -195,7 +194,6 @@ static void test_image(HBITMAP image, BOOL is_dib, BOOL is_premult, BOOL is_alph
DeleteDC(hdc); DeleteDC(hdc);
if (is_premult) if (is_premult)
todo_wine
ok(bits[0] == 0x05 && bits[1] == 0x09 && bits[2] == 0x0e && bits[3] == 0x44, 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]); "bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]);
else if (is_alpha) else if (is_alpha)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment