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#define FbSelectPart(xor,o,t)    xor
2405b261ecSmrg
2505b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
2605b261ecSmrg#include <dix-config.h>
2705b261ecSmrg#endif
2805b261ecSmrg
2905b261ecSmrg#include "fb.h"
3005b261ecSmrg
3105b261ecSmrgvoid
3235c4bbdfSmrgfbSolid(FbBits * dst,
3335c4bbdfSmrg        FbStride dstStride,
3435c4bbdfSmrg        int dstX, int bpp, int width, int height, FbBits and, FbBits xor)
3505b261ecSmrg{
3635c4bbdfSmrg    FbBits startmask, endmask;
3735c4bbdfSmrg    int n, nmiddle;
3835c4bbdfSmrg    int startbyte, endbyte;
3905b261ecSmrg
4005b261ecSmrg    dst += dstX >> FB_SHIFT;
4105b261ecSmrg    dstX &= FB_MASK;
4235c4bbdfSmrg    FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte,
4335c4bbdfSmrg                    nmiddle, endmask, endbyte);
4405b261ecSmrg    if (startmask)
4535c4bbdfSmrg        dstStride--;
4605b261ecSmrg    dstStride -= nmiddle;
4735c4bbdfSmrg    while (height--) {
4835c4bbdfSmrg        if (startmask) {
4935c4bbdfSmrg            FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
5035c4bbdfSmrg            dst++;
5135c4bbdfSmrg        }
5235c4bbdfSmrg        n = nmiddle;
5335c4bbdfSmrg        if (!and)
5435c4bbdfSmrg            while (n--)
5535c4bbdfSmrg                WRITE(dst++, xor);
5635c4bbdfSmrg        else
5735c4bbdfSmrg            while (n--) {
5835c4bbdfSmrg                WRITE(dst, FbDoRRop(READ(dst), and, xor));
5905b261ecSmrg                dst++;
6035c4bbdfSmrg            }
6135c4bbdfSmrg        if (endmask)
6235c4bbdfSmrg            FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
6335c4bbdfSmrg        dst += dstStride;
6405b261ecSmrg    }
6505b261ecSmrg}
66