VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.13.0/fbrop.h@ 81245

最後變更 在這個檔案從81245是 43251,由 vboxsync 提交於 12 年 前

Additions/x11: added headers for X.Org Server 1.13.

  • 屬性 svn:eol-style 設為 native
檔案大小: 4.8 KB
 
1/*
2 * Copyright © 1998 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
13 *
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 */
22
23#ifndef _FBROP_H_
24#define _FBROP_H_
25
26typedef struct _mergeRopBits {
27 FbBits ca1, cx1, ca2, cx2;
28} FbMergeRopRec, *FbMergeRopPtr;
29
30extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16];
31
32#define FbDeclareMergeRop() FbBits _ca1, _cx1, _ca2, _cx2;
33#define FbDeclarePrebuiltMergeRop() FbBits _cca, _ccx;
34
35#define FbInitializeMergeRop(alu,pm) {\
36 const FbMergeRopRec *_bits; \
37 _bits = &FbMergeRopBits[alu]; \
38 _ca1 = _bits->ca1 & pm; \
39 _cx1 = _bits->cx1 | ~pm; \
40 _ca2 = _bits->ca2 & pm; \
41 _cx2 = _bits->cx2 & pm; \
42}
43
44#define FbDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \
45 (((alu) >> 1 & 5) == ((alu) & 5)))
46
47#define FbDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0)
48
49/* AND has higher precedence than XOR */
50
51#define FbDoMergeRop(src, dst) \
52 (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2))
53
54#define FbDoDestInvarientMergeRop(src) (((src) & _ca2) ^ _cx2)
55
56#define FbDoMaskMergeRop(src, dst, mask) \
57 (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask)))
58
59#define FbDoLeftMaskByteMergeRop(dst, src, lb, l) { \
60 FbBits __xor = ((src) & _ca2) ^ _cx2; \
61 FbDoLeftMaskByteRRop(dst,lb,l,((src) & _ca1) ^ _cx1,__xor); \
62}
63
64#define FbDoRightMaskByteMergeRop(dst, src, rb, r) { \
65 FbBits __xor = ((src) & _ca2) ^ _cx2; \
66 FbDoRightMaskByteRRop(dst,rb,r,((src) & _ca1) ^ _cx1,__xor); \
67}
68
69#define FbDoRRop(dst, and, xor) (((dst) & (and)) ^ (xor))
70
71#define FbDoMaskRRop(dst, and, xor, mask) \
72 (((dst) & ((and) | ~(mask))) ^ (xor & mask))
73
74/*
75 * Take a single bit (0 or 1) and generate a full mask
76 */
77#define fbFillFromBit(b,t) (~((t) ((b) & 1)-1))
78
79#define fbXorT(rop,fg,pm,t) ((((fg) & fbFillFromBit((rop) >> 1,t)) | \
80 (~(fg) & fbFillFromBit((rop) >> 3,t))) & (pm))
81
82#define fbAndT(rop,fg,pm,t) ((((fg) & fbFillFromBit (rop ^ (rop>>1),t)) | \
83 (~(fg) & fbFillFromBit((rop>>2) ^ (rop>>3),t))) | \
84 ~(pm))
85
86#define fbXor(rop,fg,pm) fbXorT(rop,fg,pm,FbBits)
87
88#define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,FbBits)
89
90#define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,FbStip)
91
92#define fbAndStip(rop,fg,pm) fbAndT(rop,fg,pm,FbStip)
93
94/*
95 * Stippling operations;
96 */
97
98extern _X_EXPORT const FbBits fbStipple16Bits[256]; /* half of table */
99
100#define FbStipple16Bits(b) \
101 (fbStipple16Bits[(b)&0xff] | fbStipple16Bits[(b) >> 8] << FB_HALFUNIT)
102extern _X_EXPORT const FbBits fbStipple8Bits[256];
103extern _X_EXPORT const FbBits fbStipple4Bits[16];
104extern _X_EXPORT const FbBits fbStipple2Bits[4];
105extern _X_EXPORT const FbBits fbStipple1Bits[2];
106extern _X_EXPORT const FbBits *const fbStippleTable[];
107
108#define FbStippleRRop(dst, b, fa, fx, ba, bx) \
109 (FbDoRRop(dst, fa, fx) & b) | (FbDoRRop(dst, ba, bx) & ~b)
110
111#define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \
112 (FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b))
113
114#define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \
115 FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \
116 FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \
117}
118
119#define FbDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \
120 FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \
121 FbDoRightMaskByteRRop(dst, rb, r, ((fa) & (b)) | ((ba) & ~(b)), __xor); \
122}
123
124#define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b)))
125
126/*
127 * Compute rop for using tile code for 1-bit dest stipples; modifies
128 * existing rop to flip depending on pixel values
129 */
130#define FbStipple1RopPick(alu,b) (((alu) >> (2 - (((b) & 1) << 1))) & 3)
131
132#define FbOpaqueStipple1Rop(alu,fg,bg) (FbStipple1RopPick(alu,fg) | \
133 (FbStipple1RopPick(alu,bg) << 2))
134
135#define FbStipple1Rop(alu,fg) (FbStipple1RopPick(alu,fg) | 4)
136
137#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette