fbbits.c revision 05b261ec
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#include "miline.h" 2905b261ecSmrg#include "mizerarc.h" 3005b261ecSmrg 3105b261ecSmrg#undef BRESSOLID 3205b261ecSmrg#undef BRESDASH 3305b261ecSmrg#undef DOTS 3405b261ecSmrg#undef ARC 3505b261ecSmrg#undef GLYPH 3605b261ecSmrg#undef BITS 3705b261ecSmrg#undef BITS2 3805b261ecSmrg#undef BITS4 3905b261ecSmrg 4005b261ecSmrg#define BRESSOLID fbBresSolid8 4105b261ecSmrg#define BRESDASH fbBresDash8 4205b261ecSmrg#define DOTS fbDots8 4305b261ecSmrg#define ARC fbArc8 4405b261ecSmrg#define GLYPH fbGlyph8 4505b261ecSmrg#define POLYLINE fbPolyline8 4605b261ecSmrg#define POLYSEGMENT fbPolySegment8 4705b261ecSmrg#define BITS BYTE 4805b261ecSmrg#define BITS2 CARD16 4905b261ecSmrg#define BITS4 CARD32 5005b261ecSmrg 5105b261ecSmrg#include "fbbits.h" 5205b261ecSmrg 5305b261ecSmrg#undef BRESSOLID 5405b261ecSmrg#undef BRESDASH 5505b261ecSmrg#undef DOTS 5605b261ecSmrg#undef ARC 5705b261ecSmrg#undef GLYPH 5805b261ecSmrg#undef POLYLINE 5905b261ecSmrg#undef POLYSEGMENT 6005b261ecSmrg#undef BITS 6105b261ecSmrg#undef BITS2 6205b261ecSmrg#undef BITS4 6305b261ecSmrg 6405b261ecSmrg#define BRESSOLID fbBresSolid16 6505b261ecSmrg#define BRESDASH fbBresDash16 6605b261ecSmrg#define DOTS fbDots16 6705b261ecSmrg#define ARC fbArc16 6805b261ecSmrg#define GLYPH fbGlyph16 6905b261ecSmrg#define POLYLINE fbPolyline16 7005b261ecSmrg#define POLYSEGMENT fbPolySegment16 7105b261ecSmrg#define BITS CARD16 7205b261ecSmrg#define BITS2 CARD32 7305b261ecSmrg#if FB_SHIFT == 6 7405b261ecSmrg#define BITS4 FbBits 7505b261ecSmrg#endif 7605b261ecSmrg 7705b261ecSmrg#include "fbbits.h" 7805b261ecSmrg 7905b261ecSmrg#undef BRESSOLID 8005b261ecSmrg#undef BRESDASH 8105b261ecSmrg#undef DOTS 8205b261ecSmrg#undef ARC 8305b261ecSmrg#undef GLYPH 8405b261ecSmrg#undef POLYLINE 8505b261ecSmrg#undef POLYSEGMENT 8605b261ecSmrg#undef BITS 8705b261ecSmrg#undef BITS2 8805b261ecSmrg#if FB_SHIFT == 6 8905b261ecSmrg#undef BITS4 9005b261ecSmrg#endif 9105b261ecSmrg 9205b261ecSmrg#ifdef FB_24BIT 9305b261ecSmrg#define BRESSOLID fbBresSolid24 9405b261ecSmrg#define BRESDASH fbBresDash24 9505b261ecSmrg#define DOTS fbDots24 9605b261ecSmrg#define ARC fbArc24 9705b261ecSmrg#define POLYLINE fbPolyline24 9805b261ecSmrg#define POLYSEGMENT fbPolySegment24 9905b261ecSmrg 10005b261ecSmrg#define BITS CARD32 10105b261ecSmrg#define BITSUNIT BYTE 10205b261ecSmrg#define BITSMUL 3 10305b261ecSmrg 10405b261ecSmrg#define FbDoTypeStore(b,t,x,s) WRITE(((t *) (b)), (x) >> (s)) 10505b261ecSmrg#define FbDoTypeRRop(b,t,a,x,s) WRITE((t *) (b), FbDoRRop(READ((t *) (b)),\ 10605b261ecSmrg (a) >> (s), \ 10705b261ecSmrg (x) >> (s))) 10805b261ecSmrg#define FbDoTypeMaskRRop(b,t,a,x,m,s) WRITE((t *) (b), FbDoMaskRRop(READ((t *) (b)),\ 10905b261ecSmrg (a) >> (s), \ 11005b261ecSmrg (x) >> (s), \ 11105b261ecSmrg (m) >> (s))) 11205b261ecSmrg#if BITMAP_BIT_ORDER == LSBFirst 11305b261ecSmrg#define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \ 11405b261ecSmrg (FbDoTypeStore (b, CARD8, x, 0), \ 11505b261ecSmrg FbDoTypeStore ((b) + 1, CARD16, x, 8)) : \ 11605b261ecSmrg (FbDoTypeStore (b, CARD16, x, 0), \ 11705b261ecSmrg FbDoTypeStore ((b) + 2, CARD8, x, 16))) 11805b261ecSmrg#define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \ 11905b261ecSmrg (FbDoTypeRRop(b,CARD8,a,x,0), \ 12005b261ecSmrg FbDoTypeRRop((b)+1,CARD16,a,x,8)) : \ 12105b261ecSmrg (FbDoTypeRRop(b,CARD16,a,x,0), \ 12205b261ecSmrg FbDoTypeRRop((b)+2,CARD8,a,x,16))) 12305b261ecSmrg#else 12405b261ecSmrg#define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \ 12505b261ecSmrg (FbDoTypeStore (b, CARD8, x, 16), \ 12605b261ecSmrg FbDoTypeStore ((b) + 1, CARD16, x, 0)) : \ 12705b261ecSmrg (FbDoTypeStore (b, CARD16, x, 8), \ 12805b261ecSmrg FbDoTypeStore ((b) + 2, CARD8, x, 0))) 12905b261ecSmrg#define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \ 13005b261ecSmrg (FbDoTypeRRop (b, CARD8, a, x, 16), \ 13105b261ecSmrg FbDoTypeRRop ((b) + 1, CARD16, a, x, 0)) : \ 13205b261ecSmrg (FbDoTypeRRop (b, CARD16, a, x, 8), \ 13305b261ecSmrg FbDoTypeRRop ((b) + 2, CARD8, a, x, 0))) 13405b261ecSmrg#endif 13505b261ecSmrg 13605b261ecSmrg#include "fbbits.h" 13705b261ecSmrg 13805b261ecSmrg#undef BITSSTORE 13905b261ecSmrg#undef BITSRROP 14005b261ecSmrg#undef BITSMUL 14105b261ecSmrg#undef BITSUNIT 14205b261ecSmrg#undef BITS 14305b261ecSmrg 14405b261ecSmrg#undef BRESSOLID 14505b261ecSmrg#undef BRESDASH 14605b261ecSmrg#undef DOTS 14705b261ecSmrg#undef ARC 14805b261ecSmrg#undef POLYLINE 14905b261ecSmrg#undef POLYSEGMENT 15005b261ecSmrg#endif /* FB_24BIT */ 15105b261ecSmrg 15205b261ecSmrg#define BRESSOLID fbBresSolid32 15305b261ecSmrg#define BRESDASH fbBresDash32 15405b261ecSmrg#define DOTS fbDots32 15505b261ecSmrg#define ARC fbArc32 15605b261ecSmrg#define GLYPH fbGlyph32 15705b261ecSmrg#define POLYLINE fbPolyline32 15805b261ecSmrg#define POLYSEGMENT fbPolySegment32 15905b261ecSmrg#define BITS CARD32 16005b261ecSmrg#if FB_SHIFT == 6 16105b261ecSmrg#define BITS2 FbBits 16205b261ecSmrg#endif 16305b261ecSmrg 16405b261ecSmrg#include "fbbits.h" 16505b261ecSmrg 16605b261ecSmrg#undef BRESSOLID 16705b261ecSmrg#undef BRESDASH 16805b261ecSmrg#undef DOTS 16905b261ecSmrg#undef ARC 17005b261ecSmrg#undef GLYPH 17105b261ecSmrg#undef POLYLINE 17205b261ecSmrg#undef POLYSEGMENT 17305b261ecSmrg#undef BITS 17405b261ecSmrg#if FB_SHIFT == 6 17505b261ecSmrg#undef BITS2 17605b261ecSmrg#endif 177