prgnDst = REGION_CREATE(*pWin->drawable.pScreen, NULL, 1);
prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
amigaCVCopyWindow(pWin, ptOldOrg, prgnSrc)     WindowPtr pWin;     DDXPointRec ptOldOrg;     RegionPtr prgnSrc;{   RegionPtr prgnDst;   register BoxPtr pbox, pboxOrig;   register int dx, dy;   register int i, nbox;   short direction = 0;   unsigned int *ordering;   GC    dummyGC;   fbFd *inf = amigaInfo(pWin->drawable.pScreen);   volatile caddr_t vgaBase = (volatile caddr_t) (inf->regs);   dummyGC.subWindowMode = ~IncludeInferiors;   prgnDst = REGION_CREATE(*pWin->drawable.pScreen, NULL, 1);   if ((dx = ptOldOrg.x - pWin->drawable.x) > 0)      direction |= INC_X;   if ((dy = ptOldOrg.y - pWin->drawable.y) > 0)      direction |= INC_Y;   REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);   REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip, prgnSrc);   pboxOrig = REGION_RECTS(prgnDst);   nbox = REGION_NUM_RECTS(prgnDst);   ordering = (unsigned int *)ALLOCATE_LOCAL(nbox * sizeof(unsigned int));   if (!ordering) {      REGION_DESTROY(pWin->drawable.pScreen, prgnDst);      return;   }   amigaCVFindOrdering((DrawablePtr)pWin, (DrawablePtr)pWin, &dummyGC, nbox,			pboxOrig, ptOldOrg.x, ptOldOrg.y,			pWin->drawable.x, pWin->drawable.y, ordering);   BLOCK_CURSOR;   WaitQueue16_32(3,4);   S3_OUTW(FRGD_MIX, FSS_BITBLT | MIX_SRC);   S3_OUTW(BKGD_MIX, BSS_BKGDCOL | MIX_SRC);   S3_OUTW32(WRT_MASK, ~0);   if (direction == (INC_X | INC_Y)) {      for (i = 0; i < nbox; i++) {	 pbox = &pboxOrig[ordering[i]];	 WaitQueue(7); PCI_HACK();	 S3_OUTW(CUR_X, (short)(pbox->x1 + dx));	 S3_OUTW(CUR_Y, (short)(pbox->y1 + dy));	 S3_OUTW(DESTX_DIASTP, (short)(pbox->x1));	 S3_OUTW(DESTY_AXSTP, (short)(pbox->y1));	 S3_OUTW(MAJ_AXIS_PCNT, (short)(pbox->x2 - pbox->x1 - 1));	 S3_OUTW(MULTIFUNC_CNTL, MIN_AXIS_PCNT | (short)(pbox->y2 - pbox->y1 - 1));	 S3_OUTW(CMD, CMD_BITBLT | direction | DRAW | PLANAR | WRTDATA);      }   } else if (direction == INC_X) {      for (i = 0; i < nbox; i++) {	 pbox = &pboxOrig[ordering[i]];	 WaitQueue(7); PCI_HACK();	 S3_OUTW(CUR_X, (short)(pbox->x1 + dx));	 S3_OUTW(CUR_Y, (short)(pbox->y2 + dy - 1));	 S3_OUTW(DESTX_DIASTP, (short)(pbox->x1));	 S3_OUTW(DESTY_AXSTP, (short)(pbox->y2 - 1));	 S3_OUTW(MAJ_AXIS_PCNT, (short)(pbox->x2 - pbox->x1 - 1));	 S3_OUTW(MULTIFUNC_CNTL, MIN_AXIS_PCNT | (short)(pbox->y2 - pbox->y1 - 1));	 S3_OUTW(CMD, CMD_BITBLT | direction | DRAW | PLANAR | WRTDATA);      }   } else if (direction == INC_Y) {      for (i = 0; i < nbox; i++) {	 pbox = &pboxOrig[ordering[i]];	 WaitQueue(7); PCI_HACK();	 S3_OUTW(CUR_X, (short)(pbox->x2 + dx - 1));	 S3_OUTW(CUR_Y, (short)(pbox->y1 + dy));	 S3_OUTW(DESTX_DIASTP, (short)(pbox->x2 - 1));	 S3_OUTW(DESTY_AXSTP, (short)(pbox->y1));	 S3_OUTW(MAJ_AXIS_PCNT, (short)(pbox->x2 - pbox->x1 - 1));	 S3_OUTW(MULTIFUNC_CNTL, MIN_AXIS_PCNT | (short)(pbox->y2 - pbox->y1 - 1));	 S3_OUTW(CMD, CMD_BITBLT | direction | DRAW | PLANAR | WRTDATA);      }   } else {      for (i = 0; i < nbox; i++) {	 pbox = &pboxOrig[ordering[i]];	 WaitQueue(7); PCI_HACK();	 S3_OUTW(CUR_X, (short)(pbox->x2 + dx - 1));	 S3_OUTW(CUR_Y, (short)(pbox->y2 + dy - 1));	 S3_OUTW(DESTX_DIASTP, (short)(pbox->x2 - 1));	 S3_OUTW(DESTY_AXSTP, (short)(pbox->y2 - 1));	 S3_OUTW(MAJ_AXIS_PCNT, (short)(pbox->x2 - pbox->x1 - 1));	 S3_OUTW(MULTIFUNC_CNTL, MIN_AXIS_PCNT | (short)(pbox->y2 - pbox->y1 - 1));	 S3_OUTW(CMD, CMD_BITBLT | direction | DRAW | PLANAR | WRTDATA);      }   }   WaitQueue(2);    WaitIdle();   S3_OUTW(FRGD_MIX, FSS_FRGDCOL | MIX_SRC);   S3_OUTW(BKGD_MIX, BSS_BKGDCOL | MIX_SRC);   UNBLOCK_CURSOR;   REGION_DESTROY(pWin->drawable.pScreen, prgnDst);   DEALLOCATE_LOCAL(ordering);}