gdi32: Set the initial bits of a bitmap from the gdi side.

This commit is contained in:
Alexandre Julliard 2011-08-03 11:37:02 +02:00
parent 107849916f
commit 09eb59d3c6
5 changed files with 24 additions and 22 deletions

View File

@ -657,6 +657,12 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
}
static void set_initial_bitmap_bits( HBITMAP hbitmap, BITMAPOBJ *bmp )
{
if (!bmp->bitmap.bmBits) return;
SetBitmapBits( hbitmap, bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes, bmp->bitmap.bmBits );
}
/***********************************************************************
* BITMAP_SetOwnerDC
*
@ -681,8 +687,12 @@ BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev )
{
if (physdev->funcs->pCreateBitmap)
{
ret = physdev->funcs->pCreateBitmap( physdev, hbitmap, bitmap->bitmap.bmBits );
if (ret) bitmap->funcs = physdev->funcs;
ret = physdev->funcs->pCreateBitmap( physdev, hbitmap );
if (ret)
{
bitmap->funcs = physdev->funcs;
set_initial_bitmap_bits( hbitmap, bitmap );
}
}
else
{

View File

@ -213,7 +213,7 @@ static BOOL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom
return TRUE;
}
static BOOL nulldrv_CreateBitmap( PHYSDEV dev, HBITMAP bitmap, LPVOID bits )
static BOOL nulldrv_CreateBitmap( PHYSDEV dev, HBITMAP bitmap )
{
return TRUE;
}

View File

@ -132,7 +132,7 @@ HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
*
* Returns TRUE on success else FALSE
*/
BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits )
BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap )
{
X_PHYSBITMAP *physBitmap;
BITMAP bitmap;
@ -178,6 +178,13 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits )
/* Create the pixmap */
physBitmap->pixmap = XCreatePixmap(gdi_display, root_window,
bitmap.bmWidth, bitmap.bmHeight, physBitmap->pixmap_depth);
if (physBitmap->pixmap)
{
GC gc = get_bitmap_gc(physBitmap->pixmap_depth);
XSetFunction( gdi_display, gc, GXclear );
XFillRectangle( gdi_display, physBitmap->pixmap, gc, 0, 0, bitmap.bmWidth, bitmap.bmHeight );
XSetFunction( gdi_display, gc, GXcopy );
}
wine_tsx11_unlock();
if (!physBitmap->pixmap)
{
@ -185,21 +192,6 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits )
HeapFree( GetProcessHeap(), 0, physBitmap );
return FALSE;
}
if (bmBits) /* Set bitmap bits */
{
X11DRV_SetBitmapBits( hbitmap, bmBits, bitmap.bmHeight * bitmap.bmWidthBytes );
}
else /* else clear the bitmap */
{
GC gc = get_bitmap_gc(physBitmap->pixmap_depth);
wine_tsx11_lock();
XSetFunction( gdi_display, gc, GXclear );
XFillRectangle( gdi_display, physBitmap->pixmap, gc, 0, 0,
bitmap.bmWidth, bitmap.bmHeight );
XSetFunction( gdi_display, gc, GXcopy );
wine_tsx11_unlock();
}
return TRUE;
}

View File

@ -187,7 +187,7 @@ extern BOOL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN;
extern HBITMAP X11DRV_CreateDIBSection( PHYSDEV dev, HBITMAP hbitmap,
const BITMAPINFO *bmi, UINT usage ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN;

View File

@ -64,7 +64,7 @@ struct gdi_dc_funcs
INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pCloseFigure)(PHYSDEV);
BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP,LPVOID);
BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP);
BOOL (*pCreateDC)(HDC,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
HBITMAP (*pCreateDIBSection)(PHYSDEV,HBITMAP,const BITMAPINFO *,UINT);
BOOL (*pDeleteBitmap)(HBITMAP);
@ -189,7 +189,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 9
#define WINE_GDI_DRIVER_VERSION 10
static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
{