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.
This commit is contained in:
Eric Anholt 2009-06-03 10:00:50 +00:00
parent 5e48146777
commit 5901a67fc8
1 changed files with 7 additions and 6 deletions

View File

@ -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);