Commit 09eb59d3 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 10784991
......@@ -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
{
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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 )
{
......
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