[PATCH 1/1] comctl32: Always paint SS_BITMAP static control background with WM_CTLCOLORSTATIC brush.

Jinoh Kang wine at gitlab.winehq.org
Sat Jun 11 11:15:19 CDT 2022


From: Jinoh Kang <jinoh.kang.kr at gmail.com>

This is consistent with the behaviour of other static control styles.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 dlls/comctl32/static.c       | 7 ++++---
 dlls/comctl32/tests/static.c | 1 -
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/static.c b/dlls/comctl32/static.c
index 3151cda6552..d7a0b64af72 100644
--- a/dlls/comctl32/static.c
+++ b/dlls/comctl32/static.c
@@ -849,13 +849,16 @@ static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style
 {
     HDC hMemDC;
     HBITMAP hBitmap, oldbitmap;
+    RECT rcClient;
+
+    GetClientRect(hwnd, &rcClient);
+    FillRect( hdc, &rcClient, hbrush );
 
     if ((hBitmap = STATIC_GetImage( hwnd, IMAGE_BITMAP, style ))
          && (GetObjectType(hBitmap) == OBJ_BITMAP)
          && (hMemDC = CreateCompatibleDC( hdc )))
     {
         BITMAP bm;
-        RECT rcClient;
         LOGBRUSH brush;
         BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
         struct static_extra_info *extra = get_extra_ptr( hwnd, FALSE );
@@ -870,10 +873,8 @@ static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style
             if (brush.lbStyle == BS_SOLID)
                 SetBkColor(hdc, brush.lbColor);
         }
-        GetClientRect(hwnd, &rcClient);
         if (style & SS_CENTERIMAGE)
         {
-            FillRect( hdc, &rcClient, hbrush );
             rcClient.left = (rcClient.right - rcClient.left)/2 - bm.bmWidth/2;
             rcClient.top = (rcClient.bottom - rcClient.top)/2 - bm.bmHeight/2;
             rcClient.right = rcClient.left + bm.bmWidth;
diff --git a/dlls/comctl32/tests/static.c b/dlls/comctl32/tests/static.c
index dbd71539a57..756fed86fe0 100644
--- a/dlls/comctl32/tests/static.c
+++ b/dlls/comctl32/tests/static.c
@@ -118,7 +118,6 @@ static void test_updates(int style)
     {
         HDC hdc = GetDC(hStatic);
         COLORREF colour = GetPixel(hdc, 10, 10);
-        todo_wine
         ok(colour == 0, "Unexpected pixel color.\n");
         ReleaseDC(hStatic, hdc);
     }
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/229



More information about the wine-devel mailing list