pb[5] = gcPriv->fgPixel;
pb[5] = gcPriv->fgFill;
pxPolylines(pDrawable, pGC, mode, npt, pptInit)    DrawablePtr pDrawable;    GCPtr	pGC;    int		mode;		/* Origin or Previous */    int		npt;		/* number of points */    DDXPointPtr pptInit;#endif{    pxScreenPrivPtr sp;    pxPrivGCPtr gcPriv;    int nboxInit;    int nbox;    BoxPtr pboxInit;    BoxPtr pbox;#ifndef _POLYSEGMENT    DDXPointPtr ppt;	/* pointer to list of translated points */#endif    pxPacket pxp;    unsigned int oc1;		/* outcode of point 1 */    unsigned int oc2;		/* outcode of point 2 */    int xorg, yorg;		/* origin of window */    int adx;		/* abs values of dx and dy */    int ady;    int signdx;		/* sign of dx and dy */    int signdy;    int e, e1, e2;		/* bresenham error and increments */    int axis;			/* major axis */    int octant;    unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);    int tmp;    int y1, y2;    int x1, x2;    RegionPtr cclip;    cfbPrivGCPtr    devPriv;    u_int32_t	*pb;#ifdef _POLYSEGMENT    PX_TRACE("pxPolySegment");#else    PX_TRACE("pxPolyLines");#endif    gcPriv = pxGetGCPrivate(pGC);    devPriv = cfbGetGCPrivate(pGC);    cclip = devPriv->pCompositeClip;    sp = gcPriv->sp;    pboxInit = REGION_RECTS(cclip);    nboxInit = REGION_NUM_RECTS(cclip);    pb = pxPacketStart(sp, &pxp, 6, 2);    pb[0] = STAMP_CMD_LINES | STAMP_RGB_CONST | STAMP_LW_PERPACKET;    pb[1] = gcPriv->pmask;    pb[2] = 0;    pb[3] = gcPriv->umet;    pb[4] = 4;    pb[5] = gcPriv->fgPixel;    xorg = pDrawable->x;    yorg = pDrawable->y;#ifdef _POLYSEGMENT    while (nseg--)#else    ppt = pptInit;    x2 = ppt->x + xorg;    y2 = ppt->y + yorg;    while(--npt)#endif    {	nbox = nboxInit;	pbox = pboxInit;#ifdef _POLYSEGMENT	x1 = pSeg->x1 + xorg;	y1 = pSeg->y1 + yorg;	x2 = pSeg->x2 + xorg;	y2 = pSeg->y2 + yorg;	pSeg++;#else	x1 = x2;	y1 = y2;	++ppt;	if (mode == CoordModePrevious)	{	    xorg = x1;	    yorg = y1;	}	x2 = ppt->x + xorg;	y2 = ppt->y + yorg;#endif	if (x1 == x2)  /* vertical line */	{	    /* make the line go top to bottom of screen, keeping	       endpoint semantics	    */	    if (y1 > y2)	    {		int tmp;		tmp = y2;		y2 = y1 + 1;		y1 = tmp + 1;#ifdef _POLYSEGMENT		if (pGC->capStyle != CapNotLast)		    y1--;#endif	    }#ifdef _POLYSEGMENT	    else if (pGC->capStyle != CapNotLast)		y2++;#endif	    /* get to first band that might contain part of line */	    while ((nbox) && (pbox->y2 <= y1))	    {		pbox++;		nbox--;	    }	    if (nbox)	    {		/* stop when lower edge of box is beyond end of line */		while((nbox) && (y2 >= pbox->y1))		{		    if ((x1 >= pbox->x1) && (x1 < pbox->x2))		    {			int y1t, y2t;			/* this box has part of the line in it */			y1t = max(y1, pbox->y1);			y2t = min(y2, pbox->y2);			if (y1t != y2t)			{			    pxAddLine(sp, &pxp, x1, y1t, x1, y2t);			}		    }		    nbox--;		    pbox++;		}	    }#ifndef _POLYSEGMENT	    y2 = ppt->y + yorg;#endif	}	else if (y1 == y2)  /* horizontal line */	{	    /* force line from left to right, keeping	       endpoint semantics	    */	    if (x1 > x2)	    {		int tmp;		tmp = x2;		x2 = x1 + 1;		x1 = tmp + 1;#ifdef _POLYSEGMENT		if (pGC->capStyle != CapNotLast)		    x1--;#endif	    }#ifdef _POLYSEGMENT	    else if (pGC->capStyle != CapNotLast)		x2++;#endif	    /* find the correct band */	    while( (nbox) && (pbox->y2 <= y1))	    {		pbox++;		nbox--;	    }	    /* try to draw the line, if we haven't gone beyond it */	    if ((nbox) && (pbox->y1 <= y1))	    {		/* when we leave this band, we're done */		tmp = pbox->y1;		while((nbox) && (pbox->y1 == tmp))		{		    int	x1t, x2t;		    if (pbox->x2 <= x1)		    {			/* skip boxes until one might contain start point */			nbox--;			pbox++;			continue;		    }		    /* stop if left of box is beyond right of line */		    if (pbox->x1 >= x2)		    {			nbox = 0;			break;		    }		    x1t = max(x1, pbox->x1);		    x2t = min(x2, pbox->x2);		    if (x1t != x2t)		    {			pxAddLine(sp, &pxp, x1t, y1, x2t, y1);		    }		    nbox--;		    pbox++;		}	    }#ifndef _POLYSEGMENT	    x2 = ppt->x + xorg;#endif	}	else	/* sloped line */	{	    CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,			   1, 1, octant);	    if (adx > ady)	    {		axis = X_AXIS;		e1 = ady << 1;		e2 = e1 - (adx << 1);		e = e1 - adx; 	    }	    else	    {		axis = Y_AXIS;		e1 = adx << 1;		e2 = e1 - (ady << 1);		e = e1 - ady;		SetYMajorOctant(octant);	    }	    FIXUP_ERROR(e, octant, bias);	    /* we have bresenham parameters and two points.	       all we have to do now is clip and draw.	    */	    while(nbox--)	    {		oc1 = 0;		oc2 = 0;		OUTCODES(oc1, x1, y1, pbox);		OUTCODES(oc2, x2, y2, pbox);		if ((oc1 | oc2) == 0)		{#ifdef _POLYSEGMENT		    if (pGC->capStyle != CapNotLast)		    {			if (axis == X_AXIS)			    x2++;			else		  	    y2++;		    }#endif		    pxAddLine(sp, &pxp, x1, y1, x2, y2);		    break;		}		else if (oc1 & oc2)		{		    pbox++;		}		else		{		    int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;		    int clip1 = 0, clip2 = 0;		    		    if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,				       pbox->y2-1,				       &new_x1, &new_y1, &new_x2, &new_y2,				       adx, ady, &clip1, &clip2,				       octant, bias, oc1, oc2) == -1)		    {			pbox++;			continue;		    }#ifdef _POLYSEGMENT		    	if (clip2 != 0 || pGC->capStyle != CapNotLast)			{			    if (axis == X_AXIS)			        new_x2++;			    else			        new_y2++;			}#else			if (axis == X_AXIS)			    new_x2 += (clip2 != 0);			else			    new_y2 += (clip2 != 0);#endif	                pxAddLine(sp, &pxp, new_x1, new_y1, new_x2, new_y2);		    pbox++;		}	    } /* while (nbox--) */	} /* sloped line */    } /* while (nline--) */#ifndef _POLYSEGMENT    /* paint the last point if the end style isn't CapNotLast.       (Assume that a projecting, butt, or round cap that is one        pixel wide is the same as the single pixel of the endpoint.)    */    if ((pGC->capStyle != CapNotLast) &&	((ppt->x + xorg != pptInit->x + pDrawable->x) ||	 (ppt->y + yorg != pptInit->y + pDrawable->y) ||	 (ppt == pptInit + 1)))    {	nbox = nboxInit;	pbox = pboxInit;	while (nbox--)	{	    if ((x2 >= pbox->x1) &&		(y2 >= pbox->y1) &&		(x2 <  pbox->x2) &&		(y2 <  pbox->y2))	    {	        pxAddLine(sp, &pxp, x2, y2, x2, y2);		break;	    }	    else		pbox++;	}    }#endif    pxPacketFlush(sp, &pxp);}