user32: When repainting a static control with SS_BITMAP style, do not erase the background if there is no valid bitmap to paint.

Rein Klazes wijn at online.nl
Mon Apr 13 12:22:34 CDT 2009


Fixes bug #18030 "Images not show (or flickering) in old app"
This problem was fixed before, but regressed.  The test should prevent
that from happening again.
---
 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 4e8091b..69acbc5 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 6a474ff..d04f725 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);
-- 
1.6.2.1




More information about the wine-patches mailing list