Jinoh Kang : comctl32: Pre-multiply static control bitmap image by alpha for GdiAlphaBlend.
Alexandre Julliard
julliard at winehq.org
Wed Mar 16 16:48:24 CDT 2022
Module: wine
Branch: master
Commit: 62df608d3ed84aac7ce517fd07ea13e48b49b08c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=62df608d3ed84aac7ce517fd07ea13e48b49b08c
Author: Jinoh Kang <jinoh.kang.kr at gmail.com>
Date: Tue Mar 15 03:35:12 2022 +0900
comctl32: Pre-multiply static control bitmap image by alpha for GdiAlphaBlend.
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/static.c | 11 +++++++++++
dlls/comctl32/tests/static.c | 2 --
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/static.c b/dlls/comctl32/static.c
index 7a3ac958111..9b20e6a8b66 100644
--- a/dlls/comctl32/static.c
+++ b/dlls/comctl32/static.c
@@ -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 );
diff --git a/dlls/comctl32/tests/static.c b/dlls/comctl32/tests/static.c
index b8f43142d6b..7b6ac679c92 100644
--- a/dlls/comctl32/tests/static.c
+++ b/dlls/comctl32/tests/static.c
@@ -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)
More information about the wine-cvs
mailing list