diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-09-29 08:56:59 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-30 10:04:55 +1000 |
commit | d3ba814884154150ed3e6a71254dec7312593488 (patch) | |
tree | 534981a681b423d6f86a8318ac02d57b772f3bf6 /Xext | |
parent | 8fc0d54cbaf791d947c7bab23f2e982cabd7c958 (diff) |
Fix ShmPutImage non-ZPixmap case.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=23298 .
(cherry picked from commit 11817a881cb93a89788105d1e575a468f2a8d27c)
Diffstat (limited to 'Xext')
-rw-r--r-- | Xext/shm.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/Xext/shm.c b/Xext/shm.c index e4f08e2a2..a6f804cd5 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -497,15 +497,40 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC, char *data) { PixmapPtr pPixmap; - - pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth, - BitsPerPixel(depth), - PixmapBytePad(w, depth), - data); - if (!pPixmap) - return; - pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy); - FreeScratchPixmapHeader(pPixmap); + + if (format == ZPixmap || depth == 1) { + pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth, + BitsPerPixel(depth), + PixmapBytePad(w, depth), + data); + if (!pPixmap) + return; + pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy); + 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 |