Store the handle to the stock bitmap when the first DC is created to

avoid exporting the DEFAULT_BITMAP define.
This commit is contained in:
Alexandre Julliard 2005-03-27 18:19:59 +00:00
parent c91df67f11
commit 3a522f3d71
5 changed files with 9 additions and 6 deletions

View File

@ -28,6 +28,9 @@
#define METAFILE_MEMORY 1 #define METAFILE_MEMORY 1
#define METAFILE_DISK 2 #define METAFILE_DISK 2
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
struct gdi_obj_funcs struct gdi_obj_funcs
{ {
HGDIOBJ (*pSelectObject)( HGDIOBJ handle, void *obj, HDC hdc ); HGDIOBJ (*pSelectObject)( HGDIOBJ handle, void *obj, HDC hdc );

View File

@ -34,7 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
/* GCs used for B&W and color bitmap operations */ /* GCs used for B&W and color bitmap operations */
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0; GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
Pixmap BITMAP_stock_pixmap; /* pixmap for the default stock bitmap */ HBITMAP BITMAP_stock_bitmap = 0; /* default stock bitmap */
Pixmap BITMAP_stock_pixmap = 0; /* pixmap for the default stock bitmap */
/*********************************************************************** /***********************************************************************
* X11DRV_BITMAP_Init * X11DRV_BITMAP_Init
@ -76,7 +77,7 @@ HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
if(physDev->xrender) if(physDev->xrender)
X11DRV_XRender_UpdateDrawable( physDev ); X11DRV_XRender_UpdateDrawable( physDev );
if (hbitmap == GetStockObject(DEFAULT_BITMAP)) if (hbitmap == BITMAP_stock_bitmap)
physDev->drawable = BITMAP_stock_pixmap; physDev->drawable = BITMAP_stock_pixmap;
else else
physDev->drawable = (Pixmap)bmp->physBitmap; physDev->drawable = (Pixmap)bmp->physBitmap;
@ -128,7 +129,7 @@ BOOL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
GDI_ReleaseObj( hbitmap ); GDI_ReleaseObj( hbitmap );
return FALSE; return FALSE;
} }
if (hbitmap == GetStockObject(DEFAULT_BITMAP)) if (hbitmap == BITMAP_stock_bitmap)
{ {
ERR( "called for stock bitmap, please report\n" ); ERR( "called for stock bitmap, please report\n" );
GDI_ReleaseObj( hbitmap ); GDI_ReleaseObj( hbitmap );

View File

@ -139,6 +139,7 @@ BOOL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR de
if (GetObjectType( hdc ) == OBJ_MEMDC) if (GetObjectType( hdc ) == OBJ_MEMDC)
{ {
if (!BITMAP_stock_bitmap) BITMAP_stock_bitmap = GetCurrentObject( hdc, OBJ_BITMAP );
physDev->drawable = BITMAP_stock_pixmap; physDev->drawable = BITMAP_stock_pixmap;
physDev->depth = 1; physDev->depth = 1;
} }

View File

@ -111,6 +111,7 @@ typedef struct
/* GCs used for B&W and color bitmap operations */ /* GCs used for B&W and color bitmap operations */
extern GC BITMAP_monoGC, BITMAP_colorGC; extern GC BITMAP_monoGC, BITMAP_colorGC;
extern HBITMAP BITMAP_stock_bitmap; /* default stock bitmap */
extern Pixmap BITMAP_stock_pixmap; /* pixmap for the default stock bitmap */ extern Pixmap BITMAP_stock_pixmap; /* pixmap for the default stock bitmap */
#define BITMAP_GC(bmp) \ #define BITMAP_GC(bmp) \

View File

@ -65,9 +65,6 @@ typedef struct tagGDIOBJHDR
struct hdc_list *hdcs; struct hdc_list *hdcs;
} GDIOBJHDR; } GDIOBJHDR;
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
/* bitmap object */ /* bitmap object */
typedef struct tagBITMAPOBJ typedef struct tagBITMAPOBJ