Gabriel Ivăncescu : comctl32: Remove the masked background when 32bpp bitmaps have no alpha values.
Alexandre Julliard
julliard at winehq.org
Wed Jan 6 15:43:49 CST 2021
Module: wine
Branch: master
Commit: 4ac05afd39aff3030e3379ee06e32d6544ef5d62
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4ac05afd39aff3030e3379ee06e32d6544ef5d62
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Tue Jan 5 19:53:18 2021 +0200
comctl32: Remove the masked background when 32bpp bitmaps have no alpha values.
Fixes a regression introduced by 61b9209221d28d5d02379791ac1316c1fc2ca3b7.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50454
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/imagelist.c | 7 +++++++
dlls/comctl32/tests/imagelist.c | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index a6d9c73c49b..307ccc0336c 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -234,6 +234,13 @@ static void add_dib_bits( HIMAGELIST himl, int pos, int count, int width, int he
mask_bits[i * mask_stride + j / 8] |= 0x80 >> (j % 8);
}
}
+ else if (mask_info) /* mask out the background */
+ {
+ for (i = 0; i < height; i++)
+ for (j = n * width; j < (n + 1) * width; j++)
+ if ((mask_bits[i * mask_stride + j / 8] << (j % 8)) & 0x80)
+ bits[i * stride + j] = 0;
+ }
StretchDIBits( himl->hdcImage, pt.x, pt.y, himl->cx, himl->cy,
n * width, 0, width, height, bits, info, DIB_RGB_COLORS, SRCCOPY );
if (mask_info)
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index c74acb2a215..ed9b1cc97f2 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -2436,7 +2436,7 @@ static void test_alpha(void)
/* If all alpha values are zero, the image is considered to have no alpha and gets masked */
if (!GetAValue(bits[0]) && !GetAValue(bits[1]))
- todo_wine ok(!bits[0] && bits[1] == test_bitmaps[i + 1],
+ ok(!bits[0] && bits[1] == test_bitmaps[i + 1],
"Bitmap [%08X, %08X] returned [%08X, %08X], expected [%08X, %08X]\n",
test_bitmaps[i], test_bitmaps[i + 1], bits[0], bits[1], 0, test_bitmaps[i + 1]);
else
More information about the wine-cvs
mailing list