diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 887384efef8..2db9e70e373 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1365,16 +1365,21 @@ DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, if (X11DRV_check_error()) { /* use a temporary pixmap to avoid the BadMatch error */ + GC gc; Pixmap pixmap; wine_tsx11_lock(); pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth ); - XCopyArea( gdi_display, physdev->drawable, pixmap, get_bitmap_gc(vis.depth), + gc = XCreateGC( gdi_display, pixmap, 0, NULL ); + XSetGraphicsExposures( gdi_display, gc, False ); + XCopyArea( gdi_display, physdev->drawable, pixmap, gc, physdev->dc_rect.left + x, physdev->dc_rect.top + y, width, height, 0, 0 ); image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); XFreePixmap( gdi_display, pixmap ); + XFreeGC( gdi_display, gc ); wine_tsx11_unlock(); } + if (!image) return ERROR_OUTOFMEMORY; info->bmiHeader.biWidth = width; @@ -1408,6 +1413,7 @@ static DWORD put_pixmap_image( Pixmap pixmap, const XVisualInfo *vis, { DWORD ret; XImage *image; + GC gc; struct bitblt_coords coords; struct gdi_image_bits dst_bits; const XPixmapFormatValues *format = pixmap_formats[vis->depth]; @@ -1439,8 +1445,9 @@ static DWORD put_pixmap_image( Pixmap pixmap, const XVisualInfo *vis, { image->data = dst_bits.ptr; wine_tsx11_lock(); - XPutImage( gdi_display, pixmap, get_bitmap_gc( vis->depth ), - image, 0, 0, 0, 0, coords.width, coords.height ); + gc = XCreateGC( gdi_display, pixmap, 0, NULL ); + XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, coords.width, coords.height ); + XFreeGC( gdi_display, gc ); wine_tsx11_unlock(); image->data = NULL; } diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c index 27723ef92fb..eb423a2444b 100644 --- a/dlls/winex11.drv/bitmap.c +++ b/dlls/winex11.drv/bitmap.c @@ -36,7 +36,7 @@ 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) +static GC get_bitmap_gc(int depth) { if(depth < 1 || depth > 32) return 0; diff --git a/dlls/winex11.drv/brush.c b/dlls/winex11.drv/brush.c index 3406190e4e6..23fcce5495a 100644 --- a/dlls/winex11.drv/brush.c +++ b/dlls/winex11.drv/brush.c @@ -110,7 +110,7 @@ static Pixmap BRUSH_DitherColor( COLORREF color, int depth) static COLORREF prevColor = 0xffffffff; unsigned int x, y; Pixmap pixmap; - GC gc = get_bitmap_gc(depth); + GC gc; wine_tsx11_lock(); if (!ditherImage) @@ -149,8 +149,9 @@ static Pixmap BRUSH_DitherColor( COLORREF color, int depth) } pixmap = XCreatePixmap( gdi_display, root_window, MATRIX_SIZE, MATRIX_SIZE, depth ); - XPutImage( gdi_display, pixmap, gc, ditherImage, 0, 0, - 0, 0, MATRIX_SIZE, MATRIX_SIZE ); + gc = XCreateGC( gdi_display, pixmap, 0, NULL ); + XPutImage( gdi_display, pixmap, gc, ditherImage, 0, 0, 0, 0, MATRIX_SIZE, MATRIX_SIZE ); + XFreeGC( gdi_display, gc ); wine_tsx11_unlock(); return pixmap; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 0b10ecf9509..0d9746afb45 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -164,9 +164,6 @@ static inline void add_bounds_rect( RECT *bounds, const RECT *rect ) extern X_PHYSBITMAP BITMAP_stock_phys_bitmap DECLSPEC_HIDDEN; /* phys bitmap for the default stock bitmap */ -/* Retrieve the GC used for bitmap operations */ -extern GC get_bitmap_gc(int depth) DECLSPEC_HIDDEN; - /* Wine driver X11 functions */ extern BOOL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right, diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 0c66ff84f0c..68a2b4de04c 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -1876,6 +1876,7 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits int depth = pict_formats[format]->depth; struct gdi_image_bits dst_bits; XRenderPictureAttributes pa; + GC gc; XImage *image; wine_tsx11_lock(); @@ -1894,9 +1895,10 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits wine_tsx11_lock(); *pixmap = XCreatePixmap( gdi_display, root_window, width, height, depth ); - XPutImage( gdi_display, *pixmap, get_bitmap_gc( depth ), image, - src->visrect.left, 0, 0, 0, width, height ); + gc = XCreateGC( gdi_display, *pixmap, 0, NULL ); + XPutImage( gdi_display, *pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height ); *pict = pXRenderCreatePicture( gdi_display, *pixmap, pict_formats[format], CPRepeat, &pa ); + XFreeGC( gdi_display, gc ); wine_tsx11_unlock(); /* make coordinates relative to the pixmap */