Commit 73919154 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Always allocate a new GC for bitmap operations.

parent 567340f0
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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,
......
......@@ -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 */
......
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