From 5901a67fc85ac80fabfa98b78202a388445275c3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 3 Jun 2009 10:00:50 +0000 Subject: [PATCH] Fix some drawable abuse in i830_dri.c We were casting pixmaps to drawables even if they weren't pixmaps. They did happen to work out since we only used the drawable record out of them. --- src/i830_dri.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/i830_dri.c b/src/i830_dri.c index 8b2629f0..667f687e 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -285,10 +285,11 @@ I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - PixmapPtr pSrcPixmap = (srcPrivate->attachment == DRI2BufferFrontLeft) - ? (PixmapPtr) pDraw : srcPrivate->pPixmap; - PixmapPtr pDstPixmap = (dstPrivate->attachment == DRI2BufferFrontLeft) - ? (PixmapPtr) pDraw : dstPrivate->pPixmap; + DrawablePtr src = (srcPrivate->attachment == DRI2BufferFrontLeft) + ? pDraw : &srcPrivate->pPixmap->drawable; + DrawablePtr dst = (dstPrivate->attachment == DRI2BufferFrontLeft) + ? pDraw : &dstPrivate->pPixmap->drawable; + PixmapPtr dst_pixmap = get_drawable_pixmap(dst); RegionPtr pCopyClip; GCPtr pGC; @@ -296,7 +297,7 @@ I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, pCopyClip = REGION_CREATE(pScreen, NULL, 0); REGION_COPY(pScreen, pCopyClip, pRegion); (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pCopyClip, 0); - ValidateGC(&pDstPixmap->drawable, pGC); + ValidateGC(dst, pGC); /* Wait for the scanline to be outside the region to be copied */ if (dstPrivate->attachment == DRI2BufferFrontLeft) { @@ -338,7 +339,7 @@ I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, ADVANCE_BATCH(); } - (*pGC->ops->CopyArea)(&pSrcPixmap->drawable, &pDstPixmap->drawable, + (*pGC->ops->CopyArea)(src, dst, pGC, 0, 0, pDraw->width, pDraw->height, 0, 0); FreeScratchGC(pGC);