On Wed, Nov 03, 2004 at 09:24:08PM -0800, Walt Ogburn wrote:
Changelog: Take color info from existing hdc instead of creating a new memory HDC.
Index: dlls/gdi/dib.c
RCS file: /home/wine/wine/dlls/gdi/dib.c,v retrieving revision 1.7 diff -u -r1.7 dib.c --- dlls/gdi/dib.c 2 Nov 2004 05:23:49 -0000 1.7 +++ dlls/gdi/dib.c 4 Nov 2004 05:08:24 -0000 @@ -563,7 +559,7 @@ same color depth then get the color map from it */ if (bmp->dib && bmp->dib->dsBm.bmBitsPixel == bpp) { if(coloruse == DIB_RGB_COLORS) {
HBITMAP oldbm = SelectObject(memdc, hbitmap);
HBITMAP oldbm = SelectObject(hdc, hbitmap); unsigned int colors = 1 << bpp; if (core_header)
This won't always work since hdc does not necessarily have to be a memory dc.
I think what you want to do is to store the dib colour table in the gdi bmp->dib structure rather than in the driver's (x11drv) one. Then retrieving the colour table can be done by simply accessing the data directly, rather than through a call to GetDIBColorTable.
Huw.
Thanks Huw. Actually, when GetDIBits gets invoked by the SelectBrush code, it winds up in an unimplemented part anyway, so the current brush code needs a different fix than just preventing the locking problem.
I'll try to see if the GetDIBits call can be replaced with something else that works right, and otherwise just put in a FIXME so that the result will be a slightly wrong brush instead of a crash.
Here's the part of the GetDIBits code that it winds up in, in case you're interested. It's the commented FIXME.
Thanks, Walter
====
/* Otherwise, get bits from the XImage */ else { if (!bmp->funcs && !BITMAP_SetOwnerDC( hbitmap, dc )) lines = 0; else { if (bmp->funcs && bmp->funcs->pGetDIBits) lines = bmp->funcs->pGetDIBits( dc->physDev, hbitmap, startscan, lines, bits, info, coloruse ); else lines = 0; /* FIXME: should copy from bmp->bitmap.bmBits */ } }
====
On Thu, 4 Nov 2004, Huw D M Davies wrote:
On Wed, Nov 03, 2004 at 09:24:08PM -0800, Walt Ogburn wrote:
Changelog: Take color info from existing hdc instead of creating a new memory HDC.
Index: dlls/gdi/dib.c
RCS file: /home/wine/wine/dlls/gdi/dib.c,v retrieving revision 1.7 diff -u -r1.7 dib.c --- dlls/gdi/dib.c 2 Nov 2004 05:23:49 -0000 1.7 +++ dlls/gdi/dib.c 4 Nov 2004 05:08:24 -0000 @@ -563,7 +559,7 @@ same color depth then get the color map from it */ if (bmp->dib && bmp->dib->dsBm.bmBitsPixel == bpp) { if(coloruse == DIB_RGB_COLORS) {
HBITMAP oldbm = SelectObject(memdc, hbitmap);
HBITMAP oldbm = SelectObject(hdc, hbitmap); unsigned int colors = 1 << bpp; if (core_header)
This won't always work since hdc does not necessarily have to be a memory dc.
I think what you want to do is to store the dib colour table in the gdi bmp->dib structure rather than in the driver's (x11drv) one. Then retrieving the colour table can be done by simply accessing the data directly, rather than through a call to GetDIBColorTable.
Huw.
Huw Davies huw@codeweavers.com