105b261ecSmrg/* 205b261ecSmrg * Copyright © 1998 Keith Packard 305b261ecSmrg * 405b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its 505b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that 605b261ecSmrg * the above copyright notice appear in all copies and that both that 705b261ecSmrg * copyright notice and this permission notice appear in supporting 805b261ecSmrg * documentation, and that the name of Keith Packard not be used in 905b261ecSmrg * advertising or publicity pertaining to distribution of the software without 1005b261ecSmrg * specific, written prior permission. Keith Packard makes no 1105b261ecSmrg * representations about the suitability of this software for any purpose. It 1205b261ecSmrg * is provided "as is" without express or implied warranty. 1305b261ecSmrg * 1405b261ecSmrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 1505b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 1605b261ecSmrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 1705b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 1805b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 1905b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 2005b261ecSmrg * PERFORMANCE OF THIS SOFTWARE. 2105b261ecSmrg */ 2205b261ecSmrg 2305b261ecSmrg#ifdef HAVE_DIX_CONFIG_H 2405b261ecSmrg#include <dix-config.h> 2505b261ecSmrg#endif 2605b261ecSmrg 2705b261ecSmrg#include "fb.h" 2805b261ecSmrg 2905b261ecSmrgFbBits 3035c4bbdfSmrgfbReplicatePixel(Pixel p, int bpp) 3105b261ecSmrg{ 3235c4bbdfSmrg FbBits b = p; 3305b261ecSmrg 3435c4bbdfSmrg b &= FbFullMask(bpp); 3535c4bbdfSmrg while (bpp < FB_UNIT) { 3635c4bbdfSmrg b |= b << bpp; 3735c4bbdfSmrg bpp <<= 1; 3805b261ecSmrg } 3935c4bbdfSmrg return b; 4005b261ecSmrg} 4105b261ecSmrg 4205b261ecSmrg#define O 0 4305b261ecSmrg#define I FB_ALLONES 4405b261ecSmrg 4505b261ecSmrgconst FbMergeRopRec FbMergeRopBits[16] = { 4635c4bbdfSmrg {O, O, O, O}, /* clear 0x0 0 */ 4735c4bbdfSmrg {I, O, O, O}, /* and 0x1 src AND dst */ 4835c4bbdfSmrg {I, O, I, O}, /* andReverse 0x2 src AND NOT dst */ 4935c4bbdfSmrg {O, O, I, O}, /* copy 0x3 src */ 5035c4bbdfSmrg {I, I, O, O}, /* andInverted 0x4 NOT src AND dst */ 5135c4bbdfSmrg {O, I, O, O}, /* noop 0x5 dst */ 5235c4bbdfSmrg {O, I, I, O}, /* xor 0x6 src XOR dst */ 5335c4bbdfSmrg {I, I, I, O}, /* or 0x7 src OR dst */ 5435c4bbdfSmrg {I, I, I, I}, /* nor 0x8 NOT src AND NOT dst */ 5535c4bbdfSmrg {O, I, I, I}, /* equiv 0x9 NOT src XOR dst */ 5635c4bbdfSmrg {O, I, O, I}, /* invert 0xa NOT dst */ 5735c4bbdfSmrg {I, I, O, I}, /* orReverse 0xb src OR NOT dst */ 5835c4bbdfSmrg {O, O, I, I}, /* copyInverted 0xc NOT src */ 5935c4bbdfSmrg {I, O, I, I}, /* orInverted 0xd NOT src OR dst */ 6035c4bbdfSmrg {I, O, O, I}, /* nand 0xe NOT src OR NOT dst */ 6135c4bbdfSmrg {O, O, O, I}, /* set 0xf 1 */ 6205b261ecSmrg}; 6305b261ecSmrg 64