📄 mfbfillsp.c
字号:
{ addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); src = psrc[ppt->y % tileHeight]; if ( ((ppt->x & PIM) + *pwidth) < PPW) { maskpartialbits(ppt->x, *pwidth, startmask); *addrl = DoMaskMergeRop (src, *addrl, startmask); } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) { *addrl = DoMaskMergeRop (src, *addrl, startmask); addrl++; } while (nlmiddle--) { *addrl = DoMergeRop (src, *addrl); addrl++; } if (endmask) *addrl = DoMaskMergeRop (src, *addrl, endmask); } } pwidth++; ppt++; } } break; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree);}/* Fill spans with tiles that aren't PPW bits wide */voidmfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted;{ int iline; /* first line of tile to use */ /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *pdst;/* pointer to current word in bitmap */ register PixelType *psrc;/* pointer to current word in tile */ register int nlMiddle; register int rop, nstart; PixelType startmask; PixmapPtr pTile; /* pointer to tile we want to fill with */ int w, width, x, xSrc, ySrc, srcStartOver, nend; int tlwidth, rem, tileWidth, tileHeight, endinc; PixelType endmask, *psrcT; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); if (pGC->fillStyle == FillTiled) { pTile = pGC->tile.pixmap; tlwidth = pTile->devKind / PGSZB; rop = pGC->alu; } else { pTile = pGC->stipple; tlwidth = pTile->devKind / PGSZB; rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip; } xSrc = pDrawable->x; ySrc = pDrawable->y; mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; /* this replaces rotating the tile. Instead we just adjust the offset * at which we start grabbing bits from the tile. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, * so that iline and rem always stay within the tile bounds. */ xSrc += (pGC->patOrg.x % tileWidth) - tileWidth; ySrc += (pGC->patOrg.y % tileHeight) - tileHeight; while (n--) { iline = (ppt->y - ySrc) % tileHeight; pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth); x = ppt->x; if (*pwidth) { width = *pwidth; while(width > 0) { psrc = psrcT; w = min(tileWidth, width); if((rem = (x - xSrc) % tileWidth) != 0) { /* if we're in the middle of the tile, get as many bits as will finish the span, or as many as will get to the left edge of the tile, or a longword worth, starting at the appropriate offset in the tile. */ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD); endinc = rem / BITMAP_SCANLINE_PAD; getandputrop((psrc+endinc), (rem&PIM), (x & PIM), w, pdst, rop); if((x & PIM) + w >= PPW) pdst++; } else if(((x & PIM) + w) < PPW) { /* doing < PPW bits is easy, and worth special-casing */ putbitsrop(*psrc, x & PIM, w, pdst, rop); } else { /* start at the left edge of the tile, and put down as much as we can */ maskbits(x, w, startmask, endmask, nlMiddle); if (startmask) nstart = PPW - (x & PIM); else nstart = 0; if (endmask) nend = (x + w) & PIM; else nend = 0; srcStartOver = nstart > PLST; if(startmask) { putbitsrop(*psrc, (x & PIM), nstart, pdst, rop); pdst++; if(srcStartOver) psrc++; } while(nlMiddle--) { getandputrop0(psrc, nstart, PPW, pdst, rop); pdst++; psrc++; } if(endmask) { getandputrop0(psrc, nstart, nend, pdst, rop); } } x += w; width -= w; } } ppt++; pwidth++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree);}/* Fill spans with stipples that aren't PPW bits wide */voidmfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted;{ /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ int iline; /* first line of tile to use */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *pdst; /* pointer to current word in bitmap */ register PixelType *psrc; /* pointer to current word in tile */ register int nlMiddle; register int rop, nstart; PixelType startmask; PixmapPtr pTile; /* pointer to tile we want to fill with */ int w, width, x, xSrc, ySrc, srcStartOver, nend; PixelType endmask, *psrcT; int tlwidth, rem, tileWidth, endinc; int tileHeight; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); pTile = pGC->stipple; rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; tlwidth = pTile->devKind / PGSZB; xSrc = pDrawable->x; ySrc = pDrawable->y; mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; /* this replaces rotating the stipple. Instead, we just adjust the offset * at which we start grabbing bits from the stipple. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, * so that iline and rem always stay within the tile bounds. */ xSrc += (pGC->patOrg.x % tileWidth) - tileWidth; ySrc += (pGC->patOrg.y % tileHeight) - tileHeight; while (n--) { iline = (ppt->y - ySrc) % tileHeight; pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth); x = ppt->x; if (*pwidth) { width = *pwidth; while(width > 0) { psrc = psrcT; w = min(tileWidth, width); if((rem = (x - xSrc) % tileWidth) != 0) { /* if we're in the middle of the tile, get as many bits as will finish the span, or as many as will get to the left edge of the tile, or a longword worth, starting at the appropriate offset in the tile. */ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD); endinc = rem / BITMAP_SCANLINE_PAD; getandputrrop((psrc + endinc), (rem & PIM), (x & PIM), w, pdst, rop) if((x & PIM) + w >= PPW) pdst++; } else if(((x & PIM) + w) < PPW) { /* doing < PPW bits is easy, and worth special-casing */ putbitsrrop(*psrc, x & PIM, w, pdst, rop); } else { /* start at the left edge of the tile, and put down as much as we can */ maskbits(x, w, startmask, endmask, nlMiddle); if (startmask) nstart = PPW - (x & PIM); else nstart = 0; if (endmask) nend = (x + w) & PIM; else nend = 0; srcStartOver = nstart > PLST; if(startmask) { putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop); pdst++; if(srcStartOver) psrc++; } while(nlMiddle--) { getandputrrop0(psrc, nstart, PPW, pdst, rop); pdst++; psrc++; } if(endmask) { getandputrrop0(psrc, nstart, nend, pdst, rop); } } x += w; width -= w; } } ppt++; pwidth++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -