VirtualBox

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

最後變更 在這個檔案是 51223,由 vboxsync 提交於 11 年 前

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

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

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