gdi/mfdrv BS_PATTERN brushes

Walt Ogburn reuben at ugcs.caltech.edu
Mon Nov 29 22:39:59 CST 2004


Re-submitting.

This fixes the problem that Emanuele Gisi reported last month in the Aloha
problem.  With this patch BS_PATTERN brushes get created correctly and
don't cause a locking problem.

Changelog:
Fix creation of BS_PATTERN brushes in mfdrv


Index: dlls/gdi/mfdrv/objects.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/mfdrv/objects.c,v
retrieving revision 1.13
diff -u -r1.13 objects.c
--- dlls/gdi/mfdrv/objects.c    8 Sep 2004 01:37:24 -0000       1.13
+++ dlls/gdi/mfdrv/objects.c    5 Nov 2004 06:10:47 -0000
@@ -172,14 +172,12 @@
                goto done;
            }

-           bmSize = DIB_GetDIBImageBytes(bm.bmWidth, bm.bmHeight, 1);
-
-           size = sizeof(METARECORD) + sizeof(WORD) + sizeof(BITMAPINFO)
+
-             sizeof(RGBQUAD) + bmSize;
+           bmSize = 2 * ((bm.bmWidth + 15) >> 4) * bm.bmHeight;
+           size = sizeof(METARECORD) + sizeof(WORD) + sizeof(BITMAPINFO) + bmSize;

            mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
            if(!mr) goto done;
-           mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
+           mr->rdFunction = META_CREATEPATTERNBRUSH;
            mr->rdSize = size / 2;
            mr->rdParm[0] = BS_PATTERN;
            mr->rdParm[1] = DIB_RGB_COLORS;
@@ -190,12 +188,13 @@
            info->bmiHeader.biHeight = bm.bmHeight;
            info->bmiHeader.biPlanes = 1;
            info->bmiHeader.biBitCount = 1;
-           bits = ((BYTE *)info) + sizeof(BITMAPINFO) + sizeof(RGBQUAD);
+           bits = ((BYTE *)info) + sizeof(BITMAPINFO);
+           memcpy(bits, bm.bmBits, bmSize);

-           GetDIBits(physDev->hdc, (HANDLE)logbrush.lbHatch, 0, bm.bmHeight,
-                     bits, info, DIB_RGB_COLORS);
+           /* In principle, color should be GetTextColor(physDev->hdc); */
+           /* here, it doesn't really get used, so set to zero */
            *(DWORD *)info->bmiColors = 0;
-           *(DWORD *)(info->bmiColors + 1) = 0xffffff;
+
            break;
        }



More information about the wine-patches mailing list