int xStart, xEnd, yMax, bpp;
int xStart, xEnd, yMax;
pxSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *charpsrc, DDXPointPtr ppt,	   int *pwidth, int nspans, int fSorted){	pxScreenPrivPtr sp;	pxPrivGCPtr gcPriv;	BoxPtr pbox, pboxLast, pboxTest;	DDXPointPtr pptLast;	RegionPtr prgnDst;	int xStart, xEnd, yMax, bpp;	unsigned int *psrc;	PX_TRACE("pxSetSpans");	psrc = (unsigned int *)charpsrc;	prgnDst = cfbGetCompositeClip(pGC);	gcPriv = pxGetGCPrivate(pGC);	sp = gcPriv->sp;	pptLast = ppt + nspans;	bpp = sp->bpp;	yMax = pDrawable->y + pDrawable->height;	pbox = REGION_RECTS(prgnDst);	pboxLast = pbox + REGION_NUM_RECTS(prgnDst);	if (fSorted) {		/*		 * Scan lines sorted in ascending order. Because they are		 * sorted, we don't have to check each scanline against each		 * clip box.  We can be sure that this scanline only has to		 * be clipped to boxes at or after the beginning of this		 * y-band		 */		pboxTest = pbox;		while (ppt < pptLast) {			pbox = pboxTest;			if (ppt->y >= yMax)				break;			while (pbox < pboxLast) {				if (pbox->y1 > ppt->y) {					/* Scanline is before clip box. */					break;				}				if (pbox->y2 <= ppt->y) {					/* Clip box is before scanline. */					pboxTest = ++pbox;					continue;				}				if (pbox->x1 > ppt->x + *pwidth) {					/* Clip box to right of scanline. */					break;				}				if (pbox->x2 <= ppt->x) {					/* Scanline to right of clip box. */					pbox++;					continue;				}				/*				 * At least some of the scanline is in the				 * current clip box.				 */				xStart = max(pbox->x1, ppt->x);				xEnd = min(ppt->x + *pwidth, pbox->x2);				pxSetScanline(sp, ppt->y, ppt->x, xStart,				    xEnd, psrc, gcPriv->umet, gcPriv->pmask);				if (ppt->x + *pwidth <= pbox->x2) {					/* End of the line, as it were. */					break;				}				pbox++;			}				/*			 * We've tried this line against every box; it must			 * be outside them all.  Move on to the next point.			 */			ppt++;			psrc += PixmapWidthInPadUnits(*pwidth, bpp);			pwidth++;		}		return;	}	/*	 * Scan lines not sorted.  We must clip each line against	 * all the boxes.	 */	while (ppt < pptLast) {		if (ppt->y >= 0 && ppt->y < yMax) {			pbox = REGION_RECTS(prgnDst);			for (; pbox< pboxLast; pbox++) {				if (pbox->y1 > ppt->y) {					/*					 * Rest of clip region is					 * above this scanline, skip					 * it.					 */					break;				}				if (pbox->y2 <= ppt->y) {					/*					 * Clip box is below					 * scanline.					 */					pbox++;					break;				}				if (pbox->x1 <= ppt->x + *pwidth &&				    pbox->x2 > ppt->x) {					xStart = max(pbox->x1, ppt->x);					xEnd = min(pbox->x2, ppt->x + *pwidth);					pxSetScanline(sp, ppt->y, ppt->x,					    xStart, xEnd, psrc, gcPriv->umet,					    gcPriv->pmask);				}			}		}		psrc += PixmapWidthInPadUnits(*pwidth, bpp);		ppt++;		pwidth++;	}}