Store a pointer to the currently selected phys bitmap in the device
structure. Create a phys bitmap for the default stock bitmap too.
This commit is contained in:
parent
3f379d96ae
commit
0e49a5b0b9
|
@ -1177,10 +1177,10 @@ static BOOL BITBLT_GetVisRectangles( X11DRV_PDEVICE *physDevDst, INT xDst, INT y
|
|||
if (heightSrc < 0) SWAP_INT32( &rect.top, &rect.bottom );
|
||||
/* Apparently the clipping and visible regions are only for output,
|
||||
so just check against dc extent here to avoid BadMatch errors */
|
||||
if (GetObjectType( physDevSrc->hdc ) == OBJ_MEMDC)
|
||||
if (physDevSrc->bitmap)
|
||||
{
|
||||
BITMAP bm;
|
||||
GetObjectW( GetCurrentObject(physDevSrc->hdc,OBJ_BITMAP), sizeof(bm), &bm );
|
||||
GetObjectW( physDevSrc->bitmap->hbitmap, sizeof(bm), &bm );
|
||||
SetRect( &clipRect, 0, 0, bm.bmWidth, bm.bmHeight );
|
||||
}
|
||||
else SetRect( &clipRect, 0, 0, screen_width, screen_height );
|
||||
|
|
|
@ -34,8 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
|
|||
|
||||
/* GCs used for B&W and color bitmap operations */
|
||||
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
|
||||
HBITMAP BITMAP_stock_bitmap = 0; /* default stock bitmap */
|
||||
Pixmap BITMAP_stock_pixmap = 0; /* pixmap for the default stock bitmap */
|
||||
X_PHYSBITMAP BITMAP_stock_phys_bitmap = { 0 }; /* phys bitmap for the default stock bitmap */
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_BITMAP_Init
|
||||
|
@ -47,8 +46,9 @@ void X11DRV_BITMAP_Init(void)
|
|||
/* Create the necessary GCs */
|
||||
|
||||
wine_tsx11_lock();
|
||||
BITMAP_stock_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 );
|
||||
BITMAP_monoGC = XCreateGC( gdi_display, BITMAP_stock_pixmap, 0, NULL );
|
||||
BITMAP_stock_phys_bitmap.pixmap_depth = 1;
|
||||
BITMAP_stock_phys_bitmap.pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 );
|
||||
BITMAP_monoGC = XCreateGC( gdi_display, BITMAP_stock_phys_bitmap.pixmap, 0, NULL );
|
||||
XSetGraphicsExposures( gdi_display, BITMAP_monoGC, False );
|
||||
XSetSubwindowMode( gdi_display, BITMAP_monoGC, IncludeInferiors );
|
||||
|
||||
|
@ -70,29 +70,22 @@ void X11DRV_BITMAP_Init(void)
|
|||
*/
|
||||
HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
|
||||
{
|
||||
int depth;
|
||||
X_PHYSBITMAP *physBitmap;
|
||||
|
||||
if(physDev->xrender)
|
||||
X11DRV_XRender_UpdateDrawable( physDev );
|
||||
|
||||
if (hbitmap == BITMAP_stock_bitmap)
|
||||
{
|
||||
physDev->drawable = BITMAP_stock_pixmap;
|
||||
depth = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
X_PHYSBITMAP *physBitmap = X11DRV_get_phys_bitmap( hbitmap );
|
||||
if (!physBitmap) return 0;
|
||||
physDev->drawable = physBitmap->pixmap;
|
||||
depth = physBitmap->pixmap_depth;
|
||||
}
|
||||
if (hbitmap == BITMAP_stock_phys_bitmap.hbitmap) physBitmap = &BITMAP_stock_phys_bitmap;
|
||||
else if (!(physBitmap = X11DRV_get_phys_bitmap( hbitmap ))) return 0;
|
||||
|
||||
physDev->bitmap = physBitmap;
|
||||
physDev->drawable = physBitmap->pixmap;
|
||||
|
||||
/* Change GC depth if needed */
|
||||
|
||||
if (physDev->depth != depth)
|
||||
if (physDev->depth != physBitmap->pixmap_depth)
|
||||
{
|
||||
physDev->depth = depth;
|
||||
physDev->depth = physBitmap->pixmap_depth;
|
||||
wine_tsx11_lock();
|
||||
XFreeGC( gdi_display, physDev->gc );
|
||||
physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
|
||||
|
@ -132,7 +125,7 @@ BOOL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
|
|||
bmp->bitmap.bmPlanes, bmp->bitmap.bmBitsPixel);
|
||||
goto done;
|
||||
}
|
||||
if (hbitmap == BITMAP_stock_bitmap)
|
||||
if (hbitmap == BITMAP_stock_phys_bitmap.hbitmap)
|
||||
{
|
||||
ERR( "called for stock bitmap, please report\n" );
|
||||
goto done;
|
||||
|
|
|
@ -43,6 +43,41 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(bitmap);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(x11drv);
|
||||
|
||||
/* Additional info for DIB section objects */
|
||||
typedef struct _X11DRV_DIBSECTION
|
||||
{
|
||||
/* Windows DIB section */
|
||||
DIBSECTION dibSection;
|
||||
|
||||
/* Mapping status */
|
||||
int status, p_status;
|
||||
|
||||
/* Color map info */
|
||||
int nColorMap;
|
||||
int *colorMap;
|
||||
|
||||
/* Original dib color table converted to
|
||||
rgb values if usage was DIB_PAL_COLORS */
|
||||
RGBQUAD *colorTable;
|
||||
|
||||
/* Cached XImage */
|
||||
XImage *image;
|
||||
|
||||
#ifdef HAVE_LIBXXSHM
|
||||
/* Shared memory segment info */
|
||||
XShmSegmentInfo shminfo;
|
||||
#endif
|
||||
|
||||
/* Aux buffer access function */
|
||||
void (*copy_aux)(void*ctx, int req);
|
||||
void *aux_ctx;
|
||||
|
||||
/* GDI access lock */
|
||||
CRITICAL_SECTION lock;
|
||||
|
||||
} X11DRV_DIBSECTION;
|
||||
|
||||
|
||||
static int ximageDepthTable[32];
|
||||
|
||||
/* This structure holds the arguments for DIB_SetImageBits() */
|
||||
|
@ -4182,7 +4217,6 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
|
|||
DWORD width, DWORD height)
|
||||
{
|
||||
DIBSECTION dib;
|
||||
HBITMAP hBitmap;
|
||||
X_PHYSBITMAP *physBitmap;
|
||||
int nColorMap = 0, *colorMap = NULL, aColorMap = FALSE;
|
||||
|
||||
|
@ -4190,14 +4224,8 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
|
|||
xSrc, ySrc, xDest, yDest, width, height);
|
||||
/* this function is meant as an optimization for BitBlt,
|
||||
* not to be called otherwise */
|
||||
if (GetObjectType( physDevSrc->hdc ) != OBJ_MEMDC) {
|
||||
ERR("called for non-memory source DC!?\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hBitmap = GetCurrentObject( physDevSrc->hdc, OBJ_BITMAP );
|
||||
physBitmap = X11DRV_get_phys_bitmap( hBitmap );
|
||||
if (!physBitmap || GetObjectW( hBitmap, sizeof(dib), &dib ) != sizeof(dib))
|
||||
physBitmap = physDevSrc->bitmap;
|
||||
if (!physBitmap || GetObjectW( physBitmap->hbitmap, sizeof(dib), &dib ) != sizeof(dib))
|
||||
{
|
||||
ERR("called for non-DIBSection!?\n");
|
||||
return;
|
||||
|
@ -4547,14 +4575,8 @@ static void X11DRV_DIB_Unlock(X_PHYSBITMAP *physBitmap, BOOL commit)
|
|||
*/
|
||||
INT X11DRV_CoerceDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
||||
{
|
||||
HBITMAP hbitmap;
|
||||
X_PHYSBITMAP *physBitmap;
|
||||
|
||||
if (!physDev) return DIB_Status_None;
|
||||
hbitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
|
||||
physBitmap = X11DRV_get_phys_bitmap( hbitmap );
|
||||
if (!physBitmap) return DIB_Status_None;
|
||||
return X11DRV_DIB_Coerce(physBitmap, req, lossy);
|
||||
if (!physDev || !physDev->bitmap) return DIB_Status_None;
|
||||
return X11DRV_DIB_Coerce(physDev->bitmap, req, lossy);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -4562,14 +4584,8 @@ INT X11DRV_CoerceDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
|||
*/
|
||||
INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
||||
{
|
||||
HBITMAP hbitmap;
|
||||
X_PHYSBITMAP *physBitmap;
|
||||
|
||||
if (!physDev) return DIB_Status_None;
|
||||
if (GetObjectType( physDev->hdc ) != OBJ_MEMDC) return DIB_Status_None;
|
||||
hbitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
|
||||
if (!(physBitmap = X11DRV_get_phys_bitmap( hbitmap ))) return DIB_Status_None;
|
||||
return X11DRV_DIB_Lock(physBitmap, req, lossy);
|
||||
if (!physDev || !physDev->bitmap) return DIB_Status_None;
|
||||
return X11DRV_DIB_Lock(physDev->bitmap, req, lossy);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -4577,14 +4593,8 @@ INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
|||
*/
|
||||
void X11DRV_UnlockDIBSection(X11DRV_PDEVICE *physDev, BOOL commit)
|
||||
{
|
||||
HBITMAP hbitmap;
|
||||
X_PHYSBITMAP *physBitmap;
|
||||
|
||||
if (!physDev) return;
|
||||
if (GetObjectType( physDev->hdc ) != OBJ_MEMDC) return;
|
||||
hbitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
|
||||
if (!(physBitmap = X11DRV_get_phys_bitmap( hbitmap ))) return;
|
||||
X11DRV_DIB_Unlock(physBitmap, commit);
|
||||
if (!physDev || !physDev->bitmap) return;
|
||||
X11DRV_DIB_Unlock(physDev->bitmap, commit);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4898,8 +4908,7 @@ UINT X11DRV_SetDIBColorTable( X11DRV_PDEVICE *physDev, UINT start, UINT count, c
|
|||
{
|
||||
X11DRV_DIBSECTION *dib;
|
||||
UINT ret = 0;
|
||||
HBITMAP hBitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
|
||||
X_PHYSBITMAP *physBitmap = X11DRV_get_phys_bitmap( hBitmap );
|
||||
X_PHYSBITMAP *physBitmap = physDev->bitmap;
|
||||
|
||||
if (!physBitmap) return 0;
|
||||
dib = physBitmap->dib;
|
||||
|
@ -4930,8 +4939,7 @@ UINT X11DRV_GetDIBColorTable( X11DRV_PDEVICE *physDev, UINT start, UINT count, R
|
|||
{
|
||||
X11DRV_DIBSECTION *dib;
|
||||
UINT ret = 0;
|
||||
HBITMAP hBitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
|
||||
X_PHYSBITMAP *physBitmap = X11DRV_get_phys_bitmap( hBitmap );
|
||||
X_PHYSBITMAP *physBitmap = physDev->bitmap;
|
||||
|
||||
if (!physBitmap) return 0;
|
||||
dib = physBitmap->dib;
|
||||
|
|
|
@ -139,12 +139,15 @@ BOOL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR de
|
|||
|
||||
if (GetObjectType( hdc ) == OBJ_MEMDC)
|
||||
{
|
||||
if (!BITMAP_stock_bitmap) BITMAP_stock_bitmap = GetCurrentObject( hdc, OBJ_BITMAP );
|
||||
physDev->drawable = BITMAP_stock_pixmap;
|
||||
if (!BITMAP_stock_phys_bitmap.hbitmap)
|
||||
BITMAP_stock_phys_bitmap.hbitmap = GetCurrentObject( hdc, OBJ_BITMAP );
|
||||
physDev->bitmap = &BITMAP_stock_phys_bitmap;
|
||||
physDev->drawable = BITMAP_stock_phys_bitmap.pixmap;
|
||||
physDev->depth = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
physDev->bitmap = NULL;
|
||||
physDev->drawable = root_window;
|
||||
physDev->depth = screen_depth;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ typedef struct
|
|||
X_PHYSFONT font;
|
||||
X_PHYSPEN pen;
|
||||
X_PHYSBRUSH brush;
|
||||
X_PHYSBITMAP *bitmap; /* currently selected bitmap for memory DCs */
|
||||
BOOL has_gdi_font; /* is current font a GDI font? */
|
||||
int backgroundPixel;
|
||||
int textPixel;
|
||||
|
@ -119,8 +120,7 @@ typedef struct
|
|||
|
||||
/* GCs used for B&W and color bitmap operations */
|
||||
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 X_PHYSBITMAP BITMAP_stock_phys_bitmap; /* phys bitmap for the default stock bitmap */
|
||||
|
||||
#define BITMAP_GC(physBitmap) (((physBitmap)->pixmap_depth == 1) ? BITMAP_monoGC : BITMAP_colorGC)
|
||||
|
||||
|
@ -260,40 +260,6 @@ extern void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event );
|
|||
|
||||
/* exported dib functions for now */
|
||||
|
||||
/* Additional info for DIB section objects */
|
||||
typedef struct _X11DRV_DIBSECTION
|
||||
{
|
||||
/* Windows DIB section */
|
||||
DIBSECTION dibSection;
|
||||
|
||||
/* Mapping status */
|
||||
int status, p_status;
|
||||
|
||||
/* Color map info */
|
||||
int nColorMap;
|
||||
int *colorMap;
|
||||
|
||||
/* Original dib color table converted to
|
||||
rgb values if usage was DIB_PAL_COLORS */
|
||||
RGBQUAD *colorTable;
|
||||
|
||||
/* Cached XImage */
|
||||
XImage *image;
|
||||
|
||||
#ifdef HAVE_LIBXXSHM
|
||||
/* Shared memory segment info */
|
||||
XShmSegmentInfo shminfo;
|
||||
#endif
|
||||
|
||||
/* Aux buffer access function */
|
||||
void (*copy_aux)(void*ctx, int req);
|
||||
void *aux_ctx;
|
||||
|
||||
/* GDI access lock */
|
||||
CRITICAL_SECTION lock;
|
||||
|
||||
} X11DRV_DIBSECTION;
|
||||
|
||||
/* DIB Section sync state */
|
||||
enum { DIB_Status_None, DIB_Status_InSync, DIB_Status_GdiMod, DIB_Status_AppMod, DIB_Status_AuxMod };
|
||||
|
||||
|
|
|
@ -1033,8 +1033,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
|
|||
DIBSECTION bmp;
|
||||
|
||||
/* Do we need to disable antialiasing because of palette mode? */
|
||||
HBITMAP hBitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
|
||||
if( GetObjectW( hBitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) {
|
||||
if( !physDev->bitmap || GetObjectW( physDev->bitmap->hbitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) {
|
||||
TRACE("bitmap is not a DIB\n");
|
||||
}
|
||||
else if (bmp.dsBmih.biBitCount <= 8) {
|
||||
|
@ -1622,7 +1621,6 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
|
|||
XRenderPictFormat *src_format;
|
||||
Picture dst_pict, src_pict;
|
||||
Pixmap xpm;
|
||||
HBITMAP hBitmap;
|
||||
DIBSECTION dib;
|
||||
XImage *image;
|
||||
GC gc;
|
||||
|
@ -1666,8 +1664,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
hBitmap = GetCurrentObject( devSrc->hdc, OBJ_BITMAP );
|
||||
if (GetObjectW( hBitmap, sizeof(dib), &dib ) != sizeof(dib))
|
||||
if (!devSrc->bitmap || GetObjectW( devSrc->bitmap->hbitmap, sizeof(dib), &dib ) != sizeof(dib))
|
||||
{
|
||||
FIXME("not a dibsection\n");
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue