} else
pGC->ops->PolySegment = miPolySegment; pGC->ops->PolyArc = miZeroPolyArc; } } else {
pxValidateGC(GCPtr pGC, u_long changes, DrawablePtr pDrawable){	pxScreenPrivPtr sp;	int mask, index, maxw, maxh, new_line, new_text, new_fill;	pxPrivGCPtr gcPriv;        cfbPrivGCPtr devPriv;	int oneRect;	PX_TRACE("pxValidateGC");	gcPriv = pxGetGCPrivate(pGC);	sp = gcPriv->sp;	if (pDrawable->type != DRAWABLE_WINDOW) {		if (gcPriv->type == DRAWABLE_WINDOW) {			extern GCOps cfbNonTEOps;			extern GCOps cfb32NonTEOps;			miDestroyGCOps(pGC->ops);			if (sp->bpp == 8)				pGC->ops = &cfbNonTEOps;			else				pGC->ops = &cfb32NonTEOps;			changes = (1 << (GCLastBit+1)) - 1;			pGC->stateChanges = changes;		}		gcPriv->type = pDrawable->type;		if (sp->bpp == 8)			cfbValidateGC(pGC, changes, pDrawable);		else			cfb32ValidateGC(pGC, changes, pDrawable);		/*		 * CopyArea() may have a WINDOW drawable as the source, so		 * we always override it.		 */		pGC->ops->CopyArea = pxCopyArea;		return;	}	if (gcPriv->type != DRAWABLE_WINDOW) {		changes = (1 << (GCLastBit+1)) - 1;		gcPriv->type = DRAWABLE_WINDOW;		pGC->ops = miCreateGCOps(&pxGCOps);	}	pGC->lastWinOrg.x = pDrawable->x;	pGC->lastWinOrg.y = pDrawable->y;	devPriv = cfbGetGCPrivate(pGC);	new_line = FALSE;	new_text = FALSE;	new_fill = FALSE;	/*	 * if the client clip is different or moved OR the subwindowMode has	 * changed OR the window's clip has changed since the last validation	 * we need to recompute the composite clip 	 */	if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||	    (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {		miComputeCompositeClip (pGC, pDrawable);		oneRect = REGION_NUM_RECTS(cfbGetCompositeClip(pGC)) == 1;		if (oneRect != devPriv->oneRect)			new_line = TRUE;		devPriv->oneRect = oneRect;	}	mask = changes;	while (mask) {		index = lowbit (mask);		mask &= ~index;		/*		 * this switch acculmulates a list of which procedures might have		 * to change due to changes in the GC.  in some cases (e.g.		 * changing one 16 bit tile for another) we might not really need		 * a change, but the code is being paranoid. this sort of batching		 * wins if, for example, the alu and the font have been changed,		 * or any other pair of items that both change the same thing. 		 */		switch (index) {		case GCForeground:			if (sp->bpp == 8)				gcPriv->fgPixel = PX_DUPBYTE(pGC->fgPixel);			else				gcPriv->fgPixel = pGC->fgPixel;			new_fill = TRUE;			break;		case GCBackground:			if (sp->bpp == 8)				gcPriv->bgPixel = PX_DUPBYTE(pGC->bgPixel);			else				gcPriv->bgPixel = pGC->bgPixel;			break;		case GCFunction:			gcPriv->umet = pxRopTable[pGC->alu];			break;		case GCPlaneMask:			if (sp->bpp == 8)				gcPriv->pmask = PX_DUPBYTE(pGC->planemask);			else				gcPriv->pmask = pGC->planemask & 0xffffff;			break;		case GCLineStyle:		case GCLineWidth:			new_line = TRUE;			break;		case GCFillStyle:			new_text = TRUE;			new_fill = TRUE;			new_line = TRUE;			break;		case GCTile:			new_fill = TRUE;			break;		case GCStipple:			new_fill = TRUE;			break;		case GCFont:			new_text = TRUE;			break;		default:			break;		}	}	/*	 * Has the drawable changed?	 */	if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) {		new_fill = TRUE;		new_line = TRUE;		new_text = TRUE;	}	/*	 * Solid tiles become solid fills.	 */	if (new_fill) {		if (pGC->fillStyle == FillTiled && pGC->tileIsPixel) {			gcPriv->fillStyle = FillSolid;			if (sp->bpp == 8)				gcPriv->fgFill = PX_DUPBYTE(pGC->tile.pixel);			else				gcPriv->fgFill = pGC->tile.pixel;		} else {			gcPriv->fillStyle = pGC->fillStyle;			gcPriv->fgFill = gcPriv->fgPixel;		}	}	/*	 * Deal with the changes we've collected.	 */	if (new_line) {		pGC->ops->PolySegment = miPolySegment;		switch (pGC->lineStyle) {		case LineSolid:			if(pGC->lineWidth == 0) {				if (gcPriv->fillStyle == FillSolid) {					pGC->ops->Polylines = pxPolylines;					pGC->ops->PolySegment = pxPolySegment;				} else					pGC->ops->Polylines = miZeroLine;			} else				pGC->ops->Polylines = miWideLine;			break;		case LineOnOffDash:		case LineDoubleDash:			if (pGC->lineWidth == 0 &&			    gcPriv->fillStyle == FillSolid) {				pGC->ops->Polylines = pxPolylinesD;				pGC->ops->PolySegment = pxPolySegmentD;			} else				pGC->ops->Polylines = miWideDash;			break;		}	}	if (new_text && pGC->font) {		pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;		pGC->ops->ImageGlyphBlt = miImageGlyphBlt;		maxw = FONTMAXBOUNDS(pGC->font, rightSideBearing) -		    FONTMINBOUNDS(pGC->font, leftSideBearing);		maxh = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);		if (maxw <= 16 && maxh <= 16 &&		    FONTMINBOUNDS(pGC->font, characterWidth) >= 0) {			if (TERMINALFONT(pGC->font)) {				if (gcPriv->fillStyle == FillSolid)					pGC->ops->PolyGlyphBlt =					    pxPolyTEGlyphBlt;				pGC->ops->ImageGlyphBlt =				    pxImageTEGlyphBlt;			} else {				if (gcPriv->fillStyle == FillSolid)					pGC->ops->PolyGlyphBlt =					    pxPolyGlyphBlt;				pGC->ops->ImageGlyphBlt =				    pxImageGlyphBlt;			}		}	}	if (new_fill) {		switch (gcPriv->fillStyle) {		case FillSolid:			gcPriv->doFillSpans = pxDoFillSpans; 			pGC->ops->PolyFillRect = pxPolyFillRect;			pGC->ops->PushPixels = pxSolidPP;			break;		case FillTiled:			if (pxMaskFromTile(sp, pGC->tile.pixmap, &gcPriv->mask)) {				pGC->ops->PolyFillRect = pxPolyFillRectSO;				gcPriv->doFillSpans = pxDoFillSpansS;			} else {				pGC->ops->PolyFillRect = miPolyFillRect;				gcPriv->doFillSpans = pxDoFillSpansT;			}			pGC->ops->PushPixels = miPushPixels;			break;		case FillStippled:			if (pxMaskFromStipple(sp, pGC->stipple, &gcPriv->mask,			    pGC->fgPixel, pGC->bgPixel)) {				pGC->ops->PolyFillRect = pxPolyFillRectS;				gcPriv->doFillSpans = pxDoFillSpansS;			} else {				pGC->ops->PolyFillRect = miPolyFillRect;				gcPriv->doFillSpans = pxDoFillSpansUS;			}			pGC->ops->PushPixels = miPushPixels;			break;		case FillOpaqueStippled:			if (pxMaskFromStipple(sp, pGC->stipple, &gcPriv->mask,			    pGC->fgPixel, pGC->bgPixel)) {				pGC->ops->PolyFillRect = pxPolyFillRectSO;				gcPriv->doFillSpans = pxDoFillSpansS;			} else {				pGC->ops->PolyFillRect = miPolyFillRect;				gcPriv->doFillSpans = pxDoFillSpansUS;			}			pGC->ops->PushPixels = miPushPixels;			break;		default:			FatalError("pxValidateGC: illegal fillStyle\n");		}	}}