From 9591466a60c764928ce7cde23722143478c161dc Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 13 Apr 2005 14:45:27 +0000 Subject: [PATCH] Moved the driver-independent part of CreateDIBSection into GDI. --- dlls/gdi/dib.c | 196 +++++++++++++++++++++++++++------ dlls/gdi/gdi_private.h | 2 +- dlls/x11drv/dib.c | 233 ++++++---------------------------------- dlls/x11drv/x11drv.h | 2 - dlls/x11drv/x11drv.spec | 2 +- 5 files changed, 198 insertions(+), 237 deletions(-) diff --git a/dlls/gdi/dib.c b/dlls/gdi/dib.c index 869c1afd313..97dcaa8ec4b 100644 --- a/dlls/gdi/dib.c +++ b/dlls/gdi/dib.c @@ -150,14 +150,16 @@ int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse ) * 4 for V4HEADER, 5 for V5HEADER, -1 for error. */ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, - LONG *height, WORD *bpp, DWORD *compr ) + LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) { if (header->biSize == sizeof(BITMAPINFOHEADER)) { *width = header->biWidth; *height = header->biHeight; + *planes = header->biPlanes; *bpp = header->biBitCount; *compr = header->biCompression; + *size = header->biSizeImage; return 1; } if (header->biSize == sizeof(BITMAPCOREHEADER)) @@ -165,8 +167,10 @@ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)header; *width = core->bcWidth; *height = core->bcHeight; + *planes = core->bcPlanes; *bpp = core->bcBitCount; *compr = 0; + *size = 0; return 0; } if (header->biSize == sizeof(BITMAPV4HEADER)) @@ -174,8 +178,10 @@ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, BITMAPV4HEADER *v4hdr = (BITMAPV4HEADER *)header; *width = v4hdr->bV4Width; *height = v4hdr->bV4Height; + *planes = v4hdr->bV4Planes; *bpp = v4hdr->bV4BitCount; *compr = v4hdr->bV4V4Compression; + *size = v4hdr->bV4SizeImage; return 4; } if (header->biSize == sizeof(BITMAPV5HEADER)) @@ -183,8 +189,10 @@ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, BITMAPV5HEADER *v5hdr = (BITMAPV5HEADER *)header; *width = v5hdr->bV5Width; *height = v5hdr->bV5Height; + *planes = v5hdr->bV5Planes; *bpp = v5hdr->bV5BitCount; *compr = v5hdr->bV5Compression; + *size = v5hdr->bV5SizeImage; return 5; } ERR("(%ld): unknown/wrong size for header\n", header->biSize ); @@ -222,10 +230,10 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst, HDC hdcMem; LONG height; LONG width; - WORD bpp; - DWORD compr; + WORD planes, bpp; + DWORD compr, size; - if (DIB_GetBitmapInfo( (BITMAPINFOHEADER*) info, &width, &height, &bpp, &compr ) == -1) + if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height, &planes, &bpp, &compr, &size ) == -1) { ERR("Invalid bitmap\n"); return 0; @@ -525,15 +533,15 @@ INT WINAPI GetDIBits( BOOL core_header; LONG width; LONG height; - WORD bpp; - DWORD compr; + WORD planes, bpp; + DWORD compr, size; void* colorPtr; RGBTRIPLE* rgbTriples; RGBQUAD* rgbQuads; if (!info) return 0; - bitmap_type = DIB_GetBitmapInfo( (BITMAPINFOHEADER*) info, &width, &height, &bpp, &compr); + bitmap_type = DIB_GetBitmapInfo( &info->bmiHeader, &width, &height, &planes, &bpp, &compr, &size); if (bitmap_type == -1) { ERR("Invalid bitmap format\n"); @@ -984,11 +992,11 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, HBITMAP handle; LONG width; LONG height; - WORD bpp; - DWORD compr; + WORD planes, bpp; + DWORD compr, size; DC *dc; - if (DIB_GetBitmapInfo( header, &width, &height, &bpp, &compr ) == -1) return 0; + if (DIB_GetBitmapInfo( header, &width, &height, &planes, &bpp, &compr, &size ) == -1) return 0; if (width < 0) { @@ -1042,28 +1050,18 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 us { const BITMAPINFOHEADER *bi = &bmi->bmiHeader; LONG width, height; - WORD bpp; - DWORD compr; - BOOL core_header; + WORD planes, bpp; + DWORD compr, size; INT width_bytes; - INT size; WORD count, sel; int i; - core_header = (DIB_GetBitmapInfo(bi, &width, &height, &bpp, &compr) == 0); + DIB_GetBitmapInfo(bi, &width, &height, &planes, &bpp, &compr, &size); height = height >= 0 ? height : -height; width_bytes = DIB_GetDIBWidthBytes(width, bpp); - - if (core_header) - { - size = width_bytes * height; - } - else - { - size = (bi->biSizeImage && compr != BI_RGB) ? - bi->biSizeImage : width_bytes * height; - } + + if (!size || (compr != BI_RLE4 && compr != BI_RLE8)) size = width_bytes * height; /* calculate number of sel's needed for size with 64K steps */ count = (size + 0xffff) / 0x10000; @@ -1087,12 +1085,118 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 us * DIB_CreateDIBSection */ HBITMAP DIB_CreateDIBSection(HDC hdc, const BITMAPINFO *bmi, UINT usage, - VOID **bits, HANDLE section, - DWORD offset, DWORD ovr_pitch) + VOID **bits, HANDLE section, + DWORD offset, DWORD ovr_pitch) { - HBITMAP hbitmap = 0; + HBITMAP ret = 0; DC *dc; BOOL bDesktopDC = FALSE; + DIBSECTION *dib; + BITMAPOBJ *bmp; + int bitmap_type; + LONG width, height; + WORD planes, bpp; + DWORD compression, sizeImage; + const DWORD *colorPtr; + void *mapBits = NULL; + + if (((bitmap_type = DIB_GetBitmapInfo( &bmi->bmiHeader, &width, &height, + &planes, &bpp, &compression, &sizeImage )) == -1)) + return 0; + + if (!(dib = HeapAlloc( GetProcessHeap(), 0, sizeof(*dib) ))) return 0; + + TRACE("format (%ld,%ld), planes %d, bpp %d, size %ld, %s\n", + width, height, planes, bpp, sizeImage, usage == DIB_PAL_COLORS? "PAL" : "RGB"); + + dib->dsBm.bmType = 0; + dib->dsBm.bmWidth = width; + dib->dsBm.bmHeight = height >= 0 ? height : -height; + dib->dsBm.bmWidthBytes = ovr_pitch ? ovr_pitch : DIB_GetDIBWidthBytes(width, bpp); + dib->dsBm.bmPlanes = planes; + dib->dsBm.bmBitsPixel = bpp; + dib->dsBm.bmBits = NULL; + + if (!bitmap_type) /* core header */ + { + /* convert the BITMAPCOREHEADER to a BITMAPINFOHEADER */ + dib->dsBmih.biSize = sizeof(BITMAPINFOHEADER); + dib->dsBmih.biWidth = width; + dib->dsBmih.biHeight = height; + dib->dsBmih.biPlanes = planes; + dib->dsBmih.biBitCount = bpp; + dib->dsBmih.biCompression = compression; + dib->dsBmih.biXPelsPerMeter = 0; + dib->dsBmih.biYPelsPerMeter = 0; + dib->dsBmih.biClrUsed = 0; + dib->dsBmih.biClrImportant = 0; + } + else + { + /* truncate extended bitmap headers (BITMAPV4HEADER etc.) */ + dib->dsBmih = bmi->bmiHeader; + dib->dsBmih.biSize = sizeof(BITMAPINFOHEADER); + } + + /* only use sizeImage if it's valid and we're dealing with a compressed bitmap */ + if (sizeImage && (compression == BI_RLE4 || compression == BI_RLE8)) + dib->dsBmih.biSizeImage = sizeImage; + else + dib->dsBmih.biSizeImage = dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight; + + + /* set dsBitfields values */ + colorPtr = (const DWORD *)((const char *)bmi + (WORD) bmi->bmiHeader.biSize); + if (usage == DIB_PAL_COLORS || bpp <= 8) + { + dib->dsBitfields[0] = dib->dsBitfields[1] = dib->dsBitfields[2] = 0; + } + else switch( bpp ) + { + case 15: + case 16: + dib->dsBitfields[0] = (compression == BI_BITFIELDS) ? colorPtr[0] : 0x7c00; + dib->dsBitfields[1] = (compression == BI_BITFIELDS) ? colorPtr[1] : 0x03e0; + dib->dsBitfields[2] = (compression == BI_BITFIELDS) ? colorPtr[2] : 0x001f; + break; + case 24: + case 32: + dib->dsBitfields[0] = (compression == BI_BITFIELDS) ? colorPtr[0] : 0xff0000; + dib->dsBitfields[1] = (compression == BI_BITFIELDS) ? colorPtr[1] : 0x00ff00; + dib->dsBitfields[2] = (compression == BI_BITFIELDS) ? colorPtr[2] : 0x0000ff; + break; + } + + /* get storage location for DIB bits */ + + if (section) + { + SYSTEM_INFO SystemInfo; + DWORD mapOffset; + INT mapSize; + + GetSystemInfo( &SystemInfo ); + mapOffset = offset - (offset % SystemInfo.dwAllocationGranularity); + mapSize = dib->dsBmih.biSizeImage + (offset - mapOffset); + mapBits = MapViewOfFile( section, FILE_MAP_ALL_ACCESS, 0, mapOffset, mapSize ); + if (mapBits) dib->dsBm.bmBits = (char *)mapBits + (offset - mapOffset); + } + else if (ovr_pitch && offset) + dib->dsBm.bmBits = (LPVOID) offset; + else + { + offset = 0; + dib->dsBm.bmBits = VirtualAlloc( NULL, dib->dsBmih.biSizeImage, + MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE ); + } + dib->dshSection = section; + dib->dsOffset = offset; + + if (!dib->dsBm.bmBits) + { + HeapFree( GetProcessHeap(), 0, dib ); + return 0; + } /* If the reference hdc is null, take the desktop dc */ if (hdc == 0) @@ -1101,17 +1205,39 @@ HBITMAP DIB_CreateDIBSection(HDC hdc, const BITMAPINFO *bmi, UINT usage, bDesktopDC = TRUE; } - if ((dc = DC_GetDCPtr( hdc ))) + if (!(dc = DC_GetDCPtr( hdc ))) goto error; + + /* create Device Dependent Bitmap and add DIB pointer */ + ret = CreateBitmap( dib->dsBm.bmWidth, dib->dsBm.bmHeight, 1, + (bpp == 1) ? 1 : GetDeviceCaps(hdc, BITSPIXEL), NULL ); + + if (ret && ((bmp = GDI_GetObjPtr(ret, BITMAP_MAGIC)))) { - if(dc->funcs->pCreateDIBSection) - hbitmap = dc->funcs->pCreateDIBSection(dc->physDev, bmi, usage, bits, section, offset, ovr_pitch); - GDI_ReleaseObj(hdc); + bmp->dib = dib; + bmp->funcs = dc->funcs; + GDI_ReleaseObj( ret ); + + if (dc->funcs->pCreateDIBSection) + { + if (!dc->funcs->pCreateDIBSection(dc->physDev, ret, bmi, usage)) + { + DeleteObject( ret ); + ret = 0; + } + } } - if (bDesktopDC) - DeleteDC(hdc); + GDI_ReleaseObj(hdc); + if (bDesktopDC) DeleteDC( hdc ); + if (ret && bits) *bits = dib->dsBm.bmBits; + return ret; - return hbitmap; +error: + if (bDesktopDC) DeleteDC( hdc ); + if (section) UnmapViewOfFile( mapBits ); + else if (!offset) VirtualFree( dib->dsBm.bmBits, 0, MEM_RELEASE ); + HeapFree( GetProcessHeap(), 0, dib ); + return 0; } /*********************************************************************** diff --git a/dlls/gdi/gdi_private.h b/dlls/gdi/gdi_private.h index fc71da38d2b..c87eec20e2f 100644 --- a/dlls/gdi/gdi_private.h +++ b/dlls/gdi/gdi_private.h @@ -66,7 +66,7 @@ typedef struct tagDC_FUNCS BOOL (*pCloseFigure)(PHYSDEV); BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP); BOOL (*pCreateDC)(HDC,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*); - HBITMAP (*pCreateDIBSection)(PHYSDEV,const BITMAPINFO *,UINT,VOID **,HANDLE,DWORD,DWORD); + HBITMAP (*pCreateDIBSection)(PHYSDEV,HBITMAP,const BITMAPINFO *,UINT); BOOL (*pDeleteBitmap)(HBITMAP); BOOL (*pDeleteDC)(PHYSDEV); BOOL (*pDeleteObject)(PHYSDEV,HGDIOBJ); diff --git a/dlls/x11drv/dib.c b/dlls/x11drv/dib.c index b2325fa3549..ee49e9809ea 100644 --- a/dlls/x11drv/dib.c +++ b/dlls/x11drv/dib.c @@ -36,7 +36,7 @@ #include #include "windef.h" #include "winbase.h" -#include "gdi.h" +#include "wingdi.h" #include "x11drv.h" #include "wine/debug.h" @@ -4531,217 +4531,54 @@ static XImage *X11DRV_XShmCreateImage( int width, int height, int bpp, /*********************************************************************** - * X11DRV_DIB_CreateDIBSection + * X11DRV_CreateDIBSection (X11DRV.@) */ -HBITMAP X11DRV_DIB_CreateDIBSection( - X11DRV_PDEVICE *physDev, const BITMAPINFO *bmi, UINT usage, - VOID **bits, HANDLE section, - DWORD offset, DWORD ovr_pitch) +HBITMAP X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, + const BITMAPINFO *bmi, UINT usage ) { - HBITMAP res = 0; - X_PHYSBITMAP *physBitmap = NULL; - DIBSECTION *dib = NULL; - int *colorMap = NULL; - int nColorMap; - RGBQUAD *colorTable = NULL; + extern BOOL VIRTUAL_SetFaultHandler(LPCVOID addr, BOOL (*proc)(LPVOID, LPCVOID), LPVOID arg); + X_PHYSBITMAP *physBitmap; + DIBSECTION dib; - /* Fill BITMAP structure with DIB data */ - INT effHeight, totalSize; - BITMAP bm; - LPVOID mapBits = NULL; + if (!(physBitmap = X11DRV_init_phys_bitmap( hbitmap ))) return 0; + physBitmap->status = DIB_Status_None; - int bitmap_type; - BOOL core_header; - LONG width, height; - WORD planes, bpp, compression; - DWORD sizeImage; - void* colorPtr; + GetObjectW( hbitmap, sizeof(dib), &dib ); - if (((bitmap_type = DIB_GetBitmapInfoEx((BITMAPINFOHEADER*) bmi, - &width, &height, &planes, &bpp, &compression, &sizeImage)) == -1)) - { - ERR("Invalid bitmap\n"); - return 0; - } - core_header = (bitmap_type == 0); - - TRACE("format (%ld,%ld), planes %d, bpp %d, size %ld, %s\n", - width, height, planes, bpp, - sizeImage, usage == DIB_PAL_COLORS? "PAL" : "RGB"); - - effHeight = height >= 0 ? height : -height; - bm.bmType = 0; - bm.bmWidth = width; - bm.bmHeight = effHeight; - bm.bmWidthBytes = ovr_pitch ? ovr_pitch : X11DRV_DIB_GetDIBWidthBytes(bm.bmWidth, bpp); - bm.bmPlanes = planes; - bm.bmBitsPixel = bpp; - bm.bmBits = NULL; - - /* Get storage location for DIB bits. Only use sizeImage if it's valid and - we're dealing with a compressed bitmap. Otherwise, use width * height. */ - if (sizeImage && (compression == BI_RLE4 || compression == BI_RLE8)) - totalSize = sizeImage; - else - totalSize = bm.bmWidthBytes * effHeight; - - if (section) - { - SYSTEM_INFO SystemInfo; - DWORD mapOffset; - INT mapSize; - - GetSystemInfo( &SystemInfo ); - mapOffset = offset - (offset % SystemInfo.dwAllocationGranularity); - mapSize = totalSize + (offset - mapOffset); - mapBits = MapViewOfFile( section, - FILE_MAP_ALL_ACCESS, - 0L, - mapOffset, - mapSize ); - bm.bmBits = (char *)mapBits + (offset - mapOffset); - } - else if (ovr_pitch && offset) - bm.bmBits = (LPVOID) offset; - else { - offset = 0; - bm.bmBits = VirtualAlloc(NULL, totalSize, - MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); - } - - /* Create Color Map */ - if (bm.bmBits && bm.bmBitsPixel <= 8) { - colorMap = X11DRV_DIB_BuildColorMap( usage == DIB_PAL_COLORS? physDev : NULL, - usage, bm.bmBitsPixel, bmi, &nColorMap ); - colorTable = X11DRV_DIB_BuildColorTable( physDev, usage, bm.bmBitsPixel, bmi ); - } - /* Allocate Memory for DIB and fill structure */ - if (bm.bmBits) - dib = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dib)); - if (dib) + /* create color map */ + if (dib.dsBm.bmBitsPixel <= 8) { - dib->dsBm = bm; - - if (core_header) - { - /* Convert the BITMAPCOREHEADER to a BITMAPINFOHEADER. - The structure is already filled with zeros */ - dib->dsBmih.biSize = sizeof(BITMAPINFOHEADER); - dib->dsBmih.biWidth = width; - dib->dsBmih.biHeight = height; - dib->dsBmih.biPlanes = planes; - dib->dsBmih.biBitCount = bpp; - dib->dsBmih.biCompression = compression; - } - else - { - /* Truncate extended bitmap headers (BITMAPV4HEADER etc.) */ - dib->dsBmih = *((BITMAPINFOHEADER*) bmi); - dib->dsBmih.biSize = sizeof(BITMAPINFOHEADER); - } - - dib->dsBmih.biSizeImage = totalSize; - colorPtr = (LPBYTE) bmi + (WORD) bmi->bmiHeader.biSize; - - /* Set dsBitfields values */ - if ( usage == DIB_PAL_COLORS || bpp <= 8) - { - dib->dsBitfields[0] = dib->dsBitfields[1] = dib->dsBitfields[2] = 0; - } - else switch( bpp ) - { - case 15: - case 16: - dib->dsBitfields[0] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr ) : 0x7c00; - dib->dsBitfields[1] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 1) : 0x03e0; - dib->dsBitfields[2] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 2) : 0x001f; - break; - - case 24: - case 32: - dib->dsBitfields[0] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr ) : 0xff0000; - dib->dsBitfields[1] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 1) : 0x00ff00; - dib->dsBitfields[2] = (compression == BI_BITFIELDS) ? *((const DWORD *)colorPtr + 2) : 0x0000ff; - break; - } - dib->dshSection = section; - dib->dsOffset = offset; - + physBitmap->colorMap = X11DRV_DIB_BuildColorMap( usage == DIB_PAL_COLORS ? physDev : NULL, + usage, dib.dsBm.bmBitsPixel, bmi, + &physBitmap->nColorMap ); + physBitmap->colorTable = X11DRV_DIB_BuildColorTable( physDev, usage, dib.dsBm.bmBitsPixel, bmi ); } - /* Create Device Dependent Bitmap and add DIB pointer */ - if (dib) - { - int depth = (bpp == 1) ? 1 : GetDeviceCaps(physDev->hdc, BITSPIXEL); - res = CreateBitmap(width, effHeight, 1, depth, NULL); - - if (res) - { - BITMAPOBJ *bmp = GDI_GetObjPtr(res, BITMAP_MAGIC); - if (bmp) bmp->dib = dib; - GDI_ReleaseObj( res ); - physBitmap = X11DRV_init_phys_bitmap( res ); - physBitmap->status = DIB_Status_None; - physBitmap->nColorMap = nColorMap; - physBitmap->colorMap = colorMap; - physBitmap->colorTable = colorTable; - } - } - - /* Create XImage */ - if (dib && physBitmap) - { - wine_tsx11_lock(); + /* create pixmap and X image */ + wine_tsx11_lock(); + physBitmap->pixmap_depth = (dib.dsBm.bmBitsPixel == 1) ? 1 : screen_depth; + physBitmap->pixmap = XCreatePixmap( gdi_display, root_window, dib.dsBm.bmWidth, + dib.dsBm.bmHeight, physBitmap->pixmap_depth ); #ifdef HAVE_LIBXXSHM - if (XShmQueryExtension(gdi_display) && - (physBitmap->image = X11DRV_XShmCreateImage( bm.bmWidth, effHeight, - physBitmap->pixmap_depth, &physBitmap->shminfo )) ) - { - ; /* Created Image */ - } else { - physBitmap->image = X11DRV_DIB_CreateXImage( bm.bmWidth, effHeight, physBitmap->pixmap_depth ); - physBitmap->shminfo.shmid = -1; - } -#else - physBitmap->image = X11DRV_DIB_CreateXImage( bm.bmWidth, effHeight, physBitmap->pixmap_depth ); + physBitmap->shminfo.shmid = -1; + if (!XShmQueryExtension(gdi_display) || + !(physBitmap->image = X11DRV_XShmCreateImage( dib.dsBm.bmWidth, dib.dsBm.bmHeight, + physBitmap->pixmap_depth, &physBitmap->shminfo )) ) #endif - wine_tsx11_unlock(); - } + physBitmap->image = X11DRV_DIB_CreateXImage( dib.dsBm.bmWidth, dib.dsBm.bmHeight, + physBitmap->pixmap_depth ); + wine_tsx11_unlock(); + if (!physBitmap->pixmap || !physBitmap->image) return 0; - /* Clean up in case of errors */ - if (!res || !physBitmap || !dib || !bm.bmBits || (bm.bmBitsPixel <= 8 && !colorMap)) + /* install fault handler */ + InitializeCriticalSection( &physBitmap->lock ); + if (VIRTUAL_SetFaultHandler(dib.dsBm.bmBits, X11DRV_DIB_FaultHandler, physBitmap)) { - TRACE("got an error res=%p, bmp=%p, dib=%p, bm.bmBits=%p\n", - res, physBitmap, dib, bm.bmBits); - if (bm.bmBits) - { - if (section) - UnmapViewOfFile(mapBits), bm.bmBits = NULL; - else if (!offset) - VirtualFree(bm.bmBits, 0L, MEM_RELEASE), bm.bmBits = NULL; - } - - if (dib && physBitmap->image) { XDestroyImage(physBitmap->image); physBitmap->image = NULL; } - HeapFree(GetProcessHeap(), 0, colorMap); colorMap = NULL; - HeapFree(GetProcessHeap(), 0, colorTable); colorTable = NULL; - HeapFree(GetProcessHeap(), 0, dib); dib = NULL; - if (res) { DeleteObject(res); res = 0; } - } - else if (bm.bmBits) - { - extern BOOL VIRTUAL_SetFaultHandler(LPCVOID addr, BOOL (*proc)(LPVOID, LPCVOID), LPVOID arg); - /* Install fault handler, if possible */ - InitializeCriticalSection(&physBitmap->lock); - if (VIRTUAL_SetFaultHandler(bm.bmBits, X11DRV_DIB_FaultHandler, physBitmap)) - { - X11DRV_DIB_DoProtectDIBSection( physBitmap, PAGE_READWRITE ); - physBitmap->status = DIB_Status_AppMod; - } + X11DRV_DIB_DoProtectDIBSection( physBitmap, PAGE_READWRITE ); + physBitmap->status = DIB_Status_AppMod; } - /* Return BITMAP handle and storage location */ - if (bm.bmBits && bits) *bits = bm.bmBits; - return res; + return hbitmap; } /*********************************************************************** diff --git a/dlls/x11drv/x11drv.h b/dlls/x11drv/x11drv.h index 84fc605eaa3..99774e2d7d2 100644 --- a/dlls/x11drv/x11drv.h +++ b/dlls/x11drv/x11drv.h @@ -409,8 +409,6 @@ extern INT X11DRV_CoerceDIBSection(X11DRV_PDEVICE *physDev,INT,BOOL); extern INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev,INT,BOOL); extern void X11DRV_UnlockDIBSection(X11DRV_PDEVICE *physDev,BOOL); -extern HBITMAP X11DRV_DIB_CreateDIBSection(X11DRV_PDEVICE *physDev, const BITMAPINFO *bmi, UINT usage, - VOID **bits, HANDLE section, DWORD offset, DWORD ovr_pitch); extern void X11DRV_DIB_DeleteDIBSection(X_PHYSBITMAP *physBitmap, DIBSECTION *dib); void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst, DWORD xSrc, DWORD ySrc, DWORD xDest, DWORD yDest, diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec index 9a705d1a948..11aa90ae82f 100644 --- a/dlls/x11drv/x11drv.spec +++ b/dlls/x11drv/x11drv.spec @@ -7,7 +7,7 @@ @ cdecl Chord(ptr long long long long long long long long) X11DRV_Chord @ cdecl CreateBitmap(ptr long) X11DRV_CreateBitmap @ cdecl CreateDC(long ptr wstr wstr wstr ptr) X11DRV_CreateDC -@ cdecl CreateDIBSection(ptr ptr long ptr long long long) X11DRV_DIB_CreateDIBSection +@ cdecl CreateDIBSection(ptr long ptr long) X11DRV_CreateDIBSection @ cdecl DeleteBitmap(long) X11DRV_DeleteBitmap @ cdecl DeleteDC(ptr) X11DRV_DeleteDC @ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat