1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright © 1998 Keith Packard
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software and its
5*4882a593Smuzhiyun * documentation for any purpose is hereby granted without fee, provided that
6*4882a593Smuzhiyun * the above copyright notice appear in all copies and that both that
7*4882a593Smuzhiyun * copyright notice and this permission notice appear in supporting
8*4882a593Smuzhiyun * documentation, and that the name of Keith Packard not be used in
9*4882a593Smuzhiyun * advertising or publicity pertaining to distribution of the software without
10*4882a593Smuzhiyun * specific, written prior permission. Keith Packard makes no
11*4882a593Smuzhiyun * representations about the suitability of this software for any purpose. It
12*4882a593Smuzhiyun * is provided "as is" without express or implied warranty.
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15*4882a593Smuzhiyun * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16*4882a593Smuzhiyun * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17*4882a593Smuzhiyun * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18*4882a593Smuzhiyun * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19*4882a593Smuzhiyun * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20*4882a593Smuzhiyun * PERFORMANCE OF THIS SOFTWARE.
21*4882a593Smuzhiyun */
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H
24*4882a593Smuzhiyun #include <dix-config.h>
25*4882a593Smuzhiyun #endif
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun #include "fb.h"
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun FbBits
fbReplicatePixel(Pixel p,int bpp)30*4882a593Smuzhiyun fbReplicatePixel(Pixel p, int bpp)
31*4882a593Smuzhiyun {
32*4882a593Smuzhiyun FbBits b = p;
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun b &= FbFullMask(bpp);
35*4882a593Smuzhiyun while (bpp < FB_UNIT) {
36*4882a593Smuzhiyun b |= b << bpp;
37*4882a593Smuzhiyun bpp <<= 1;
38*4882a593Smuzhiyun }
39*4882a593Smuzhiyun return b;
40*4882a593Smuzhiyun }
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun #define O 0
43*4882a593Smuzhiyun #define I FB_ALLONES
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun const FbMergeRopRec FbMergeRopBits[16] = {
46*4882a593Smuzhiyun {O, O, O, O}, /* clear 0x0 0 */
47*4882a593Smuzhiyun {I, O, O, O}, /* and 0x1 src AND dst */
48*4882a593Smuzhiyun {I, O, I, O}, /* andReverse 0x2 src AND NOT dst */
49*4882a593Smuzhiyun {O, O, I, O}, /* copy 0x3 src */
50*4882a593Smuzhiyun {I, I, O, O}, /* andInverted 0x4 NOT src AND dst */
51*4882a593Smuzhiyun {O, I, O, O}, /* noop 0x5 dst */
52*4882a593Smuzhiyun {O, I, I, O}, /* xor 0x6 src XOR dst */
53*4882a593Smuzhiyun {I, I, I, O}, /* or 0x7 src OR dst */
54*4882a593Smuzhiyun {I, I, I, I}, /* nor 0x8 NOT src AND NOT dst */
55*4882a593Smuzhiyun {O, I, I, I}, /* equiv 0x9 NOT src XOR dst */
56*4882a593Smuzhiyun {O, I, O, I}, /* invert 0xa NOT dst */
57*4882a593Smuzhiyun {I, I, O, I}, /* orReverse 0xb src OR NOT dst */
58*4882a593Smuzhiyun {O, O, I, I}, /* copyInverted 0xc NOT src */
59*4882a593Smuzhiyun {I, O, I, I}, /* orInverted 0xd NOT src OR dst */
60*4882a593Smuzhiyun {I, O, O, I}, /* nand 0xe NOT src OR NOT dst */
61*4882a593Smuzhiyun {O, O, O, I}, /* set 0xf 1 */
62*4882a593Smuzhiyun };
63*4882a593Smuzhiyun
64