diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c index 15c71a2a0..38ff17d84 100644 --- a/hw/dmx/dmxscrinit.c +++ b/hw/dmx/dmxscrinit.c @@ -119,44 +119,48 @@ dmxShmPutImage (DrawablePtr pDraw, XLIB_PROLOGUE (dmxScreen); image = XCreateImage (dmxScreen->beDisplay, dmxScreen->beVisuals[vIndex].visual, - depth, format, 0, data, sw, sh, + depth, format, 0, data, w, h, BitmapPad (dmxScreen->beDisplay), (format == ZPixmap) ? - PixmapBytePad (sw, depth) : BitmapBytePad (sw)); + PixmapBytePad (w, depth) : BitmapBytePad (w)); XLIB_EPILOGUE (dmxScreen); if (image) { - RegionRec reg, clip; + RegionRec reg; BoxRec src, dst; BoxPtr pBox; int nBox; src.x1 = dx - sx; src.y1 = dy - sy; - src.x2 = src.x1 + sw; - src.y2 = src.y1 + sh; + src.x2 = src.x1 + w; + src.y2 = src.y1 + h; dst.x1 = dx; dst.y1 = dy; - dst.x2 = dst.x1 + w; - dst.y2 = dst.y1 + h; + dst.x2 = dst.x1 + sw; + dst.y2 = dst.y1 + sh; - if (src.x1 < dst.x1) - src.x1 = dst.x1; - if (src.y1 < dst.y1) - src.y1 = dst.y1; - if (src.x2 > dst.x2) - src.x2 = dst.x2; - if (src.y2 > dst.y2) - src.y2 = dst.y2; + if (src.x1 > dst.x1) + dst.x1 = src.x1; + if (src.y1 > dst.y1) + dst.y1 = src.y1; + if (src.x2 < dst.x2) + dst.x2 = src.x2; + if (src.y2 < dst.y2) + dst.y2 = src.y2; - REGION_INIT (pGC->pScreen, ®, &src, 0); - REGION_INIT (pGC->pScreen, &clip, &miEmptyBox, 0); - - REGION_COPY (pGC->pScreen, &clip, pGC->pCompositeClip); - REGION_TRANSLATE (pGC->pScreen, &clip, -pDraw->x, -pDraw->y); - REGION_INTERSECT (pGC->pScreen, ®, ®, &clip); + REGION_INIT (pGC->pScreen, ®, &dst, 0); + + if (pGC->pCompositeClip) + { + REGION_TRANSLATE (pGC->pScreen, pGC->pCompositeClip, + -pDraw->x, -pDraw->y); + REGION_INTERSECT (pGC->pScreen, ®, ®, pGC->pCompositeClip); + REGION_TRANSLATE (pGC->pScreen, pGC->pCompositeClip, + pDraw->x, pDraw->y); + } nBox = REGION_NUM_RECTS (®); pBox = REGION_RECTS (®);