Alexandre Julliard : gdi32: Map the black and white entries to the DIB color table after dithering.
Alexandre Julliard
julliard at winehq.org
Thu Mar 9 15:51:34 CST 2017
Module: wine
Branch: master
Commit: 059170208af8c822e812dc1e58d60c3c5f1c7ebb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=059170208af8c822e812dc1e58d60c3c5f1c7ebb
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Mar 9 12:30:20 2017 +0100
gdi32: Map the black and white entries to the DIB color table after dithering.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/dibdrv/primitives.c | 14 +++++++++-----
dlls/gdi32/tests/dib.c | 4 ++--
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c
index e740ef8..a99fcab 100644
--- a/dlls/gdi32/dibdrv/primitives.c
+++ b/dlls/gdi32/dibdrv/primitives.c
@@ -2141,12 +2141,16 @@ static DWORD rgb_to_pixel_mono(const dib_info *dib, BOOL dither, int x, int y,
{
DWORD ret;
- if (dither)
- ret = ((30 * r + 59 * g + 11 * b) / 100 + bayer_16x16[y % 16][x % 16]) > 255;
- else if (dib->color_table_size == 1)
- ret = (src_pixel == bg_pixel);
- else
+ if (dib->color_table_size != 1)
+ {
+ if (dither)
+ {
+ if (((30 * r + 59 * g + 11 * b) / 100 + bayer_16x16[y % 16][x % 16]) > 255) r = g = b = 255;
+ else r = g = b = 0;
+ }
ret = rgb_to_pixel_colortable( dib, r, g, b );
+ }
+ else ret = (src_pixel == bg_pixel); /* only match raw pixel value */
return ret ? 0xff : 0;
}
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c
index 188001e..4bf64aa 100644
--- a/dlls/gdi32/tests/dib.c
+++ b/dlls/gdi32/tests/dib.c
@@ -1880,7 +1880,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
if (bmi->bmiHeader.biBitCount == 8 && bmi->bmiHeader.biClrUsed == 256) /* 8-bpp grayscale broken on NT4 */
compare_hash_broken_todo(hdc, bmi, bits, "bottom-up 8888 dib brush patblt", 1, FALSE);
else
- compare_hash_broken_todo(hdc, bmi, bits, "bottom-up 8888 dib brush patblt", dib_is_1bpp ? 2 : 0, dib_is_1bpp);
+ compare_hash_broken_todo(hdc, bmi, bits, "bottom-up 8888 dib brush patblt", dib_is_1bpp ? 2 : 0, FALSE);
SelectObject(hdc, orig_brush);
DeleteObject(dib_brush);
@@ -1910,7 +1910,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
if (bmi->bmiHeader.biBitCount == 8 && bmi->bmiHeader.biClrUsed == 256) /* 8-bpp grayscale broken on NT4 */
compare_hash_broken_todo(hdc, bmi, bits, "top-down 24 bpp brush patblt", 1, FALSE);
else
- compare_hash_broken_todo(hdc, bmi, bits, "top-down 24 bpp brush patblt", dib_is_1bpp ? 2 : 0, dib_is_1bpp);
+ compare_hash_broken_todo(hdc, bmi, bits, "top-down 24 bpp brush patblt", dib_is_1bpp ? 2 : 0, FALSE);
SelectObject(hdc, orig_brush);
DeleteObject(dib_brush);
More information about the wine-cvs
mailing list