On 13 Apr 2005 17:11:57 +0200, you wrote: > Rein Klazes <[EMAIL PROTECTED]> writes: > > > --- wine/dlls/x11drv/dib.c 2005-04-13 08:55:39.000000000 +0200 > > +++ mywine/dlls/x11drv/dib.c 2005-04-13 13:24:10.000000000 +0200 > > @@ -3484,6 +3484,41 @@ static void X11DRV_DIB_GetImageBits_32( > > } > > } > > > > +static int XGetSubImageErrorHandler(Display *dpy, XErrorEvent *event, void > > *arg) > > +{ > > + return 1; > > +} > > You should check that this was really a BadMatch error from > XGetSubImage, we don't want to blindly ignore all errors.
I think you want this. Changelog: dlls/x11drv : dib.c In X11DRV_DIB_SetImageBits avoid BadMatch errors when calling XGetSubImage. Rein.
--- wine/dlls/x11drv/dib.c 2005-04-13 08:55:39.000000000 +0200 +++ mywine/dlls/x11drv/dib.c 2005-04-13 18:11:40.000000000 +0200 @@ -3484,6 +3484,40 @@ static void X11DRV_DIB_GetImageBits_32( } } +static int XGetSubImageErrorHandler(Display *dpy, XErrorEvent *event, void *arg) +{ + if( event->error_code == BadMatch) return 1; + return 0; +} +/*********************************************************************** + * X11DRV_DIB_SetImageBits_GetSubImage + * + * Helper for X11DRV_DIB_SetImageBits + */ +static void X11DRV_DIB_SetImageBits_GetSubImage( + const X11DRV_DIB_IMAGEBITS_DESCR *descr, XImage *bmpImage) +{ + /* compressed bitmaps may contain gaps in them. So make a copy + * of the existing pixels first */ + RECT bmprc = { descr->xDest, descr->yDest, + descr->xDest + descr->width , descr->yDest + descr->height}; + RECT rc; + + GetRgnBox( descr->physDev->region, &rc ); + /* convert from dc to drawable origin */ + OffsetRect( &rc, descr->physDev->org.x, descr->physDev->org.y); + /* clip visible rect with bitmap */ + if( IntersectRect( &rc, &rc, &bmprc)){ + X11DRV_expect_error( gdi_display,XGetSubImageErrorHandler, NULL ); + XGetSubImage( gdi_display, descr->drawable, rc.left, rc.top, + rc.right - rc.left, rc.bottom - rc.top, AllPlanes, + ZPixmap, bmpImage, + descr->xSrc + rc.left - bmprc.left, + descr->ySrc + rc.top - bmprc.top); + X11DRV_check_error(); + } +} + /*********************************************************************** * X11DRV_DIB_SetImageBits * @@ -3526,10 +3560,7 @@ static int X11DRV_DIB_SetImageBits( cons break; case 4: if (descr->compression) { - XGetSubImage( gdi_display, descr->drawable, descr->xDest, descr->yDest, - descr->width, descr->height, AllPlanes, ZPixmap, - bmpImage, descr->xSrc, descr->ySrc ); - + X11DRV_DIB_SetImageBits_GetSubImage( descr, bmpImage); X11DRV_DIB_SetImageBits_RLE4( descr->lines, descr->bits, descr->infoWidth, descr->width, descr->xSrc, (int *)(descr->colorMap), @@ -3542,9 +3573,7 @@ static int X11DRV_DIB_SetImageBits( cons break; case 8: if (descr->compression) { - XGetSubImage( gdi_display, descr->drawable, descr->xDest, descr->yDest, - descr->width, descr->height, AllPlanes, ZPixmap, - bmpImage, descr->xSrc, descr->ySrc ); + X11DRV_DIB_SetImageBits_GetSubImage( descr, bmpImage); X11DRV_DIB_SetImageBits_RLE8( descr->lines, descr->bits, descr->infoWidth, descr->width, descr->xSrc, (int *)(descr->colorMap),