void LeoTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase) { LeoPtr pLeo = LeoGetScreenPrivate (pGC->pScreen); LeoCommand0 *lc0 = pLeo->lc0; LeoDraw *ld0 = pLeo->ld0; RegionPtr clip; int h, hTmp; int widthGlyph, widthGlyphs; BoxRec bbox; FontPtr pfont = pGC->font; int curw = -1; unsigned int *fbf; unsigned char *fb; int height, width; widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); h = FONTASCENT(pfont) + FONTDESCENT(pfont); clip = cfbGetCompositeClip(pGC); bbox.x1 = x + pDrawable->x; bbox.x2 = bbox.x1 + (widthGlyph * nglyph); bbox.y1 = y + pDrawable->y - FONTASCENT(pfont); bbox.y2 = bbox.y1 + h; /* If fully out of range, and we have no chance of getting back * in range, no work to do. */ y = y + pDrawable->y - FONTASCENT(pfont); x += pDrawable->x; height = pLeo->height; width = pLeo->width; if (x >= width) return; switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox)) { case rgnPART: if (REGION_NUM_RECTS(clip) == 1) { ld0->vclipmin = (clip->extents.y1 << 16) | clip->extents.x1; ld0->vclipmax = ((clip->extents.y2 - 1) << 16) | (clip->extents.x2 - 1); break; } x -= pDrawable->x; y = y - pDrawable->y + FONTASCENT(pfont); if (pGlyphBase) cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, NULL); else miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pGlyphBase); case rgnOUT: return; default: clip = NULL; break; } lc0->addrspace = LEO_ADDRSPC_FONT_OBGR; ld0->fg = pGC->fgPixel; if (pGC->alu != GXcopy) ld0->rop = leoRopTable[pGC->alu]; if (pGC->planemask != 0xffffff) ld0->planemask = pGC->planemask; fb = (unsigned char *)pLeo->fb; if(pGlyphBase) lc0->fontt = 1; else { lc0->fontt = 0; ld0->bg = pGC->bgPixel; } #define LoopIt(count, w, loadup, fetch) \ if (w != curw) { \ curw = w; \ lc0->fontmsk = 0xffffffff << (32 - w); \ } \ while (nglyph >= count) { \ loadup \ nglyph -= count; \ fbf = (unsigned *)(fb + (y << 13) + (x << 2)); \ hTmp = h; \ if (y + h <= height) \ while (hTmp--) { \ *fbf = fetch; \ fbf += 2048; \ } \ else \ for (hTmp = 0; hTmp < h && y + hTmp < height; hTmp++) { \ *fbf = fetch; \ fbf += 2048; \ } \ x += w; \ if(x >= width) \ goto out; \ } if (widthGlyph <= 8) { widthGlyphs = widthGlyph << 2; LoopIt(4, widthGlyphs, unsigned int *char1 = (unsigned int *) (*ppci++)->bits; unsigned int *char2 = (unsigned int *) (*ppci++)->bits; unsigned int *char3 = (unsigned int *) (*ppci++)->bits; unsigned int *char4 = (unsigned int *) (*ppci++)->bits;,
void xf4bppImageGlyphBlt(DrawablePtr pDrawable, GC *pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase) { ExtentInfoRec info; /* used by QueryGlyphExtents() */ xRectangle backrect;/* backing rectangle to paint. in the general case, NOT necessarily the same as the string's bounding box */ /* GJA -- I agree, this ALL should be moved to GC validation. */ if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) || !xf86Screens[pDrawable->pScreen->myNum]->vtSema || ((pGC->font) && (FONTMAXBOUNDS(pGC->font,rightSideBearing) - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || FONTMINBOUNDS(pGC->font,characterWidth) < 0)) ) { miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); } else { ppcPrivGC *pPrivGC; int oldfillStyle, oldfg, oldalu; if (!(pGC->planemask & 0x0F)) return; QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); backrect.x = x; backrect.y = y - FONTASCENT(pGC->font); backrect.width = info.overallWidth; backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr; oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */ oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */ oldalu = pPrivGC->colorRrop.alu; /* GJA */ pPrivGC->colorRrop.fillStyle = FillSolid; /* GJA */ pPrivGC->colorRrop.fgPixel = pGC->bgPixel; /* GJA */ pGC->fgPixel = pGC->bgPixel; pPrivGC->colorRrop.alu = GXcopy; /* GJA */ pGC->alu = GXcopy; /* Required fields: * colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel */ xf4bppPolyFillRect(pDrawable, pGC, 1, &backrect); pPrivGC->colorRrop.fgPixel = oldfg; /* GJA */ pGC->fgPixel = oldfg; /* the faint-hearted can open their eyes now */ DO_WM3(pGC,doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,&info)) pPrivGC->colorRrop.fillStyle = oldfillStyle; /* GJA */ pPrivGC->colorRrop.alu = oldalu; /* GJA */ pGC->alu = oldalu; } }