Fix ShmPutImage non-ZPixmap case.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=23298 .
This commit is contained in:
Michel Dänzer 2009-09-29 08:56:59 +02:00
parent 19be992d9d
commit 11817a881c

View File

@ -498,6 +498,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
{ {
PixmapPtr pPixmap; PixmapPtr pPixmap;
if (format == ZPixmap || depth == 1) {
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth, pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
BitsPerPixel(depth), BitsPerPixel(depth),
PixmapBytePad(w, depth), PixmapBytePad(w, depth),
@ -506,6 +507,30 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
return; return;
pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy); pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy);
FreeScratchPixmapHeader(pPixmap); FreeScratchPixmapHeader(pPixmap);
} else {
GCPtr putGC = GetScratchGC(depth, dst->pScreen);
if (!putGC)
return;
pPixmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth,
CREATE_PIXMAP_USAGE_SCRATCH);
if (!pPixmap) {
FreeScratchGC(putGC);
return;
}
ValidateGC(&pPixmap->drawable, putGC);
(*putGC->ops->PutImage)(&pPixmap->drawable, putGC, depth, -sx, -sy, w, h, 0,
(format == XYPixmap) ? XYPixmap : ZPixmap, data);
FreeScratchGC(putGC);
if (format == XYBitmap)
(void)(*pGC->ops->CopyPlane)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
dx, dy, 1L);
else
(void)(*pGC->ops->CopyArea)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
dx, dy);
(*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap);
}
} }
#ifdef PANORAMIX #ifdef PANORAMIX