From dbfbce975d6d8aeefc045cc58c48fd2a9295e930 Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Mon, 13 Apr 2009 19:22:34 +0200 Subject: [PATCH] user32: When repainting a static control with SS_BITMAP style, do not erase the background if there is no valid bitmap to paint. --- dlls/user32/static.c | 6 ------ dlls/user32/tests/static.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/user32/static.c b/dlls/user32/static.c index 4e8091bda5a..69acbc52c87 100644 --- a/dlls/user32/static.c +++ b/dlls/user32/static.c @@ -874,12 +874,6 @@ static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style ) SelectObject(hMemDC, oldbitmap); DeleteDC(hMemDC); } - else - { - RECT rcClient; - GetClientRect( hwnd, &rcClient ); - FillRect( hdc, &rcClient, hbrush ); - } } diff --git a/dlls/user32/tests/static.c b/dlls/user32/tests/static.c index 6a474ff5903..d04f725138a 100644 --- a/dlls/user32/tests/static.c +++ b/dlls/user32/tests/static.c @@ -56,6 +56,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara ok(GetClipRgn(hdc, hrgn) == 1, "Static controls during a WM_CTLCOLORSTATIC must have a clipping region\n"); DeleteObject(hrgn); g_nReceivedColorStatic++; + return (LRESULT) GetStockObject(BLACK_BRUSH); } break; } @@ -81,7 +82,11 @@ static void test_updates(int style, int flags) InvalidateRect(hStatic, NULL, FALSE); UpdateWindow(hStatic); - + if( (style & SS_TYPEMASK) == SS_BITMAP) { + HDC hdc = GetDC( hStatic); + COLORREF colour = GetPixel( hdc, 10, 10); + ok ( colour != 0, "pixel should NOT be painted black!\n"); + } if (style != SS_ETCHEDHORZ && style != SS_ETCHEDVERT) exp = 4; else @@ -89,7 +94,7 @@ static void test_updates(int style, int flags) if (flags & TODO_COUNT) todo_wine { expect_eq(g_nReceivedColorStatic, exp, int, "%d"); } - else if (style == SS_ICON || style == SS_BITMAP) + else if ((style & SS_TYPEMASK) == SS_ICON || (style & SS_TYPEMASK) == SS_BITMAP) ok( g_nReceivedColorStatic == exp || broken(g_nReceivedColorStatic == 0), /* win9x */ "expected %u got %u\n", exp, g_nReceivedColorStatic ); @@ -125,6 +130,7 @@ START_TEST(static) test_updates(SS_SIMPLE, 0); test_updates(SS_ICON, 0); test_updates(SS_BITMAP, 0); + test_updates(SS_BITMAP | SS_CENTERIMAGE, 0); test_updates(SS_BLACKRECT, TODO_COUNT); test_updates(SS_WHITERECT, TODO_COUNT); test_updates(SS_ETCHEDHORZ, TODO_COUNT);