Commit e082bf66 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

winex11: Add support for GCs at more depths.

parent 50cfcffd
...@@ -31,20 +31,17 @@ ...@@ -31,20 +31,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(x11drv); 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; static GC bitmap_gc[32];
X_PHYSBITMAP BITMAP_stock_phys_bitmap = { 0 }; /* phys bitmap for the default stock bitmap */ X_PHYSBITMAP BITMAP_stock_phys_bitmap = { 0 }; /* phys bitmap for the default stock bitmap */
static XContext bitmap_context; /* X context to associate a phys bitmap to a handle */ static XContext bitmap_context; /* X context to associate a phys bitmap to a handle */
GC get_bitmap_gc(int depth) GC get_bitmap_gc(int depth)
{ {
switch(depth) if(depth < 1 || depth > 32)
{ return 0;
case 1:
return BITMAP_monoGC; return bitmap_gc[depth-1];
default:
return BITMAP_colorGC;
}
} }
/*********************************************************************** /***********************************************************************
...@@ -52,28 +49,38 @@ GC get_bitmap_gc(int depth) ...@@ -52,28 +49,38 @@ GC get_bitmap_gc(int depth)
*/ */
void X11DRV_BITMAP_Init(void) void X11DRV_BITMAP_Init(void)
{ {
int depth_count, index, i;
int *depth_list;
Pixmap tmpPixmap; Pixmap tmpPixmap;
/* Create the necessary GCs */
wine_tsx11_lock(); wine_tsx11_lock();
bitmap_context = XUniqueContext(); bitmap_context = XUniqueContext();
BITMAP_stock_phys_bitmap.pixmap_depth = 1; BITMAP_stock_phys_bitmap.pixmap_depth = 1;
BITMAP_stock_phys_bitmap.pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 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 ); bitmap_gc[0] = XCreateGC( gdi_display, BITMAP_stock_phys_bitmap.pixmap, 0, NULL );
XSetGraphicsExposures( gdi_display, BITMAP_monoGC, False ); XSetGraphicsExposures( gdi_display, bitmap_gc[0], False );
XSetSubwindowMode( gdi_display, BITMAP_monoGC, IncludeInferiors ); XSetSubwindowMode( gdi_display, bitmap_gc[0], IncludeInferiors );
if (screen_depth != 1) /* Create a GC for all available depths. GCs at depths other than 1-bit/screen_depth are for use
* in combination with XRender which allows us to create dibsections at more depths.
*/
depth_list = XListDepths(gdi_display, DefaultScreen(gdi_display), &depth_count);
for (i = 0; i < depth_count; i++)
{
index = depth_list[i] - 1;
if (bitmap_gc[index]) continue;
if ((tmpPixmap = XCreatePixmap( gdi_display, root_window, 1, 1, depth_list[i])))
{ {
if ((tmpPixmap = XCreatePixmap( gdi_display, root_window, 1, 1, screen_depth ))) if ((bitmap_gc[index] = XCreateGC( gdi_display, tmpPixmap, 0, NULL )))
{ {
BITMAP_colorGC = XCreateGC( gdi_display, tmpPixmap, 0, NULL ); XSetGraphicsExposures( gdi_display, bitmap_gc[index], False );
XSetGraphicsExposures( gdi_display, BITMAP_colorGC, False ); XSetSubwindowMode( gdi_display, bitmap_gc[index], IncludeInferiors );
XSetSubwindowMode( gdi_display, BITMAP_colorGC, IncludeInferiors ); }
XFreePixmap( gdi_display, tmpPixmap ); XFreePixmap( gdi_display, tmpPixmap );
} }
} }
XFree( depth_list );
wine_tsx11_unlock(); wine_tsx11_unlock();
} }
......
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