static.c patch

Filip Navara xnavara at volny.cz
Mon Mar 15 15:38:25 CST 2004


Hi,

I want to synchronize my change from ReactOS with the Wine tree. 
Unfortunetly I can't test it and I don't even know if it compiles under 
Wine. So if anyone want to take care of it, here it is.

Regards,
Filip

--- static.c    Tue Feb 10 20:09:04 2004
+++ static.c    Mon Mar 15 21:34:06 2004
@@ -122,6 +122,7 @@
 static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
 {
     HBITMAP hOldBitmap;
+    LONG full_style = GetWindowLongA( hwnd, GWL_STYLE );
 
     if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
     if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
@@ -129,7 +130,7 @@
         return 0;
     }
     hOldBitmap = (HBITMAP)SetWindowLongA( hwnd, HICON_GWL_OFFSET, 
(LONG)hBitmap );
-    if (hBitmap)
+    if (hBitmap && !(full_style & SS_REALSIZEIMAGE))
     {
         BITMAP bm;
         GetObjectW(hBitmap, sizeof(bm), &bm);
@@ -559,6 +560,7 @@
     HBRUSH hbrush;
     HDC hMemDC;
     HBITMAP hBitmap, oldbitmap;
+    LONG full_style = GetWindowLongA( hwnd, GWL_STYLE );
 
     GetClientRect( hwnd, &rc );
     hbrush = (HBRUSH)SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC,
@@ -573,8 +575,17 @@
         if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
     GetObjectW(hBitmap, sizeof(bm), &bm);
     oldbitmap = SelectObject(hMemDC, hBitmap);
-    BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
-           SRCCOPY);
+        if (full_style & SS_CENTERIMAGE)
+        {
+            BitBlt(hdc, (rc.right - bm.bmWidth) >> 1,
+                   (rc.bottom - bm.bmHeight) >> 1,
+                   bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
+        }
+        else
+        {
+            BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
+                   SRCCOPY);
+        }
     SelectObject(hMemDC, oldbitmap);
     DeleteDC(hMemDC);
     }




More information about the wine-devel mailing list