Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/gdi32/tests/dib.c | 45 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c index d16cb0df5c0..8ad4a41e57a 100644 --- a/dlls/gdi32/tests/dib.c +++ b/dlls/gdi32/tests/dib.c @@ -3007,7 +3007,7 @@ static inline COLORREF aa_colorref( COLORREF dst, COLORREF text, BYTE glyph )
static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
-static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa ) +static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BYTE quality, BOOL expected_aa ) { DWORD dib_size = get_dib_size(bmi), ret; LOGFONTA lf; @@ -3029,7 +3029,7 @@ static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa ) memset( &lf, 0, sizeof(lf) ); strcpy( lf.lfFaceName, "Tahoma" ); lf.lfHeight = 24; - lf.lfQuality = aa ? ANTIALIASED_QUALITY : NONANTIALIASED_QUALITY; + lf.lfQuality = quality;
font = CreateFontIndirectA( &lf ); font = SelectObject( hdc, font ); @@ -3054,12 +3054,12 @@ static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa ) for(i = 0; i < dib_size; i++) bits[i] = vals[i % 4];
- if (bmi->bmiHeader.biBitCount <= 8) aa = FALSE; + if (bmi->bmiHeader.biBitCount <= 8) expected_aa = FALSE;
text_color = GetTextColor( hdc ); for (i = 0; i < strlen(str); i++) { - DWORD ggo_flags = aa ? GGO_GRAY4_BITMAP : GGO_BITMAP; + DWORD ggo_flags = expected_aa ? GGO_GRAY4_BITMAP : GGO_BITMAP;
ret = GetGlyphOutlineA( hdc, str[i], ggo_flags, &gm, 0, NULL, &identity );
@@ -3075,7 +3075,7 @@ static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa )
if (!ret) continue;
- if (aa) + if (expected_aa) { stride = (gm.gmBlackBoxX + 3) & ~3;
@@ -3114,7 +3114,7 @@ static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa ) }
diy_hash = hash_dib( hdc, bmi, bits ); - ok( !strcmp( eto_hash, diy_hash ), "hash mismatch - aa %d\n", aa ); + ok( !strcmp( eto_hash, diy_hash ), "hash mismatch - quality %#x, expected_aa %d\n", quality, expected_aa );
HeapFree( GetProcessHeap(), 0, diy_hash ); HeapFree( GetProcessHeap(), 0, eto_hash ); @@ -3125,14 +3125,43 @@ static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa )
static void draw_text( HDC hdc, const BITMAPINFO *bmi, BYTE *bits ) { - draw_text_2( hdc, bmi, bits, FALSE ); + UINT smoothing, type; + BOOL ret; + + draw_text_2( hdc, bmi, bits, NONANTIALIASED_QUALITY, FALSE ); + + ret = SystemParametersInfoA(SPI_GETFONTSMOOTHING, 0, &smoothing, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError()); + + ret = SystemParametersInfoA(SPI_SETFONTSMOOTHING, 0, NULL, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError()); + draw_text_2( hdc, bmi, bits, DEFAULT_QUALITY, FALSE );
/* Rounding errors make these cases hard to test */ if ((bmi->bmiHeader.biCompression == BI_BITFIELDS && ((DWORD*)bmi->bmiColors)[0] == 0x3f000) || (bmi->bmiHeader.biBitCount == 16)) + { + ret = SystemParametersInfoA(SPI_SETFONTSMOOTHING, smoothing, NULL, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError()); return; + } + + ret = SystemParametersInfoA(SPI_SETFONTSMOOTHING, 1, NULL, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError()); + ret = SystemParametersInfoA(SPI_GETFONTSMOOTHINGTYPE, 0, &type, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError()); + ret = SystemParametersInfoA(SPI_SETFONTSMOOTHINGTYPE, 0, (void *)FE_FONTSMOOTHINGSTANDARD, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError()); + + draw_text_2( hdc, bmi, bits, DEFAULT_QUALITY, TRUE ); + + ret = SystemParametersInfoA(SPI_SETFONTSMOOTHINGTYPE, 0, (void *)type, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError()); + + ret = SystemParametersInfoA(SPI_SETFONTSMOOTHING, smoothing, NULL, 0); + ok(ret, "SystemParametersInfoA failed, GetLastError() %u.\n", GetLastError());
- draw_text_2( hdc, bmi, bits, TRUE ); + draw_text_2( hdc, bmi, bits, ANTIALIASED_QUALITY, TRUE ); }
static void test_simple_graphics(void)