/* * The even stipple code wants the first FB_UNIT/bpp bits on * each scanline to represent the entire stipple */ static Bool fbCanEvenStipple(PixmapPtr pStipple, int bpp) { int len = FB_UNIT / bpp; FbBits *bits; int stride; int stip_bpp; _X_UNUSED int stipXoff, stipYoff; int h; /* can't even stipple 24bpp drawables */ if ((bpp & (bpp - 1)) != 0) return FALSE; /* make sure the stipple width is a multiple of the even stipple width */ if (pStipple->drawable.width % len != 0) return FALSE; fbGetDrawable(&pStipple->drawable, bits, stride, stip_bpp, stipXoff, stipYoff); h = pStipple->drawable.height; /* check to see that the stipple repeats horizontally */ while (h--) { if (!fbLineRepeat(bits, len, pStipple->drawable.width)) { fbFinishAccess(&pStipple->drawable); return FALSE; } bits += stride; } fbFinishAccess(&pStipple->drawable); return TRUE; }
void fbFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbBits *tile; FbStride tileStride; int tileBpp; int tileXoff, tileYoff; /* XXX assumed to be zero */ int tileWidth, tileHeight; int n = REGION_NUM_RECTS(pRegion); BoxPtr pbox = REGION_RECTS(pRegion); int xRot = pDrawable->x; int yRot = pDrawable->y; #ifdef PANORAMIX if(!noPanoramiXExtension) { int index = pDrawable->pScreen->myNum; if(&WindowTable[index]->drawable == pDrawable) { xRot -= panoramiXdataPtr[index].x; yRot -= panoramiXdataPtr[index].y; } } #endif fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; xRot += dstXoff; yRot += dstYoff; while (n--) { fbTile (dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, pbox->y2 - pbox->y1, tile, tileStride, tileWidth * dstBpp, tileHeight, GXcopy, FB_ALLONES, dstBpp, xRot * dstBpp, yRot - (pbox->y1 + dstYoff)); pbox++; } fbFinishAccess (&pTile->drawable); fbFinishAccess (pDrawable); }
void fbCopyWindowProc (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nbox--) { fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), GXcopy, FB_ALLONES, dstBpp, reverse, upsidedown); pbox++; } fbFinishAccess (pDstDrawable); fbFinishAccess (pSrcDrawable); }
/* * Pad pixmap to FB_UNIT bits wide */ void fbPadPixmap(PixmapPtr pPixmap) { int width; FbBits *bits; FbBits b; FbBits mask; int height; int w; int stride; int bpp; _X_UNUSED int xOff, yOff; fbGetDrawable(&pPixmap->drawable, bits, stride, bpp, xOff, yOff); width = pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel; height = pPixmap->drawable.height; mask = FbBitsMask(0, width); while (height--) { b = READ(bits) & mask; w = width; while (w < FB_UNIT) { b = b | FbScrRight(b, w); w <<= 1; } WRITE(bits, b); bits += stride; } fbFinishAccess(&pPixmap->drawable); }
void fbPutZImage (DrawablePtr pDrawable, RegionPtr pClip, int alu, FbBits pm, int x, int y, int width, int height, FbStip *src, FbStride srcStride) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); for (nbox = RegionNumRects (pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; fbBltStip (src + (y1 - y) * srcStride, srcStride, (x1 - x) * dstBpp, dst + (y1 + dstYoff) * dstStride, dstStride, (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp); } fbFinishAccess (pDrawable); }
void fbSolidBoxClipped(DrawablePtr pDrawable, RegionPtr pClip, int x1, int y1, int x2, int y2, FbBits and, FbBits xor) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxPtr pbox; int nbox; int partX1, partX2, partY1, partY2; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { partX1 = pbox->x1; if (partX1 < x1) partX1 = x1; partX2 = pbox->x2; if (partX2 > x2) partX2 = x2; if (partX2 <= partX1) continue; partY1 = pbox->y1; if (partY1 < y1) partY1 = y1; partY2 = pbox->y2; if (partY2 > y2) partY2 = y2; if (partY2 <= partY1) continue; #ifndef FB_ACCESS_WRAPPER if (and || !pixman_fill((uint32_t *) dst, dstStride, dstBpp, partX1 + dstXoff, partY1 + dstYoff, (partX2 - partX1), (partY2 - partY1), xor)) #endif fbSolid(dst + (partY1 + dstYoff) * dstStride, dstStride, (partX1 + dstXoff) * dstBpp, dstBpp, (partX2 - partX1) * dstBpp, (partY2 - partY1), and, xor); } fbFinishAccess(pDrawable); }
static void fbPushFill(DrawablePtr pDrawable, GCPtr pGC, FbStip * src, FbStride srcStride, int srcX, int x, int y, int width, int height) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); if (pGC->fillStyle == FillSolid) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int dstX; int dstWidth; fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dst = dst + (y + dstYoff) * dstStride; dstX = (x + dstXoff) * dstBpp; dstWidth = width * dstBpp; if (dstBpp == 1) { fbBltStip(src, srcStride, srcX, (FbStip *) dst, FbBitsStrideToStipStride(dstStride), dstX, dstWidth, height, FbStipple1Rop(pGC->alu, pGC->fgPixel), pPriv->pm, dstBpp); } else { fbBltOne(src, srcStride, srcX, dst, dstStride, dstX, dstBpp, dstWidth, height, pPriv->and, pPriv->xor, fbAnd(GXnoop, (FbBits) 0, FB_ALLONES), fbXor(GXnoop, (FbBits) 0, FB_ALLONES)); } fbFinishAccess(pDrawable); } else { fbPushPattern(pDrawable, pGC, src, srcStride, srcX, x, y, width, height); } }
void fbFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, FbBits and, FbBits xor) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int n = REGION_NUM_RECTS(pRegion); BoxPtr pbox = REGION_RECTS(pRegion); #ifndef FB_ACCESS_WRAPPER int try_mmx = 0; if (!and) try_mmx = 1; #endif fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (n--) { #ifndef FB_ACCESS_WRAPPER if (!try_mmx || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp, pbox->x1 + dstXoff, pbox->y1 + dstYoff, (pbox->x2 - pbox->x1), (pbox->y2 - pbox->y1), xor)) { #endif fbSolid (dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, dstBpp, (pbox->x2 - pbox->x1) * dstBpp, pbox->y2 - pbox->y1, and, xor); #ifndef FB_ACCESS_WRAPPER } #endif fbValidateDrawable (pDrawable); pbox++; } fbFinishAccess (pDrawable); }
static void fbBresDash(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbStip and = (FbStip) pPriv->and; FbStip xor = (FbStip) pPriv->xor; FbStip bgand = (FbStip) pPriv->bgand; FbStip bgxor = (FbStip) pPriv->bgxor; FbStip mask, mask0; FbDashDeclare; int dashlen; Bool even; Bool doOdd; fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); doOdd = pGC->lineStyle == LineDoubleDash; FbDashInit(pGC, pPriv, dashOffset, dashlen, even); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * dstBpp; dst += x1 >> FB_STIP_SHIFT; x1 &= FB_STIP_MASK; mask0 = FbStipMask(0, dstBpp); mask = FbStipRight(mask0, x1); if (signdx < 0) mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp); if (signdy < 0) dstStride = -dstStride; while (len--) { if (even) WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask)); else if (doOdd) WRITE(dst, FbDoMaskRRop(READ(dst), bgand, bgxor, mask)); if (axis == X_AXIS) { mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { dst += signdx; mask = mask0; } e += e1; if (e >= 0) { dst += dstStride; e += e3; } } else { dst += dstStride; e += e1; if (e >= 0) { e += e3; mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { dst += signdx; mask = mask0; } } } FbDashStep(dashlen, even); } fbFinishAccess(pDrawable); }
void fbPolyArc (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) { FbArc arc; if (pGC->lineWidth == 0) { #ifndef FBNOPIXADDR arc = 0; if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid) { switch (pDrawable->bitsPerPixel) { case 8: arc = fbArc8; break; case 16: arc = fbArc16; break; #ifdef FB_24BIT case 24: arc = fbArc24; break; #endif case 32: arc = fbArc32; break; } } if (arc) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxRec box; int x2, y2; RegionPtr cclip; int wrapped = 0; cclip = fbGetCompositeClip (pGC); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); #ifdef FB_ACCESS_WRAPPER wrapped = 1; #endif while (narcs--) { if (miCanZeroArc (parcs)) { box.x1 = parcs->x + pDrawable->x; box.y1 = parcs->y + pDrawable->y; /* * Because box.x2 and box.y2 get truncated to 16 bits, and the * RECT_IN_REGION test treats the resulting number as a signed * integer, the RECT_IN_REGION test alone can go the wrong way. * This can result in a server crash because the rendering * routines in this file deal directly with cpu addresses * of pixels to be stored, and do not clip or otherwise check * that all such addresses are within their respective pixmaps. * So we only allow the RECT_IN_REGION test to be used for * values that can be expressed correctly in a signed short. */ x2 = box.x1 + (int)parcs->width + 1; box.x2 = x2; y2 = box.y1 + (int)parcs->height + 1; box.y2 = y2; if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && (RECT_IN_REGION(pDrawable->pScreen, cclip, &box) == rgnIN) ) { #ifdef FB_ACCESS_WRAPPER if (!wrapped) { fbPrepareAccess (pDrawable); wrapped = 1; } #endif (*arc) (dst, dstStride, dstBpp, parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff, pPriv->and, pPriv->xor); } else { #ifdef FB_ACCESS_WRAPPER if (wrapped) { fbFinishAccess (pDrawable); wrapped = 0; } #endif miZeroPolyArc(pDrawable, pGC, 1, parcs); } } else { #ifdef FB_ACCESS_WRAPPER if (wrapped) { fbFinishAccess (pDrawable); wrapped = 0; } #endif miPolyArc(pDrawable, pGC, 1, parcs); } parcs++; } #ifdef FB_ACCESS_WRAPPER if (wrapped) { fbFinishAccess (pDrawable); wrapped = 0; } #endif } else #endif miZeroPolyArc (pDrawable, pGC, narcs, parcs); } else miPolyArc (pDrawable, pGC, narcs, parcs); }
void fbImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppciInit, pointer pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); CharInfoPtr *ppci; CharInfoPtr pci; unsigned char *pglyph; /* pointer bits in glyph */ int gWidth, gHeight; /* width and height of glyph */ FbStride gStride; /* stride of glyph */ Bool opaque; int n; int gx, gy; #ifndef FBNOPIXADDR void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int); FbBits *dst = 0; FbStride dstStride = 0; int dstBpp = 0; int dstXoff = 0, dstYoff = 0; glyph = 0; if (pPriv->and == 0) { dstBpp = pDrawable->bitsPerPixel; switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; #ifdef FB_24BIT case 24: glyph = fbGlyph24; break; #endif case 32: glyph = fbGlyph32; break; } } #endif x += pDrawable->x; y += pDrawable->y; if (TERMINALFONT (pGC->font) #ifndef FBNOPIXADDR && !glyph #endif ) { opaque = TRUE; } else { int xBack, widthBack; int yBack, heightBack; ppci = ppciInit; n = nglyph; widthBack = 0; while (n--) widthBack += (*ppci++)->metrics.characterWidth; xBack = x; if (widthBack < 0) { xBack += widthBack; widthBack = -widthBack; } yBack = y - FONTASCENT(pGC->font); heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); fbSolidBoxClipped (pDrawable, fbGetCompositeClip(pGC), xBack, yBack, xBack + widthBack, yBack + heightBack, fbAnd(GXcopy,pPriv->bg,pPriv->pm), fbXor(GXcopy,pPriv->bg,pPriv->pm)); opaque = FALSE; } ppci = ppciInit; while (nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { gx = x + pci->metrics.leftSideBearing; gy = y - pci->metrics.ascent; #ifndef FBNOPIXADDR if (glyph && gWidth <= sizeof (FbStip) * 8 && fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, (FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight); fbFinishAccess (pDrawable); } else #endif { gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); fbPutXYImage (pDrawable, fbGetCompositeClip(pGC), pPriv->fg, pPriv->bg, pPriv->pm, GXcopy, opaque, gx, gy, gWidth, gHeight, (FbStip *) pglyph, gStride, 0); } } x += pci->metrics.characterWidth; } }
void fbGetImage (DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbStip *dst; FbStride dstStride; /* * XFree86 DDX empties the root borderClip when the VT is * switched away; this checks for that case */ if (!fbDrawableEnabled(pDrawable)) return; #ifdef FB_24_32BIT if (format == ZPixmap && pDrawable->bitsPerPixel != BitsPerPixel (pDrawable->depth)) { fb24_32GetImage (pDrawable, x, y, w, h, format, planeMask, d); return; } #endif fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); x += pDrawable->x; y += pDrawable->y; dst = (FbStip *) d; if (format == ZPixmap || srcBpp == 1) { FbBits pm; pm = fbReplicatePixel (planeMask, srcBpp); dstStride = PixmapBytePad(w, pDrawable->depth); if (pm != FB_ALLONES) memset (d, 0, dstStride * h); dstStride /= sizeof (FbStip); fbBltStip ((FbStip *) (src + (y + srcYoff) * srcStride), FbBitsStrideToStipStride(srcStride), (x + srcXoff) * srcBpp, dst, dstStride, 0, w * srcBpp, h, GXcopy, pm, srcBpp); } else { dstStride = BitmapBytePad(w) / sizeof (FbStip); fbBltPlane (src + (y + srcYoff) * srcStride, srcStride, (x + srcXoff) * srcBpp, srcBpp, dst, dstStride, 0, w * srcBpp, h, fbAndStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES), fbXorStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES), fbAndStip(GXcopy,0,FB_STIP_ALLONES), fbXorStip(GXcopy,0,FB_STIP_ALLONES), planeMask); } fbFinishAccess (pDrawable); }
void fbPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); CharInfoPtr pci; unsigned char *pglyph; /* pointer bits in glyph */ int gx, gy; int gWidth, gHeight; /* width and height of glyph */ FbStride gStride; /* stride of glyph */ #ifndef FBNOPIXADDR void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int); FbBits *dst = 0; FbStride dstStride = 0; int dstBpp = 0; int dstXoff = 0, dstYoff = 0; glyph = 0; if (pGC->fillStyle == FillSolid && pPriv->and == 0) { dstBpp = pDrawable->bitsPerPixel; switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; #ifdef FB_24BIT case 24: glyph = fbGlyph24; break; #endif case 32: glyph = fbGlyph32; break; } } #endif x += pDrawable->x; y += pDrawable->y; while (nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { gx = x + pci->metrics.leftSideBearing; gy = y - pci->metrics.ascent; #ifndef FBNOPIXADDR if (glyph && gWidth <= sizeof (FbStip) * 8 && fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, (FbStip *) pglyph, pPriv->xor, gx + dstXoff, gHeight); fbFinishAccess (pDrawable); } else #endif { gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); fbPushImage (pDrawable, pGC, (FbStip *) pglyph, gStride, 0, gx, gy, gWidth, gHeight); } } x += pci->metrics.characterWidth; } }
void fbPutXYImage (DrawablePtr pDrawable, RegionPtr pClip, FbBits fg, FbBits bg, FbBits pm, int alu, Bool opaque, int x, int y, int width, int height, FbStip *src, FbStride srcStride, int srcX) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0; fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); if (dstBpp == 1) { if (opaque) alu = FbOpaqueStipple1Rop(alu,fg,bg); else alu = FbStipple1Rop(alu,fg); } else { fgand = fbAnd(alu,fg,pm); fgxor = fbXor(alu,fg,pm); if (opaque) { bgand = fbAnd(alu,bg,pm); bgxor = fbXor(alu,bg,pm); } else { bgand = fbAnd(GXnoop,(FbBits)0,FB_ALLONES); bgxor = fbXor(GXnoop,(FbBits)0,FB_ALLONES); } } for (nbox = RegionNumRects (pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; if (dstBpp == 1) { fbBltStip (src + (y1 - y) * srcStride, srcStride, (x1 - x) + srcX, (FbStip *) (dst + (y1 + dstYoff) * dstStride), FbBitsStrideToStipStride(dstStride), (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp); } else { fbBltOne (src + (y1 - y) * srcStride, srcStride, (x1 - x) + srcX, dst + (y1 + dstYoff) * dstStride, dstStride, (x1 + dstXoff) * dstBpp, dstBpp, (x2 - x1) * dstBpp, (y2 - y1), fgand, fgxor, bgand, bgxor); } } fbFinishAccess (pDrawable); }
void fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); fbGetDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); switch (pGC->fillStyle) { case FillSolid: #ifndef FB_ACCESS_WRAPPER if (pPriv->and || !pixman_fill((uint32_t *) dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor)) #endif fbSolid(dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, pPriv->and, pPriv->xor); break; case FillStippled: case FillOpaqueStippled:{ PixmapPtr pStip = pGC->stipple; int stipWidth = pStip->drawable.width; int stipHeight = pStip->drawable.height; if (dstBpp == 1) { int alu; FbBits *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; if (pGC->fillStyle == FillStippled) alu = FbStipple1Rop(pGC->alu, pGC->fgPixel); else alu = FbOpaqueStipple1Rop(pGC->alu, pGC->fgPixel, pGC->bgPixel); fbGetDrawable(&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbTile(dst + (y + dstYoff) * dstStride, dstStride, x + dstXoff, width, height, stip, stipStride, stipWidth, stipHeight, alu, pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff), pGC->patOrg.y + pDrawable->y - y); fbFinishAccess(&pStip->drawable); } else { FbStip *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; FbBits fgand, fgxor, bgand, bgxor; fgand = pPriv->and; fgxor = pPriv->xor; if (pGC->fillStyle == FillStippled) { bgand = fbAnd(GXnoop, (FbBits) 0, FB_ALLONES); bgxor = fbXor(GXnoop, (FbBits) 0, FB_ALLONES); } else { bgand = pPriv->bgand; bgxor = pPriv->bgxor; } fbGetStipDrawable(&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbStipple(dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, stip, stipStride, stipWidth, stipHeight, pPriv->evenStipple, fgand, fgxor, bgand, bgxor, pGC->patOrg.x + pDrawable->x + dstXoff, pGC->patOrg.y + pDrawable->y - y); fbFinishAccess(&pStip->drawable); } break; } case FillTiled:{ PixmapPtr pTile = pGC->tile.pixmap; FbBits *tile; FbStride tileStride; int tileBpp; int tileWidth; int tileHeight; _X_UNUSED int tileXoff, tileYoff; fbGetDrawable(&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; fbTile(dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, width * dstBpp, height, tile, tileStride, tileWidth * tileBpp, tileHeight, pGC->alu, pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp, pGC->patOrg.y + pDrawable->y - y); fbFinishAccess(&pTile->drawable); break; } } fbValidateDrawable(pDrawable); fbFinishAccess(pDrawable); }
static void fbBresSolid(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbStip and = (FbStip) pPriv->and; FbStip xor = (FbStip) pPriv->xor; FbStip mask, mask0; FbStip bits; fbGetStipDrawable(pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * dstBpp; dst += x1 >> FB_STIP_SHIFT; x1 &= FB_STIP_MASK; mask0 = FbStipMask(0, dstBpp); mask = FbStipRight(mask0, x1); if (signdx < 0) mask0 = FbStipRight(mask0, FB_STIP_UNIT - dstBpp); if (signdy < 0) dstStride = -dstStride; if (axis == X_AXIS) { bits = 0; while (len--) { bits |= mask; mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits)); bits = 0; dst += signdx; mask = mask0; } e += e1; if (e >= 0) { if (bits) { WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits)); bits = 0; } dst += dstStride; e += e3; } } if (bits) WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits)); } else { while (len--) { WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask)); dst += dstStride; e += e1; if (e >= 0) { e += e3; mask = fbBresShiftMask(mask, signdx, dstBpp); if (!mask) { dst += signdx; mask = mask0; } } } } fbFinishAccess(pDrawable); }
void free_pixman_pict(PicturePtr pict, pixman_image_t * image) { if (image && pixman_image_unref(image) && pict->pDrawable) fbFinishAccess(pict->pDrawable); }
static void image_destroy(pixman_image_t *image, void *data) { fbFinishAccess((DrawablePtr)data); }