winex11: Add a function for retrieving the bitmap GC.
This commit is contained in:
parent
9d14dcab68
commit
618b410aa8
|
@ -36,6 +36,17 @@ X_PHYSBITMAP BITMAP_stock_phys_bitmap = { 0 }; /* phys bitmap for the default s
|
|||
|
||||
static XContext bitmap_context; /* X context to associate a phys bitmap to a handle */
|
||||
|
||||
GC get_bitmap_gc(int depth)
|
||||
{
|
||||
switch(depth)
|
||||
{
|
||||
case 1:
|
||||
return BITMAP_monoGC;
|
||||
default:
|
||||
return BITMAP_colorGC;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_BITMAP_Init
|
||||
*/
|
||||
|
@ -157,11 +168,12 @@ BOOL CDECL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID
|
|||
}
|
||||
else /* else clear the bitmap */
|
||||
{
|
||||
GC gc = get_bitmap_gc(physBitmap->pixmap_depth);
|
||||
wine_tsx11_lock();
|
||||
XSetFunction( gdi_display, BITMAP_GC(physBitmap), GXclear );
|
||||
XFillRectangle( gdi_display, physBitmap->pixmap, BITMAP_GC(physBitmap), 0, 0,
|
||||
XSetFunction( gdi_display, gc, GXclear );
|
||||
XFillRectangle( gdi_display, physBitmap->pixmap, gc, 0, 0,
|
||||
bitmap.bmWidth, bitmap.bmHeight );
|
||||
XSetFunction( gdi_display, BITMAP_GC(physBitmap), GXcopy );
|
||||
XSetFunction( gdi_display, gc, GXcopy );
|
||||
wine_tsx11_unlock();
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -405,7 +417,7 @@ LONG CDECL X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count )
|
|||
FIXME("Unhandled bits:%d\n", bitmap.bmBitsPixel);
|
||||
|
||||
}
|
||||
XPutImage( gdi_display, physBitmap->pixmap, BITMAP_GC(physBitmap),
|
||||
XPutImage( gdi_display, physBitmap->pixmap, get_bitmap_gc(physBitmap->pixmap_depth),
|
||||
image, 0, 0, 0, 0, bitmap.bmWidth, height );
|
||||
HeapFree( GetProcessHeap(), 0, image->data );
|
||||
image->data = NULL;
|
||||
|
|
|
@ -103,13 +103,14 @@ static const COLORREF WHITE = RGB(0xff, 0xff, 0xff);
|
|||
/***********************************************************************
|
||||
* BRUSH_DitherColor
|
||||
*/
|
||||
static Pixmap BRUSH_DitherColor( COLORREF color )
|
||||
static Pixmap BRUSH_DitherColor( COLORREF color, int depth)
|
||||
{
|
||||
/* X image for building dithered pixmap */
|
||||
static XImage *ditherImage = NULL;
|
||||
static COLORREF prevColor = 0xffffffff;
|
||||
unsigned int x, y;
|
||||
Pixmap pixmap;
|
||||
GC gc = get_bitmap_gc(depth);
|
||||
|
||||
if (!ditherImage)
|
||||
{
|
||||
|
@ -144,7 +145,7 @@ static Pixmap BRUSH_DitherColor( COLORREF color )
|
|||
}
|
||||
|
||||
pixmap = XCreatePixmap( gdi_display, root_window, MATRIX_SIZE, MATRIX_SIZE, screen_depth );
|
||||
XPutImage( gdi_display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
|
||||
XPutImage( gdi_display, pixmap, gc, ditherImage, 0, 0,
|
||||
0, 0, MATRIX_SIZE, MATRIX_SIZE );
|
||||
wine_tsx11_unlock();
|
||||
|
||||
|
@ -185,7 +186,7 @@ static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
|
|||
if ((physDev->depth > 1) && (screen_depth <= 8) && !X11DRV_IsSolidColor( color ))
|
||||
{
|
||||
/* Dithered brush */
|
||||
physDev->brush.pixmap = BRUSH_DitherColor( color );
|
||||
physDev->brush.pixmap = BRUSH_DitherColor( color, physDev->depth );
|
||||
physDev->brush.fillStyle = FillTiled;
|
||||
physDev->brush.pixel = 0;
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ static BOOL BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
|
|||
bitmap.bmWidth, bitmap.bmHeight, 1);
|
||||
/* FIXME: should probably convert to monochrome instead */
|
||||
XCopyPlane( gdi_display, physBitmap->pixmap, physDev->brush.pixmap,
|
||||
BITMAP_monoGC, 0, 0, bitmap.bmWidth, bitmap.bmHeight, 0, 0, 1 );
|
||||
get_bitmap_gc(1), 0, 0, bitmap.bmWidth, bitmap.bmHeight, 0, 0, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -230,7 +231,7 @@ static BOOL BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
|
|||
bitmap.bmWidth, bitmap.bmHeight,
|
||||
physBitmap->pixmap_depth );
|
||||
XCopyArea( gdi_display, physBitmap->pixmap, physDev->brush.pixmap,
|
||||
BITMAP_GC(physBitmap), 0, 0, bitmap.bmWidth, bitmap.bmHeight, 0, 0 );
|
||||
get_bitmap_gc(physBitmap->pixmap_depth), 0, 0, bitmap.bmWidth, bitmap.bmHeight, 0, 0 );
|
||||
}
|
||||
wine_tsx11_unlock();
|
||||
|
||||
|
|
|
@ -3984,7 +3984,7 @@ INT CDECL X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
|
|||
descr.lines = tmpheight >= 0 ? lines : -lines;
|
||||
descr.depth = physBitmap->pixmap_depth;
|
||||
descr.drawable = physBitmap->pixmap;
|
||||
descr.gc = BITMAP_GC(physBitmap);
|
||||
descr.gc = get_bitmap_gc(physBitmap->pixmap_depth);
|
||||
descr.xSrc = 0;
|
||||
descr.ySrc = 0;
|
||||
descr.xDest = 0;
|
||||
|
@ -4138,7 +4138,7 @@ INT CDECL X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
|
|||
descr.lines = lines;
|
||||
descr.depth = physBitmap->pixmap_depth;
|
||||
descr.drawable = physBitmap->pixmap;
|
||||
descr.gc = BITMAP_GC(physBitmap);
|
||||
descr.gc = get_bitmap_gc(physBitmap->pixmap_depth);
|
||||
descr.width = dib.dsBm.bmWidth;
|
||||
descr.height = dib.dsBm.bmHeight;
|
||||
descr.xDest = 0;
|
||||
|
@ -4353,7 +4353,7 @@ static void X11DRV_DIB_DoUpdateDIBSection(X_PHYSBITMAP *physBitmap, BOOL toDIB)
|
|||
GetObjectW( physBitmap->hbitmap, sizeof(bitmap), &bitmap );
|
||||
X11DRV_DIB_DoCopyDIBSection(physBitmap, toDIB,
|
||||
physBitmap->colorMap, physBitmap->nColorMap,
|
||||
physBitmap->pixmap, BITMAP_GC(physBitmap),
|
||||
physBitmap->pixmap, get_bitmap_gc(physBitmap->pixmap_depth),
|
||||
0, 0, 0, 0, bitmap.bmWidth, bitmap.bmHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -1072,7 +1072,7 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
|
|||
/* to avoid a BadMatch error */
|
||||
if (!pixmap) pixmap = XCreatePixmap( gdi_display, root_window,
|
||||
1, 1, physDev->depth );
|
||||
XCopyArea( gdi_display, physDev->drawable, pixmap, BITMAP_colorGC,
|
||||
XCopyArea( gdi_display, physDev->drawable, pixmap, get_bitmap_gc(physDev->depth),
|
||||
physDev->dc_rect.left + pt.x, physDev->dc_rect.top + pt.y, 1, 1, 0, 0 );
|
||||
image = XGetImage( gdi_display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap );
|
||||
}
|
||||
|
|
|
@ -144,11 +144,10 @@ typedef struct
|
|||
} X11DRV_PDEVICE;
|
||||
|
||||
|
||||
/* GCs used for B&W and color bitmap operations */
|
||||
extern GC BITMAP_monoGC, BITMAP_colorGC;
|
||||
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)
|
||||
/* Retrieve the GC used for bitmap operations */
|
||||
extern GC get_bitmap_gc(int depth);
|
||||
|
||||
/* Wine driver X11 functions */
|
||||
|
||||
|
|
Loading…
Reference in New Issue