Commit a08e2cf1 authored by Alexandre Julliard's avatar Alexandre Julliard

Merged DDBitmap and physBitmap into the generic bitmap structure

(suggested by Andrew Lewycky).
parent 199aebaa
......@@ -24,19 +24,13 @@ TTYDRV_PHYSBITMAP *TTYDRV_DC_AllocBitmap(BITMAPOBJ *bitmap)
{
TTYDRV_PHYSBITMAP *physBitmap;
if(!(bitmap->DDBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(DDBITMAP)))) {
ERR("Can't alloc DDBITMAP\n");
return NULL;
}
if(!(physBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(TTYDRV_PHYSBITMAP)))) {
ERR("Can't alloc TTYDRV_PHYSBITMAP\n");
HeapFree(GetProcessHeap(), 0, bitmap->DDBitmap);
return NULL;
}
bitmap->DDBitmap->physBitmap = physBitmap;
bitmap->DDBitmap->funcs = DRIVER_FindDriver("DISPLAY");
bitmap->physBitmap = physBitmap;
bitmap->funcs = DRIVER_FindDriver("DISPLAY");
return physBitmap;
}
......@@ -102,10 +96,10 @@ BOOL TTYDRV_DC_BITMAP_DeleteObject(HBITMAP hbitmap, BITMAPOBJ *bitmap)
{
TRACE("(0x%04x, %p)\n", hbitmap, bitmap);
HeapFree(GetProcessHeap(), 0, bitmap->DDBitmap->physBitmap);
HeapFree(GetProcessHeap(), 0, bitmap->DDBitmap);
bitmap->DDBitmap = NULL;
HeapFree(GetProcessHeap(), 0, bitmap->physBitmap);
bitmap->physBitmap = NULL;
bitmap->funcs = NULL;
return TRUE;
}
......@@ -134,10 +128,10 @@ HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap
return 0;
/* Assure that the bitmap device dependent */
if(!bitmap->DDBitmap && !TTYDRV_DC_CreateBitmap(hbitmap))
if(!bitmap->physBitmap && !TTYDRV_DC_CreateBitmap(hbitmap))
return 0;
if(bitmap->DDBitmap->funcs != dc->funcs) {
if(bitmap->funcs != dc->funcs) {
ERR("Trying to select a non-TTY DDB into a TTY DC\n");
return 0;
}
......
......@@ -73,23 +73,20 @@ HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
{
HRGN hrgn;
HBITMAP prevHandle = dc->w.hBitmap;
X11DRV_PHYSBITMAP *pbitmap;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!(dc->w.flags & DC_MEMORY)) return 0;
if(!bmp->DDBitmap)
if(!bmp->physBitmap)
if(!X11DRV_CreateBitmap(hbitmap))
return 0;
if(bmp->DDBitmap->funcs != dc->funcs) {
if(bmp->funcs != dc->funcs) {
WARN("Trying to select non-X11 DDB into an X11 dc\n");
return 0;
}
pbitmap = bmp->DDBitmap->physBitmap;
dc->w.totalExtent.left = 0;
dc->w.totalExtent.top = 0;
dc->w.totalExtent.right = bmp->bitmap.bmWidth;
......@@ -105,7 +102,7 @@ HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
dc->w.hVisRgn = hrgn;
}
physDev->drawable = pbitmap->pixmap;
physDev->drawable = (Pixmap)bmp->physBitmap;
dc->w.hBitmap = hbitmap;
/* Change GC depth if needed */
......@@ -139,38 +136,8 @@ struct XPutImage_descr
static int XPutImage_wrapper( const struct XPutImage_descr *descr )
{
return XPutImage( display,
((X11DRV_PHYSBITMAP *)descr->bmp->DDBitmap->physBitmap)->pixmap,
BITMAP_GC(descr->bmp),
descr->image, 0, 0, 0, 0, descr->width, descr->height );
}
/***************************************************************************
*
* X11DRV_AllocBitmap
*
* Allocate DDBitmap and physBitmap
*
*/
X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( BITMAPOBJ *bmp )
{
X11DRV_PHYSBITMAP *pbitmap;
if(!(bmp->DDBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(DDBITMAP)))) {
WARN("Can't alloc DDBITMAP\n");
return NULL;
}
if(!(pbitmap = HeapAlloc(GetProcessHeap(), 0,sizeof(X11DRV_PHYSBITMAP)))) {
WARN("Can't alloc X11DRV_PHYSBITMAP\n");
HeapFree(GetProcessHeap(), 0, bmp->DDBitmap);
return NULL;
}
bmp->DDBitmap->physBitmap = pbitmap;
bmp->DDBitmap->funcs = DRIVER_FindDriver( "DISPLAY" );
return pbitmap;
return XPutImage( display, (Pixmap)descr->bmp->physBitmap, BITMAP_GC(descr->bmp),
descr->image, 0, 0, 0, 0, descr->width, descr->height );
}
......@@ -186,7 +153,6 @@ X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( BITMAPOBJ *bmp )
BOOL X11DRV_CreateBitmap( HBITMAP hbitmap )
{
X11DRV_PHYSBITMAP *pbitmap;
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if(!bmp) {
......@@ -208,19 +174,16 @@ BOOL X11DRV_CreateBitmap( HBITMAP hbitmap )
TRACE("(%08x) %dx%d %d bpp\n", hbitmap, bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight, bmp->bitmap.bmBitsPixel);
pbitmap = X11DRV_AllocBitmap( bmp );
if(!pbitmap) return FALSE;
/* Create the pixmap */
pbitmap->pixmap = TSXCreatePixmap(display, X11DRV_GetXRootWindow(), bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight, bmp->bitmap.bmBitsPixel);
if (!pbitmap->pixmap) {
if (!(bmp->physBitmap = (void *)TSXCreatePixmap(display, X11DRV_GetXRootWindow(),
bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
bmp->bitmap.bmBitsPixel)))
{
WARN("Can't create Pixmap\n");
HeapFree(GetProcessHeap(), 0, bmp->DDBitmap->physBitmap);
HeapFree(GetProcessHeap(), 0, bmp->DDBitmap);
GDI_HEAP_UNLOCK( hbitmap );
return FALSE;
}
bmp->funcs = &X11DRV_DC_Funcs;
if (bmp->bitmap.bmBits) /* Set bitmap bits */
X11DRV_BitmapBits( hbitmap, bmp->bitmap.bmBits,
......@@ -239,8 +202,7 @@ BOOL X11DRV_CreateBitmap( HBITMAP hbitmap )
*/
XImage *X11DRV_BITMAP_GetXImage( const BITMAPOBJ *bmp )
{
return XGetImage( display,
((X11DRV_PHYSBITMAP *)bmp->DDBitmap->physBitmap)->pixmap,
return XGetImage( display, (Pixmap)bmp->physBitmap,
0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
AllPlanes, ZPixmap );
}
......@@ -521,14 +483,9 @@ LONG X11DRV_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags)
*/
BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ * bmp )
{
X11DRV_PHYSBITMAP *pbitmap = bmp->DDBitmap->physBitmap;
TSXFreePixmap( display, pbitmap->pixmap );
HeapFree( GetProcessHeap(), 0, bmp->DDBitmap->physBitmap );
HeapFree( GetProcessHeap(), 0, bmp->DDBitmap );
bmp->DDBitmap = NULL;
TSXFreePixmap( display, (Pixmap)bmp->physBitmap );
bmp->physBitmap = NULL;
bmp->funcs = NULL;
return TRUE;
}
......@@ -543,7 +500,6 @@ HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap)
{
HBITMAP hBmp = 0;
BITMAPOBJ *pBmp = NULL;
X11DRV_PHYSBITMAP *pPhysBmp = NULL;
Window root;
int x,y; /* Unused */
unsigned border_width; /* Unused */
......@@ -563,20 +519,10 @@ HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap)
*/
hBmp = CreateBitmap( width, height, 1, depth, NULL );
/* Allocate DDBitmap and physBitmap structures in BITMAPOBJ.
* The hBmp is just a filled in BITMAPOBJ header at this point.
*/
pBmp = (BITMAPOBJ *)GDI_GetObjPtr( hBmp, BITMAP_MAGIC );
pPhysBmp = X11DRV_AllocBitmap( pBmp );
if( !pPhysBmp )
{
DeleteObject(hBmp);
hBmp = NULL;
goto END;
}
/* Point to our Pixmap in the physical bitmap structure */
pPhysBmp->pixmap = pixmap;
pBmp->funcs = &X11DRV_DC_Funcs;
pBmp->physBitmap = (void *)pixmap;
END:
TRACE("\tReturning HBITMAP %x\n", hBmp);
......@@ -615,13 +561,11 @@ HBITMAP X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap, BOOL bDeletePixmap)
*/
if (!bDeletePixmap)
{
/* Manually free the DDBitmap internals to prevent the Pixmap
/* Manually clear the bitmap internals to prevent the Pixmap
* from being deleted by DeleteObject.
*/
pBmp = (BITMAPOBJ *)GDI_GetObjPtr( hBmp, BITMAP_MAGIC );
HeapFree( GetProcessHeap(), 0, pBmp->DDBitmap->physBitmap );
HeapFree( GetProcessHeap(), 0, pBmp->DDBitmap );
pBmp->DDBitmap = NULL;
pBmp->physBitmap = NULL;
pBmp->funcs = NULL;
}
DeleteObject(hBmp);
......@@ -663,10 +607,10 @@ Pixmap X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp, HDC hdc )
*
* This function exists solely for x11 driver of the window system.
*/
BOOL X11DRV_BITMAP_Pixmap(HBITMAP hbitmap)
Pixmap X11DRV_BITMAP_Pixmap(HBITMAP hbitmap)
{
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
return ((X11DRV_PHYSBITMAP *)(bmp->DDBitmap->physBitmap))->pixmap;
return (Pixmap)bmp->physBitmap;
}
#endif /* !defined(X_DISPLAY_MISSING) */
......@@ -174,35 +174,32 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
*/
static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap )
{
X11DRV_PHYSBITMAP *pbitmap;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
if(!bmp->DDBitmap)
if(!bmp->physBitmap)
if(!X11DRV_CreateBitmap(hbitmap))
return 0;
if(bmp->DDBitmap->funcs != dc->funcs) {
if(bmp->funcs != dc->funcs) {
WARN("Trying to select non-X11 DDB into an X11 dc\n");
return 0;
}
pbitmap = bmp->DDBitmap->physBitmap;
if ((dc->w.bitsPerPixel == 1) && (bmp->bitmap.bmBitsPixel != 1))
{
/* Special case: a color pattern on a monochrome DC */
physDev->brush.pixmap = TSXCreatePixmap( display, X11DRV_GetXRootWindow(), 8, 8, 1);
/* FIXME: should probably convert to monochrome instead */
TSXCopyPlane( display, pbitmap->pixmap, physDev->brush.pixmap,
TSXCopyPlane( display, (Pixmap)bmp->physBitmap, physDev->brush.pixmap,
BITMAP_monoGC, 0, 0, 8, 8, 0, 0, 1 );
}
else
{
physDev->brush.pixmap = TSXCreatePixmap( display, X11DRV_GetXRootWindow(),
8, 8, bmp->bitmap.bmBitsPixel );
TSXCopyArea( display, pbitmap->pixmap, physDev->brush.pixmap,
TSXCopyArea( display, (Pixmap)bmp->physBitmap, physDev->brush.pixmap,
BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 );
}
......
......@@ -2781,7 +2781,6 @@ INT X11DRV_DIB_SetDIBits(
UINT coloruse, HBITMAP hbitmap)
{
X11DRV_DIB_IMAGEBITS_DESCR descr;
X11DRV_PHYSBITMAP *pbitmap;
int height, tmpheight;
INT result;
......@@ -2834,17 +2833,15 @@ INT X11DRV_DIB_SetDIBits(
}
/* HACK for now */
if(!bmp->DDBitmap)
if(!bmp->physBitmap)
X11DRV_CreateBitmap(hbitmap);
pbitmap = bmp->DDBitmap->physBitmap;
descr.bits = bits;
descr.image = NULL;
descr.palentry = NULL;
descr.lines = tmpheight >= 0 ? lines : -lines;
descr.depth = bmp->bitmap.bmBitsPixel;
descr.drawable = pbitmap->pixmap;
descr.drawable = (Pixmap)bmp->physBitmap;
descr.gc = BITMAP_GC(bmp);
descr.xSrc = 0;
descr.ySrc = 0;
......@@ -2873,7 +2870,6 @@ INT X11DRV_DIB_GetDIBits(
{
X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib;
X11DRV_DIB_IMAGEBITS_DESCR descr;
X11DRV_PHYSBITMAP *pbitmap;
PALETTEOBJ * palette;
TRACE("%u scanlines of (%i,%i) -> (%i,%i) starting from %u\n",
......@@ -2914,17 +2910,16 @@ INT X11DRV_DIB_GetDIBits(
}
/* Hack for now */
if(!bmp->DDBitmap)
if(!bmp->physBitmap)
X11DRV_CreateBitmap(hbitmap);
pbitmap = bmp->DDBitmap->physBitmap;
descr.dc = dc;
descr.palentry = palette->logpalette.palPalEntry;
descr.bits = bits;
descr.lines = lines;
descr.depth = bmp->bitmap.bmBitsPixel;
descr.drawable = pbitmap->pixmap;
descr.drawable = (Pixmap)bmp->physBitmap;
descr.gc = BITMAP_GC(bmp);
descr.xSrc = 0;
descr.ySrc = startscan;
......@@ -3018,7 +3013,7 @@ static void X11DRV_DIB_DoUpdateDIBSection(BITMAPOBJ *bmp, BOOL toDIB)
}
/* Hack for now */
descr.drawable = ((X11DRV_PHYSBITMAP *)bmp->DDBitmap->physBitmap)->pixmap;
descr.drawable = (Pixmap)bmp->physBitmap;
descr.gc = BITMAP_GC(bmp);
descr.xSrc = 0;
descr.ySrc = 0;
......@@ -3375,7 +3370,7 @@ HBITMAP X11DRV_DIB_CreateDIBSection(
{
bmp->dib = (DIBSECTION *) dib;
/* HACK for now */
if(!bmp->DDBitmap)
if(!bmp->physBitmap)
X11DRV_CreateBitmap(res);
}
}
......@@ -3496,12 +3491,9 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc, BOOL bDeletePixma
*/
if (!bDeletePixmap)
{
/* Manually free the DDBitmap internals to prevent the Pixmap
* from being deleted by DeleteObject.
*/
HeapFree( GetProcessHeap(), 0, pBmp->DDBitmap->physBitmap );
HeapFree( GetProcessHeap(), 0, pBmp->DDBitmap );
pBmp->DDBitmap = NULL;
/* Clear the physBitmap to prevent the Pixmap from being deleted by DeleteObject */
pBmp->physBitmap = NULL;
pBmp->funcs = NULL;
}
DeleteObject(hBmp);
......@@ -3550,17 +3542,10 @@ Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc )
pBmp = (BITMAPOBJ *) GDI_GetObjPtr( hBmp, BITMAP_MAGIC );
if (pBmp->DDBitmap && pBmp->DDBitmap->physBitmap)
{
pixmap = ((X11DRV_PHYSBITMAP *)(pBmp->DDBitmap->physBitmap))->pixmap;
if (!pixmap)
TRACE("NULL Pixmap in DDBitmap->physBitmap!\n");
/* Manually free the BITMAPOBJ internals so that we can steal its pixmap */
HeapFree( GetProcessHeap(), 0, pBmp->DDBitmap->physBitmap );
HeapFree( GetProcessHeap(), 0, pBmp->DDBitmap );
pBmp->DDBitmap = NULL; /* Its not a DDB anymore */
}
pixmap = (Pixmap)pBmp->physBitmap;
/* clear the physBitmap so that we can steal its pixmap */
pBmp->physBitmap = NULL;
pBmp->funcs = NULL;
/* Delete the DDB we created earlier now that we have stolen its pixmap */
DeleteObject(hBmp);
......
......@@ -30,7 +30,7 @@ static BOOL X11DRV_DeleteDC( DC *dc );
static INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput,
SEGPTR lpInData, SEGPTR lpOutData );
static const DC_FUNCTIONS X11DRV_Funcs =
const DC_FUNCTIONS X11DRV_DC_Funcs =
{
NULL, /* pAbortDoc */
NULL, /* pAbortPath */
......@@ -210,7 +210,7 @@ BOOL X11DRV_GDI_Initialize(void)
if (!X11DRV_FONT_Init( &X11DRV_DevCaps )) return FALSE;
return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs );
return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_DC_Funcs );
}
/**********************************************************************
......@@ -239,12 +239,10 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
dc->w.devCaps = &X11DRV_DevCaps;
if (dc->w.flags & DC_MEMORY)
{
X11DRV_PHYSBITMAP *pbitmap;
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( dc->w.hBitmap,
BITMAP_MAGIC );
X11DRV_CreateBitmap( dc->w.hBitmap );
pbitmap = bmp->DDBitmap->physBitmap;
physDev->drawable = pbitmap->pixmap;
physDev->drawable = (Pixmap)bmp->physBitmap;
physDev->gc = TSXCreateGC(display, physDev->drawable, 0, NULL);
dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
......
......@@ -345,7 +345,6 @@ static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
{
HBITMAP16 hbitmap;
BITMAPOBJ * bmpObjPtr;
X11DRV_PHYSBITMAP *pbitmap;
if (!pixmap) return 0;
......@@ -364,9 +363,8 @@ static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
bmpObjPtr->bitmap.bmBits = NULL;
bmpObjPtr->dib = NULL;
pbitmap = X11DRV_AllocBitmap(bmpObjPtr);
pbitmap->pixmap = pixmap;
bmpObjPtr->funcs = &X11DRV_DC_Funcs;
bmpObjPtr->physBitmap = (void *)pixmap;
GDI_HEAP_UNLOCK( hbitmap );
return hbitmap;
......@@ -532,11 +530,10 @@ static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL fCursor )
if (descr.mask)
{
X11DRV_PHYSBITMAP *pbitmapAnd = bmpAnd->DDBitmap->physBitmap;
/* Invert the mask */
TSXSetFunction( display, BITMAP_monoGC, GXinvert );
TSXFillRectangle( display, pbitmapAnd->pixmap, BITMAP_monoGC, 0, 0,
TSXFillRectangle( display, (Pixmap)bmpAnd->physBitmap, BITMAP_monoGC, 0, 0,
bmpAnd->bitmap.bmWidth, bmpAnd->bitmap.bmHeight );
TSXSetFunction( display, BITMAP_monoGC, GXcopy );
......@@ -544,14 +541,13 @@ static HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL fCursor )
if (bmpXor->bitmap.bmBitsPixel != 1)
{
X11DRV_PHYSBITMAP *pbitmapXor = bmpXor->DDBitmap->physBitmap;
TSXSetForeground( display, BITMAP_colorGC,
X11DRV_PALETTE_ToPhysical( NULL, RGB(0,0,0) ));
TSXSetBackground( display, BITMAP_colorGC, 0 );
TSXSetFunction( display, BITMAP_colorGC, GXor );
TSXCopyPlane(display, pbitmapAnd->pixmap, pbitmapXor->pixmap, BITMAP_colorGC,
0, 0, bmpXor->bitmap.bmWidth, bmpXor->bitmap.bmHeight,
0, 0, 1 );
TSXCopyPlane(display, (Pixmap)bmpAnd->physBitmap, (Pixmap)bmpXor->physBitmap,
BITMAP_colorGC, 0, 0, bmpXor->bitmap.bmWidth, bmpXor->bitmap.bmHeight,
0, 0, 1 );
TSXSetFunction( display, BITMAP_colorGC, GXcopy );
}
}
......
......@@ -18,20 +18,14 @@ struct tagGDI_BITMAP_DRIVER;
#define DDB_COPY 4
#define DDB_SETWITHFILLER 8
typedef struct {
const struct tagDC_FUNCS *funcs; /* DC function table */
void *physBitmap; /* ptr to device specific data */
} DDBITMAP;
/* GDI logical bitmap object */
typedef struct tagBITMAPOBJ
{
GDIOBJHDR header;
BITMAP bitmap;
SIZE size; /* For SetBitmapDimension() */
DDBITMAP *DDBitmap;
const struct tagDC_FUNCS *funcs; /* DC function table */
void *physBitmap; /* ptr to device specific data */
/* For device-independent bitmaps: */
DIBSECTION *dib;
} BITMAPOBJ;
......
......@@ -70,10 +70,6 @@ typedef struct
} X11DRV_PDEVICE;
typedef struct {
Pixmap pixmap;
} X11DRV_PHYSBITMAP;
/* GCs used for B&W and color bitmap operations */
extern GC BITMAP_monoGC, BITMAP_colorGC;
......@@ -84,6 +80,8 @@ extern DeviceCaps X11DRV_DevCaps;
/* Wine driver X11 functions */
extern const DC_FUNCTIONS X11DRV_DC_Funcs;
extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
INT width, INT height, struct tagDC *dcSrc,
INT xSrc, INT ySrc, DWORD rop );
......@@ -167,7 +165,6 @@ struct tagBITMAPOBJ;
extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
extern int X11DRV_DIB_GetXImageWidthBytes( int width, int depth );
extern BOOL X11DRV_DIB_Init(void);
extern X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( struct tagBITMAPOBJ *bmp );
extern HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap);
extern HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc, BOOL bDeletePixmap);
extern HBITMAP X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap, BOOL bDeletePixmap);
......
......@@ -140,7 +140,8 @@ HBITMAP WINAPI CreateBitmap( INT width, INT height, UINT planes,
bmp->bitmap.bmWidthBytes = BITMAP_GetWidthBytes( width, bpp );
bmp->bitmap.bmBits = NULL;
bmp->DDBitmap = NULL;
bmp->funcs = NULL;
bmp->physBitmap = NULL;
bmp->dib = NULL;
if (bits) /* Set bitmap bits */
......@@ -273,12 +274,11 @@ LONG WINAPI GetBitmapBits(
hbitmap, count, bits, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
1 << bmp->bitmap.bmBitsPixel, height );
if(bmp->DDBitmap) {
if(bmp->funcs) {
TRACE("Calling device specific BitmapBits\n");
if(bmp->DDBitmap->funcs->pBitmapBits)
ret = bmp->DDBitmap->funcs->pBitmapBits(hbitmap, bits, count,
DDB_GET);
if(bmp->funcs->pBitmapBits)
ret = bmp->funcs->pBitmapBits(hbitmap, bits, count, DDB_GET);
else {
ERR("BitmapBits == NULL??\n");
ret = 0;
......@@ -342,12 +342,11 @@ LONG WINAPI SetBitmapBits(
hbitmap, count, bits, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
1 << bmp->bitmap.bmBitsPixel, height );
if(bmp->DDBitmap) {
if(bmp->funcs) {
TRACE("Calling device specific BitmapBits\n");
if(bmp->DDBitmap->funcs->pBitmapBits)
ret = bmp->DDBitmap->funcs->pBitmapBits(hbitmap, (void *) bits,
count, DDB_SET);
if(bmp->funcs->pBitmapBits)
ret = bmp->funcs->pBitmapBits(hbitmap, (void *) bits, count, DDB_SET);
else {
ERR("BitmapBits == NULL??\n");
ret = 0;
......@@ -403,10 +402,8 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
*/
BOOL BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bmp )
{
if( bmp->DDBitmap ) {
if( bmp->DDBitmap->funcs->pDeleteObject )
bmp->DDBitmap->funcs->pDeleteObject( hbitmap );
}
if (bmp->funcs && bmp->funcs->pDeleteObject)
bmp->funcs->pDeleteObject( hbitmap );
if( bmp->bitmap.bmBits )
HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment