45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright © 1998 Keith Packard
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission to use, copy, modify, distribute, and sell this software and its
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation for any purpose is hereby granted without fee, provided that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the above copyright notice appear in all copies and that both that
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copyright notice and this permission notice appear in supporting
45e9809aff7304721fddb95654901b32195c9c7avboxsync * documentation, and that the name of Keith Packard not be used in
45e9809aff7304721fddb95654901b32195c9c7avboxsync * advertising or publicity pertaining to distribution of the software without
45e9809aff7304721fddb95654901b32195c9c7avboxsync * specific, written prior permission. Keith Packard makes no
45e9809aff7304721fddb95654901b32195c9c7avboxsync * representations about the suitability of this software for any purpose. It
45e9809aff7304721fddb95654901b32195c9c7avboxsync * is provided "as is" without express or implied warranty.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
45e9809aff7304721fddb95654901b32195c9c7avboxsync * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
45e9809aff7304721fddb95654901b32195c9c7avboxsync * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45e9809aff7304721fddb95654901b32195c9c7avboxsync * PERFORMANCE OF THIS SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This file defines functions for drawing some primitives using
45e9809aff7304721fddb95654901b32195c9c7avboxsync * underlying datatypes instead of masks
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & 0x80008000)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef HAVE_DIX_CONFIG_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <dix-config.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BITSMUL
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define MUL BITSMUL
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define MUL 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BITSSTORE
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define STORE(b,x) BITSSTORE(b,x)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define STORE(b,x) WRITE((b), (x))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BITSRROP
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define RROP(b,a,x) BITSRROP(b,a,x)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define RROP(b,a,x) WRITE((b), FbDoRRop (READ(b), (a), (x)))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BITSUNIT
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define UNIT BITSUNIT
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define USE_SOLID
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define UNIT BITS
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Define the following before including this file:
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * BRESSOLID name of function for drawing a solid segment
45e9809aff7304721fddb95654901b32195c9c7avboxsync * BRESDASH name of function for drawing a dashed segment
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DOTS name of function for drawing dots
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ARC name of function for drawing a solid arc
45e9809aff7304721fddb95654901b32195c9c7avboxsync * BITS type of underlying unit
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BRESSOLID
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncBRESSOLID (DrawablePtr pDrawable,
45e9809aff7304721fddb95654901b32195c9c7avboxsync GCPtr pGC,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dashOffset,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int signdx,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int signdy,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int axis,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int x1,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int y1,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e1,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e3,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits *dst;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride dstStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstBpp;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstXoff, dstYoff;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *bits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride majorStep, minorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS xor = (BITS) pPriv->xor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (signdy < 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsStride = -bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (axis == X_AXIS)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync majorStep = signdx * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync minorStep = bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync majorStep = bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync minorStep = signdx * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (len--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync STORE(bits,xor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += majorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (e >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += minorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbFinishAccess (pDrawable);
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BRESDASH
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncBRESDASH (DrawablePtr pDrawable,
45e9809aff7304721fddb95654901b32195c9c7avboxsync GCPtr pGC,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dashOffset,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int signdx,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int signdy,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int axis,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int x1,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int y1,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e1,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e3,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits *dst;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride dstStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstBpp;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstXoff, dstYoff;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbGCPrivPtr pPriv = fbGetGCPrivate (pGC);
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *bits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride majorStep, minorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS xorfg, xorbg;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbDashDeclare;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dashlen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool even;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool doOdd;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
45e9809aff7304721fddb95654901b32195c9c7avboxsync doOdd = pGC->lineStyle == LineDoubleDash;
45e9809aff7304721fddb95654901b32195c9c7avboxsync xorfg = (BITS) pPriv->xor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync xorbg = (BITS) pPriv->bgxor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbDashInit (pGC, pPriv, dashOffset, dashlen, even);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (signdy < 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsStride = -bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (axis == X_AXIS)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync majorStep = signdx * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync minorStep = bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync majorStep = bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync minorStep = signdx * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (dashlen >= len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync dashlen = len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (doOdd)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!even)
45e9809aff7304721fddb95654901b32195c9c7avboxsync goto doubleOdd;
45e9809aff7304721fddb95654901b32195c9c7avboxsync for (;;)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync len -= dashlen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (dashlen--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync STORE(bits,xorfg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += majorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if ((e += e1) >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += minorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbDashNextEven(dashlen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (dashlen >= len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync dashlen = len;
45e9809aff7304721fddb95654901b32195c9c7avboxsyncdoubleOdd:
45e9809aff7304721fddb95654901b32195c9c7avboxsync len -= dashlen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (dashlen--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync STORE(bits,xorbg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += majorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if ((e += e1) >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += minorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbDashNextOdd(dashlen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (dashlen >= len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync dashlen = len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!even)
45e9809aff7304721fddb95654901b32195c9c7avboxsync goto onOffOdd;
45e9809aff7304721fddb95654901b32195c9c7avboxsync for (;;)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync len -= dashlen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (dashlen--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync STORE(bits,xorfg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += majorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if ((e += e1) >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += minorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbDashNextEven (dashlen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (dashlen >= len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync dashlen = len;
45e9809aff7304721fddb95654901b32195c9c7avboxsynconOffOdd:
45e9809aff7304721fddb95654901b32195c9c7avboxsync len -= dashlen;
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (dashlen--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += majorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if ((e += e1) >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += minorStep;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbDashNextOdd (dashlen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (dashlen >= len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync dashlen = len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbFinishAccess (pDrawable);
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef DOTS
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncDOTS (FbBits *dst,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride dstStride,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstBpp,
45e9809aff7304721fddb95654901b32195c9c7avboxsync BoxPtr pBox,
45e9809aff7304721fddb95654901b32195c9c7avboxsync xPoint *ptsOrig,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int npt,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int xorg,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int yorg,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int xoff,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int yoff,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits and,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits xor)
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 *pts = (INT32 *) ptsOrig;
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *bits = (UNIT *) dst;
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *point;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS bxor = (BITS) xor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS band = (BITS) and;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 ul, lr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 pt;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync lr = coordToInt(pBox->x2 - xorg - 1, pBox->y2 - yorg - 1);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += bitsStride * (yorg + yoff) + (xorg + xoff) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (and == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (npt--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!isClipped(pt,ul,lr))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync STORE(point,bxor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (npt--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!isClipped(pt,ul,lr))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync RROP(point,band,bxor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef ARC
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define ARCCOPY(d) STORE(d,xorBits)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define ARCRROP(d) RROP(d,andBits,xorBits)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncARC (FbBits *dst,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride dstStride,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstBpp,
45e9809aff7304721fddb95654901b32195c9c7avboxsync xArc *arc,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int drawX,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int drawY,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits and,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits xor)
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *bits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync miZeroArcRec info;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool do360;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int x;
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *yorgp, *yorgop;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS andBits, xorBits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int yoffset, dyoffset;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int y, a, b, d, mask;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int k1, k3, dx, dy;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits = (UNIT *) dst;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
45e9809aff7304721fddb95654901b32195c9c7avboxsync andBits = (BITS) and;
45e9809aff7304721fddb95654901b32195c9c7avboxsync xorBits = (BITS) xor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync do360 = miZeroArcSetup(arc, &info, TRUE);
45e9809aff7304721fddb95654901b32195c9c7avboxsync yorgp = bits + ((info.yorg + drawY) * bitsStride);
45e9809aff7304721fddb95654901b32195c9c7avboxsync yorgop = bits + ((info.yorgo + drawY) * bitsStride);
45e9809aff7304721fddb95654901b32195c9c7avboxsync info.xorg = (info.xorg + drawX) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync info.xorgo = (info.xorgo + drawX) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync MIARCSETUP();
45e9809aff7304721fddb95654901b32195c9c7avboxsync yoffset = y ? bitsStride : 0;
45e9809aff7304721fddb95654901b32195c9c7avboxsync dyoffset = 0;
45e9809aff7304721fddb95654901b32195c9c7avboxsync mask = info.initialMask;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!(arc->width & 1))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (andBits == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 2)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + info.xorgo);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop + info.xorgo);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 2)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + info.xorgo);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop + info.xorgo);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!info.end.x || !info.end.y)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync mask = info.end.mask;
45e9809aff7304721fddb95654901b32195c9c7avboxsync info.end = info.altend;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (do360 && (arc->width == arc->height) && !(arc->width & 1))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync int xoffset = bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg;
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *yorgohb = yorghb - info.h * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync yorgp += info.xorg;
45e9809aff7304721fddb95654901b32195c9c7avboxsync yorgop += info.xorg;
45e9809aff7304721fddb95654901b32195c9c7avboxsync yorghb += info.h * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (andBits == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (a < 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (andBits == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorghb - xoffset - y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgohb - xoffset + y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgohb + xoffset + y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorghb + xoffset - y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorghb - xoffset - y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgohb - xoffset + y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgohb + xoffset + y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorghb + xoffset - y * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync xoffset += bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync MIARCCIRCLESTEP(yoffset += bitsStride;);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync yorgp -= info.xorg;
45e9809aff7304721fddb95654901b32195c9c7avboxsync yorgop -= info.xorg;
45e9809aff7304721fddb95654901b32195c9c7avboxsync x = info.w;
45e9809aff7304721fddb95654901b32195c9c7avboxsync yoffset = info.h * bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else if (do360)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (y < info.h || x < info.w)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync MIARCOCTANTSHIFT(dyoffset = bitsStride;);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (andBits == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (y < info.h || x < info.w)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync MIARCOCTANTSHIFT(dyoffset = bitsStride;);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if ((x == info.start.x) || (y == info.start.y))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync mask = info.start.mask;
45e9809aff7304721fddb95654901b32195c9c7avboxsync info.start = info.altstart;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (andBits == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 2)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 4)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 2)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 4)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if ((x == info.end.x) || (y == info.end.y))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync mask = info.end.mask;
45e9809aff7304721fddb95654901b32195c9c7avboxsync info.end = info.altend;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if ((x == info.start.x) || (y == info.start.y))
45e9809aff7304721fddb95654901b32195c9c7avboxsync mask = info.start.mask;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (andBits == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 4)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (arc->height & 1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 2)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCCOPY(yorgop - yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 4)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (arc->height & 1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 2)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgp + yoffset + info.xorgo - x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mask & 8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync ARCRROP(yorgop - yoffset + info.xorg + x * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef ARCCOPY
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef ARCRROP
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef GLYPH
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if BITMAP_BIT_ORDER == LSBFirst
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE_ADDR1(n) (n)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE_ADDR2(n) (n)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE_ADDR4(n) (n)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE_ADDR1(n) ((n) ^ 3)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE_ADDR2(n) ((n) ^ 2)
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE_ADDR4(n) ((n))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define WRITE1(d,n,fg) WRITE(d + WRITE_ADDR1(n), (BITS) (fg))
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BITS2
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE2(d,n,fg) WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE2(d,n,fg) (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef BITS4
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE4(d,n,fg) WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#else
45e9809aff7304721fddb95654901b32195c9c7avboxsync# define WRITE4(d,n,fg) (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncGLYPH (FbBits *dstBits,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride dstStride,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstBpp,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStip *stipple,
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits fg,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int x,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int height)
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync int lshift;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStip bits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS *dstLine;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS *dst;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int n;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int shift;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstLine = (BITS *) dstBits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstLine += x & ~3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstStride *= (sizeof (FbBits) / sizeof (BITS));
45e9809aff7304721fddb95654901b32195c9c7avboxsync shift = x & 3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync lshift = 4 - shift;
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (height--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits = *stipple++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync dst = (BITS *) dstLine;
45e9809aff7304721fddb95654901b32195c9c7avboxsync n = lshift;
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (bits)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync switch (FbStipMoveLsb (FbLeftStipBits (bits, n), 4, n)) {
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 0:
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 1:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 2:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,1,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 3:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE2(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 4:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,2,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 5:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,2,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 6:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,1,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,2,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 7:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE2(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,2,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 8:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,3,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 9:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,3,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 10:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,1,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,3,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 11:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE2(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,3,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 12:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE2(dst,2,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 13:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE2(dst,2,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 14:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE1(dst,1,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE2(dst,2,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync case 15:
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE4(dst,0,fg);
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits = FbStipLeft (bits, n);
45e9809aff7304721fddb95654901b32195c9c7avboxsync n = 4;
45e9809aff7304721fddb95654901b32195c9c7avboxsync dst += 4;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstLine += dstStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef WRITE_ADDR1
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef WRITE_ADDR2
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef WRITE_ADDR4
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef WRITE1
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef WRITE2
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef WRITE4
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef POLYLINE
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncPOLYLINE (DrawablePtr pDrawable,
45e9809aff7304721fddb95654901b32195c9c7avboxsync GCPtr pGC,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int mode,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int npt,
45e9809aff7304721fddb95654901b32195c9c7avboxsync DDXPointPtr ptsOrig)
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 *pts = (INT32 *) ptsOrig;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int xoff = pDrawable->x;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int yoff = pDrawable->y;
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync BoxPtr pBox = REGION_EXTENTS (pDrawable->pScreen, fbGetCompositeClip (pGC));
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits *dst;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstBpp;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstXoff, dstYoff;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *bits, *bitsBase;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS xor = fbGetGCPrivate(pGC)->xor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS and = fbGetGCPrivate(pGC)->and;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dashoffset = 0;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 ul, lr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 pt1, pt2;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e, e1, e3, len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int stepmajor, stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int octant;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (mode == CoordModePrevious)
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbFixCoordModePrevious (npt, ptsOrig);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
45e9809aff7304721fddb95654901b32195c9c7avboxsync lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt1 = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync npt--;
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt2 = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync npt--;
45e9809aff7304721fddb95654901b32195c9c7avboxsync for (;;)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbSegment (pDrawable, pGC,
45e9809aff7304721fddb95654901b32195c9c7avboxsync intToX(pt1) + xoff, intToY(pt1) + yoff,
45e9809aff7304721fddb95654901b32195c9c7avboxsync intToX(pt2) + xoff, intToY(pt2) + yoff,
45e9809aff7304721fddb95654901b32195c9c7avboxsync npt == 0 && pGC->capStyle != CapNotLast,
45e9809aff7304721fddb95654901b32195c9c7avboxsync &dashoffset);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!npt) {
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbFinishAccess (pDrawable);
45e9809aff7304721fddb95654901b32195c9c7avboxsync return;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt1 = pt2;
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt2 = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync npt--;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync for (;;)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync CalcLineDeltas (intToX(pt1), intToY(pt1),
45e9809aff7304721fddb95654901b32195c9c7avboxsync intToX(pt2), intToY(pt2),
45e9809aff7304721fddb95654901b32195c9c7avboxsync len, e1, stepmajor, stepminor, 1, bitsStride,
45e9809aff7304721fddb95654901b32195c9c7avboxsync octant);
45e9809aff7304721fddb95654901b32195c9c7avboxsync stepmajor *= MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (len < e1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync e3 = len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync len = e1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e1 = e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync e3 = stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync stepminor = stepmajor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync stepmajor = e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync SetYMajorOctant(octant);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync e = -len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e1 <<= 1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e3 = e << 1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FIXUP_ERROR (e, octant, bias);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (and == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (len--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync STORE(bits,xor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepmajor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (e >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (len--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync RROP(bits,and,xor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepmajor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (e >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!npt)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (pGC->capStyle != CapNotLast &&
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt2 != *((INT32 *) ptsOrig))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync RROP(bits,and,xor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbFinishAccess (pDrawable);
45e9809aff7304721fddb95654901b32195c9c7avboxsync return;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt1 = pt2;
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt2 = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync --npt;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (isClipped (pt2, ul, lr))
45e9809aff7304721fddb95654901b32195c9c7avboxsync break;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbFinishAccess (pDrawable);
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifdef POLYSEGMENT
45e9809aff7304721fddb95654901b32195c9c7avboxsyncvoid
45e9809aff7304721fddb95654901b32195c9c7avboxsyncPOLYSEGMENT (DrawablePtr pDrawable,
45e9809aff7304721fddb95654901b32195c9c7avboxsync GCPtr pGC,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int nseg,
45e9809aff7304721fddb95654901b32195c9c7avboxsync xSegment *pseg)
45e9809aff7304721fddb95654901b32195c9c7avboxsync{
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 *pts = (INT32 *) pseg;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int xoff = pDrawable->x;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int yoff = pDrawable->y;
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync BoxPtr pBox = REGION_EXTENTS (pDrawable->pScreen, fbGetCompositeClip (pGC));
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits *dst;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstBpp;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstXoff, dstYoff;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync UNIT *bits, *bitsBase;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbStride bitsStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits xorBits = fbGetGCPrivate(pGC)->xor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits andBits = fbGetGCPrivate(pGC)->and;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS xor = xorBits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BITS and = andBits;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dashoffset = 0;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 ul, lr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync INT32 pt1, pt2;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync int e, e1, e3, len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int stepmajor, stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int octant;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool capNotLast;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT));
45e9809aff7304721fddb95654901b32195c9c7avboxsync bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff);
45e9809aff7304721fddb95654901b32195c9c7avboxsync lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync capNotLast = pGC->capStyle == CapNotLast;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (nseg--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt1 = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync pt2 = *pts++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr))
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbSegment (pDrawable, pGC,
45e9809aff7304721fddb95654901b32195c9c7avboxsync intToX(pt1) + xoff, intToY(pt1) + yoff,
45e9809aff7304721fddb95654901b32195c9c7avboxsync intToX(pt2) + xoff, intToY(pt2) + yoff,
45e9809aff7304721fddb95654901b32195c9c7avboxsync !capNotLast, &dashoffset);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync CalcLineDeltas (intToX(pt1), intToY(pt1),
45e9809aff7304721fddb95654901b32195c9c7avboxsync intToX(pt2), intToY(pt2),
45e9809aff7304721fddb95654901b32195c9c7avboxsync len, e1, stepmajor, stepminor, 1, bitsStride,
45e9809aff7304721fddb95654901b32195c9c7avboxsync octant);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (e1 == 0 && len > 3
45e9809aff7304721fddb95654901b32195c9c7avboxsync#if MUL != 1
45e9809aff7304721fddb95654901b32195c9c7avboxsync && FbCheck24Pix(and) && FbCheck24Pix(xor)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync )
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync int x1, x2;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits *dstLine;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int dstX, width;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbBits startmask, endmask;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int nmiddle;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (stepmajor < 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync x1 = intToX(pt2);
45e9809aff7304721fddb95654901b32195c9c7avboxsync x2 = intToX(pt1) + 1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (capNotLast)
45e9809aff7304721fddb95654901b32195c9c7avboxsync x1++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync x1 = intToX(pt1);
45e9809aff7304721fddb95654901b32195c9c7avboxsync x2 = intToX(pt2);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!capNotLast)
45e9809aff7304721fddb95654901b32195c9c7avboxsync x2++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstX = (x1 + xoff + dstXoff) * (sizeof (UNIT) * 8 * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync width = (x2 - x1) * (sizeof (UNIT) * 8 * MUL);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride;
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstLine += dstX >> FB_SHIFT;
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstX &= FB_MASK;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FbMaskBits (dstX, width, startmask, nmiddle, endmask);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (startmask)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, startmask));
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstLine++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!andBits)
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (nmiddle--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE(dstLine++, xorBits);
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (nmiddle--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE(dstLine, FbDoRRop (READ(dstLine), andBits, xorBits));
45e9809aff7304721fddb95654901b32195c9c7avboxsync dstLine++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (endmask)
45e9809aff7304721fddb95654901b32195c9c7avboxsync WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, endmask));
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync stepmajor *= MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (len < e1)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync e3 = len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync len = e1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e1 = e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync e3 = stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync stepminor = stepmajor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync stepmajor = e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync SetYMajorOctant(octant);
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync e = -len;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e1 <<= 1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e3 = e << 1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync FIXUP_ERROR (e, octant, bias);
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (!capNotLast)
45e9809aff7304721fddb95654901b32195c9c7avboxsync len++;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (and == 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (len--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync STORE(bits,xor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepmajor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (e >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync else
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync while (len--)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync RROP(bits,and,xor);
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepmajor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e1;
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (e >= 0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync {
45e9809aff7304721fddb95654901b32195c9c7avboxsync bits += stepminor;
45e9809aff7304721fddb95654901b32195c9c7avboxsync e += e3;
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync }
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync fbFinishAccess (pDrawable);
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef MUL
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef STORE
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef RROP
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef UNIT
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef USE_SOLID
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef isClipped