Bool XAACreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates, XAAGetGCKey()); Bool ret; XAA_SCREEN_PROLOGUE(pScreen,CreateGC); if((ret = (*pScreen->CreateGC)(pGC))) { pGCPriv->wrapOps = NULL; pGCPriv->wrapFuncs = pGC->funcs; pGCPriv->XAAOps = &XAAFallbackOps; pGCPriv->flags = 0; pGCPriv->DashLength = 0; pGCPriv->DashPattern = NULL; pGCPriv->changes = 0; /* initialize any other private fields here */ pGC->funcs = &XAAGCFuncs; } XAA_SCREEN_EPILOGUE(pScreen,CreateGC,XAACreateGC); return ret; }
Bool XAACreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates, XAAGetGCKey()); Bool ret; XAA_SCREEN_PROLOGUE(pScreen, CreateGC); if ((ret = (*pScreen->CreateGC) (pGC))) { pGCPriv->wrapOps = NULL; pGCPriv->wrapFuncs = pGC->funcs; pGCPriv->XAAOps = &XAAFallbackOps; pGC->funcs = &XAAGCFuncs; } XAA_SCREEN_EPILOGUE(pScreen, CreateGC, XAACreateGC); return ret; }
void XAAValidatePolylines(GCPtr pGC, unsigned long changes, DrawablePtr pDraw) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAAGCPtr pGCPriv = (XAAGCPtr) dixLookupPrivate(&pGC->devPrivates, XAAGetGCKey()); if (pGC->lineStyle == LineSolid) changes &= ~GCDashList; if (!changes) return; pGC->ops->PolySegment = XAAFallbackOps.PolySegment; pGC->ops->Polylines = XAAFallbackOps.Polylines; pGC->ops->PolyRectangle = XAAFallbackOps.PolyRectangle; pGC->ops->PolyArc = XAAFallbackOps.PolyArc; if ((pGC->ops->FillSpans != XAAFallbackOps.FillSpans) && (pGC->lineWidth > 0)) { pGC->ops->PolyArc = miPolyArc; pGC->ops->PolySegment = miPolySegment; pGC->ops->PolyRectangle = miPolyRectangle; if (pGC->lineStyle == LineSolid) pGC->ops->Polylines = miWideLine; else pGC->ops->Polylines = miWideDash; } if ((pGC->lineWidth == 0) && (pGC->fillStyle == FillSolid)) { if (pGC->lineStyle == LineSolid) { if (infoRec->PolyRectangleThinSolid && CHECK_PLANEMASK(pGC, infoRec->PolyRectangleThinSolidFlags) && CHECK_ROP(pGC, infoRec->PolyRectangleThinSolidFlags) && CHECK_ROPSRC(pGC, infoRec->PolyRectangleThinSolidFlags) && CHECK_FG(pGC, infoRec->PolyRectangleThinSolidFlags)) { pGC->ops->PolyRectangle = infoRec->PolyRectangleThinSolid; } if (infoRec->PolySegmentThinSolid && CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinSolidFlags) && CHECK_ROP(pGC, infoRec->PolySegmentThinSolidFlags) && CHECK_ROPSRC(pGC, infoRec->PolySegmentThinSolidFlags) && CHECK_FG(pGC, infoRec->PolySegmentThinSolidFlags)) { pGC->ops->PolySegment = infoRec->PolySegmentThinSolid; } if (infoRec->PolylinesThinSolid && CHECK_PLANEMASK(pGC, infoRec->PolylinesThinSolidFlags) && CHECK_ROP(pGC, infoRec->PolylinesThinSolidFlags) && CHECK_ROPSRC(pGC, infoRec->PolylinesThinSolidFlags) && CHECK_FG(pGC, infoRec->PolylinesThinSolidFlags)) { pGC->ops->Polylines = infoRec->PolylinesThinSolid; } } else if ((pGC->lineStyle == LineOnOffDash) && pGCPriv->DashPattern) { if (infoRec->PolySegmentThinDashed && !(infoRec->PolySegmentThinDashedFlags & NO_TRANSPARENCY) && ((pGC->alu == GXcopy) || !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_GXCOPY_ONLY)) && CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) && CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) && CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) && CHECK_FG(pGC, infoRec->PolySegmentThinDashedFlags)) { pGC->ops->PolySegment = infoRec->PolySegmentThinDashed; } if (infoRec->PolylinesThinDashed && !(infoRec->PolylinesThinDashedFlags & NO_TRANSPARENCY) && ((pGC->alu == GXcopy) || !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_GXCOPY_ONLY)) && CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) && CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) && CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) && CHECK_FG(pGC, infoRec->PolylinesThinDashedFlags)) { pGC->ops->Polylines = infoRec->PolylinesThinDashed; } if (pGC->ops->Polylines != XAAFallbackOps.Polylines) pGC->ops->PolyRectangle = miPolyRectangle; } else if (pGCPriv->DashPattern && (pGC->depth != 32)) { /* LineDoubleDash */ if (infoRec->PolySegmentThinDashed && !(infoRec->PolySegmentThinDashedFlags & TRANSPARENCY_ONLY) && CHECK_PLANEMASK(pGC, infoRec->PolySegmentThinDashedFlags) && CHECK_ROP(pGC, infoRec->PolySegmentThinDashedFlags) && CHECK_ROPSRC(pGC, infoRec->PolySegmentThinDashedFlags) && CHECK_COLORS(pGC, infoRec->PolySegmentThinDashedFlags)) { pGC->ops->PolySegment = infoRec->PolySegmentThinDashed; } if (infoRec->PolylinesThinDashed && !(infoRec->PolylinesThinDashedFlags & TRANSPARENCY_ONLY) && CHECK_PLANEMASK(pGC, infoRec->PolylinesThinDashedFlags) && CHECK_ROP(pGC, infoRec->PolylinesThinDashedFlags) && CHECK_ROPSRC(pGC, infoRec->PolylinesThinDashedFlags) && CHECK_COLORS(pGC, infoRec->PolylinesThinDashedFlags)) { pGC->ops->Polylines = infoRec->PolylinesThinDashed; } if (pGC->ops->Polylines != XAAFallbackOps.Polylines) pGC->ops->PolyRectangle = miPolyRectangle; } } if (infoRec->PolylinesWideSolid && (pGC->lineWidth > 0) && (pGC->fillStyle == FillSolid) && (pGC->lineStyle == LineSolid) && CHECK_PLANEMASK(pGC, infoRec->PolylinesWideSolidFlags) && CHECK_ROP(pGC, infoRec->PolylinesWideSolidFlags) && CHECK_ROPSRC(pGC, infoRec->PolylinesWideSolidFlags) && CHECK_FG(pGC, infoRec->PolylinesWideSolidFlags)) { pGC->ops->Polylines = infoRec->PolylinesWideSolid; } }
void XAAComputeDash(GCPtr pGC) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates, XAAGetGCKey()); Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE; int PatternLength = 0; unsigned char* DashPtr = (unsigned char*)pGC->dash; CARD32 *ptr; int count = pGC->numInDashList; int shift, value, direction; Bool set; if(pGCPriv->DashPattern) xfree(pGCPriv->DashPattern); pGCPriv->DashPattern = NULL; pGCPriv->DashLength = 0; while(count--) PatternLength += *(DashPtr++); if(!EvenDash) PatternLength <<= 1; if(PatternLength > infoRec->DashPatternMaxLength) return; if((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) && (PatternLength & (PatternLength - 1))) return; pGCPriv->DashPattern = xcalloc((PatternLength + 31) >> 5, 4); if(!pGCPriv->DashPattern) return; pGCPriv->DashLength = PatternLength; if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED | LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) { direction = 1; set = TRUE; DashPtr = (unsigned char*)pGC->dash; } else { direction = -1; set = FALSE; DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList - 1; } if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED)) shift = 32 - (PatternLength & 31); else shift = 0; ptr = (CARD32*)(pGCPriv->DashPattern); CONCATENATE: count = pGC->numInDashList; while(count--) { value = *DashPtr; DashPtr += direction; while(value) { if(value < (32 - shift)) { if(set) *ptr |= XAAShiftMasks[value] << shift; shift += value; break; } else { if(set) *ptr |= ~0L << shift; value -= (32 - shift); shift = 0; ptr++; } } if(set) set = FALSE; else set = TRUE; } if(!EvenDash) { EvenDash = TRUE; if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED | LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) DashPtr = (unsigned char*)pGC->dash; else DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList; goto CONCATENATE; } }