📄 cfb8bit.c
字号:
cfb8StippleBg = bg & PMSK; cfb8StipplePm = planemask & PMSK; rropfg = cfbReduceRasterOp (alu, cfb8StippleFg, cfb8StipplePm, &andfg, &xorfg); rropbg = cfbReduceRasterOp (alu, cfb8StippleBg, cfb8StipplePm, &andbg, &xorbg); if (rropfg == rropbg) cfb8StippleRRop = rropfg; else cfb8StippleRRop = GXset; /* * create the appropriate pixel-fill bits for current * foreground */ for (s = 0; s < NUM_MASKS; s++) { c = cfb8StippleMasks[s]; cfb8StippleAnd[s] = (andfg | ~c) & (andbg | c); cfb8StippleXor[s] = (xorfg & c) | (xorbg & ~c); } return TRUE;}/* * a grungy little routine. This computes clip masks * for partial character blts. Returns rgnOUT if the * entire character is clipped; returns rgnIN if the entire * character is unclipped; returns rgnPART if a portion of * the character is visible. Computes clip masks for each * longword of the character -- and those with the * contents of the glyph to compute the visible bits. */#if PGSZ == 32#if (BITMAP_BIT_ORDER == MSBFirst)PixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff, 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff, 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff, 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f, 0x0000000f, 0x00000007, 0x00000003, 0x00000001,};#elsePixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8, 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80, 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800, 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000, 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000, 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000, 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000, 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000,};#endif /* BITMAP_BIT_ORDER */#else /* PGSZ == 64 */#if (BITMAP_BIT_ORDER == MSBFirst)PixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffffffffffff, 0x7fffffffffffffff, 0x3fffffffffffffff, 0x1fffffffffffffff, 0x0fffffffffffffff, 0x07ffffffffffffff, 0x03ffffffffffffff, 0x01ffffffffffffff, 0x00ffffffffffffff, 0x007fffffffffffff, 0x003fffffffffffff, 0x001fffffffffffff, 0x000fffffffffffff, 0x0007ffffffffffff, 0x0003ffffffffffff, 0x0001ffffffffffff, 0x0000ffffffffffff, 0x00007fffffffffff, 0x00003fffffffffff, 0x00001fffffffffff, 0x00000fffffffffff, 0x000007ffffffffff, 0x000003ffffffffff, 0x000001ffffffffff, 0x000000ffffffffff, 0x0000007fffffffff, 0x0000003fffffffff, 0x0000001fffffffff, 0x0000000fffffffff, 0x00000007ffffffff, 0x00000003ffffffff, 0x00000001ffffffff, 0x00000000ffffffff, 0x000000007fffffff, 0x000000003fffffff, 0x000000001fffffff, 0x000000000fffffff, 0x0000000007ffffff, 0x0000000003ffffff, 0x0000000001ffffff, 0x0000000000ffffff, 0x00000000007fffff, 0x00000000003fffff, 0x00000000001fffff, 0x00000000000fffff, 0x000000000007ffff, 0x000000000003ffff, 0x000000000001ffff, 0x000000000000ffff, 0x0000000000007fff, 0x0000000000003fff, 0x0000000000001fff, 0x0000000000000fff, 0x00000000000007ff, 0x00000000000003ff, 0x00000000000001ff, 0x00000000000000ff, 0x000000000000007f, 0x000000000000003f, 0x000000000000001f, 0x000000000000000f, 0x0000000000000007, 0x0000000000000003, 0x0000000000000001};#elsePixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffffffffffff, 0xfffffffffffffffe, 0xfffffffffffffffc, 0xfffffffffffffff8, 0xfffffffffffffff0, 0xffffffffffffffe0, 0xffffffffffffffc0, 0xffffffffffffff80, 0xffffffffffffff00, 0xfffffffffffffe00, 0xfffffffffffffc00, 0xfffffffffffff800, 0xfffffffffffff000, 0xffffffffffffe000, 0xffffffffffffc000, 0xffffffffffff8000, 0xffffffffffff0000, 0xfffffffffffe0000, 0xfffffffffffc0000, 0xfffffffffff80000, 0xfffffffffff00000, 0xffffffffffe00000, 0xffffffffffc00000, 0xffffffffff800000, 0xffffffffff000000, 0xfffffffffe000000, 0xfffffffffc000000, 0xfffffffff8000000, 0xfffffffff0000000, 0xffffffffe0000000, 0xffffffffc0000000, 0xffffffff80000000, 0xffffffff00000000, 0xfffffffe00000000, 0xfffffffc00000000, 0xfffffff800000000, 0xfffffff000000000, 0xffffffe000000000, 0xffffffc000000000, 0xffffff8000000000, 0xffffff0000000000, 0xfffffe0000000000, 0xfffffc0000000000, 0xfffff80000000000, 0xfffff00000000000, 0xffffe00000000000, 0xffffc00000000000, 0xffff800000000000, 0xffff000000000000, 0xfffe000000000000, 0xfffc000000000000, 0xfff8000000000000, 0xfff0000000000000, 0xffe0000000000000, 0xffc0000000000000, 0xff80000000000000, 0xff00000000000000, 0xfe00000000000000, 0xfc00000000000000, 0xf800000000000000, 0xf000000000000000, 0xe000000000000000, 0xc000000000000000, 0x8000000000000000};#endif /* BITMAP_BIT_ORDER */#endif /* PGSZ */intcfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips) BoxPtr pBox; int numRects; int x, y, w, h; CARD32 *clips;{ int yBand, yBandBot; int ch; unsigned long clip; int partIN = FALSE, partOUT = FALSE; int result; if (numRects == 0) return rgnOUT; while (numRects && pBox->y2 <= y) { --numRects; ++pBox; } if (!numRects || pBox->y1 >= y + h) return rgnOUT; yBand = pBox->y1; while (numRects && pBox->y1 == yBand && pBox->x2 <= x) { --numRects; ++pBox; } if (!numRects || pBox->y1 >= y + h) return rgnOUT; if (numRects && x >= pBox->x1 && x + w <= pBox->x2 && y >= pBox->y1 && y + h <= pBox->y2) { return rgnIN; } ch = 0; while (numRects && pBox->y1 < y + h) { yBand = pBox->y1; yBandBot = pBox->y2; while (ch < h && y + ch < yBand) { partOUT = TRUE; clips[ch++] = 0; } if (ch >= h) break; while (numRects && pBox->y1 == yBand && pBox->x2 <= x) { --numRects; ++pBox; } if (!numRects) break; clip = 0; while (numRects && pBox->y1 == yBand && pBox->x1 < x + w) { if (x < pBox->x1) if (pBox->x2 < x + w) clip |= cfb8BitLenMasks[pBox->x1 - x] & ~cfb8BitLenMasks[pBox->x2 - x]; else clip |= cfb8BitLenMasks[pBox->x1 - x]; else if (pBox->x2 < x + w) clip |= ~cfb8BitLenMasks[pBox->x2 - x]; else clip = ~0; --numRects; ++pBox; } if (clip != 0) partIN = TRUE; if (clip != ~0) partOUT = TRUE; while (ch < h && y + ch < yBandBot) clips[ch++] = clip; while (numRects && pBox->y1 == yBand) { --numRects; ++pBox; } } while (ch < h) { partOUT = TRUE; clips[ch++] = 0; } result = rgnOUT; if (partIN) { if (partOUT) result = rgnPART; else result = rgnIN; } return result;}#endif /* PSZ == 8 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -