| 1 | /* |
| 2 | * Copyright © 1998 Keith Packard |
| 3 | * |
| 4 | * Permission to use, copy, modify, distribute, and sell this software and its |
| 5 | * documentation for any purpose is hereby granted without fee, provided that |
| 6 | * the above copyright notice appear in all copies and that both that |
| 7 | * copyright notice and this permission notice appear in supporting |
| 8 | * documentation, and that the name of Keith Packard not be used in |
| 9 | * advertising or publicity pertaining to distribution of the software without |
| 10 | * specific, written prior permission. Keith Packard makes no |
| 11 | * representations about the suitability of this software for any purpose. It |
| 12 | * is provided "as is" without express or implied warranty. |
| 13 | * |
| 14 | * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
| 16 | * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
| 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
| 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 20 | * PERFORMANCE OF THIS SOFTWARE. |
| 21 | */ |
| 22 | |
| 23 | #ifdef HAVE_DIX_CONFIG_H |
| 24 | #include <dix-config.h> |
| 25 | #endif |
| 26 | |
| 27 | #include "fb.h" |
| 28 | #include "miline.h" |
| 29 | #include "mizerarc.h" |
| 30 | |
| 31 | #undef BRESSOLID |
| 32 | #undef BRESDASH |
| 33 | #undef DOTS |
| 34 | #undef ARC |
| 35 | #undef GLYPH |
| 36 | #undef BITS |
| 37 | #undef BITS2 |
| 38 | #undef BITS4 |
| 39 | |
| 40 | #define BRESSOLID fbBresSolid8 |
| 41 | #define BRESDASH fbBresDash8 |
| 42 | #define DOTS fbDots8 |
| 43 | #define ARC fbArc8 |
| 44 | #define GLYPH fbGlyph8 |
| 45 | #define POLYLINE fbPolyline8 |
| 46 | #define POLYSEGMENT fbPolySegment8 |
| 47 | #define BITS BYTE |
| 48 | #define BITS2 CARD16 |
| 49 | #define BITS4 CARD32 |
| 50 | |
| 51 | #include "fbbits.h" |
| 52 | |
| 53 | #undef BRESSOLID |
| 54 | #undef BRESDASH |
| 55 | #undef DOTS |
| 56 | #undef ARC |
| 57 | #undef GLYPH |
| 58 | #undef POLYLINE |
| 59 | #undef POLYSEGMENT |
| 60 | #undef BITS |
| 61 | #undef BITS2 |
| 62 | #undef BITS4 |
| 63 | |
| 64 | #define BRESSOLID fbBresSolid16 |
| 65 | #define BRESDASH fbBresDash16 |
| 66 | #define DOTS fbDots16 |
| 67 | #define ARC fbArc16 |
| 68 | #define GLYPH fbGlyph16 |
| 69 | #define POLYLINE fbPolyline16 |
| 70 | #define POLYSEGMENT fbPolySegment16 |
| 71 | #define BITS CARD16 |
| 72 | #define BITS2 CARD32 |
| 73 | #if FB_SHIFT == 6 |
| 74 | #define BITS4 FbBits |
| 75 | #endif |
| 76 | |
| 77 | #include "fbbits.h" |
| 78 | |
| 79 | #undef BRESSOLID |
| 80 | #undef BRESDASH |
| 81 | #undef DOTS |
| 82 | #undef ARC |
| 83 | #undef GLYPH |
| 84 | #undef POLYLINE |
| 85 | #undef POLYSEGMENT |
| 86 | #undef BITS |
| 87 | #undef BITS2 |
| 88 | #if FB_SHIFT == 6 |
| 89 | #undef BITS4 |
| 90 | #endif |
| 91 | |
| 92 | #define BRESSOLID fbBresSolid24 |
| 93 | #define BRESDASH fbBresDash24 |
| 94 | #define DOTS fbDots24 |
| 95 | #define ARC fbArc24 |
| 96 | #define POLYLINE fbPolyline24 |
| 97 | #define POLYSEGMENT fbPolySegment24 |
| 98 | |
| 99 | #define BITS CARD32 |
| 100 | #define BITSUNIT BYTE |
| 101 | #define BITSMUL 3 |
| 102 | |
| 103 | #define FbDoTypeStore(b,t,x,s) WRITE(((t *) (b)), (x) >> (s)) |
| 104 | #define FbDoTypeRRop(b,t,a,x,s) WRITE((t *) (b), FbDoRRop(READ((t *) (b)),\ |
| 105 | (a) >> (s), \ |
| 106 | (x) >> (s))) |
| 107 | #define FbDoTypeMaskRRop(b,t,a,x,m,s) WRITE((t *) (b), FbDoMaskRRop(READ((t *) (b)),\ |
| 108 | (a) >> (s), \ |
| 109 | (x) >> (s), \ |
| 110 | (m) >> (s))) |
| 111 | #if BITMAP_BIT_ORDER == LSBFirst |
| 112 | #define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \ |
| 113 | (FbDoTypeStore (b, CARD8, x, 0), \ |
| 114 | FbDoTypeStore ((b) + 1, CARD16, x, 8)) : \ |
| 115 | (FbDoTypeStore (b, CARD16, x, 0), \ |
| 116 | FbDoTypeStore ((b) + 2, CARD8, x, 16))) |
| 117 | #define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \ |
| 118 | (FbDoTypeRRop(b,CARD8,a,x,0), \ |
| 119 | FbDoTypeRRop((b)+1,CARD16,a,x,8)) : \ |
| 120 | (FbDoTypeRRop(b,CARD16,a,x,0), \ |
| 121 | FbDoTypeRRop((b)+2,CARD8,a,x,16))) |
| 122 | #else |
| 123 | #define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \ |
| 124 | (FbDoTypeStore (b, CARD8, x, 16), \ |
| 125 | FbDoTypeStore ((b) + 1, CARD16, x, 0)) : \ |
| 126 | (FbDoTypeStore (b, CARD16, x, 8), \ |
| 127 | FbDoTypeStore ((b) + 2, CARD8, x, 0))) |
| 128 | #define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \ |
| 129 | (FbDoTypeRRop (b, CARD8, a, x, 16), \ |
| 130 | FbDoTypeRRop ((b) + 1, CARD16, a, x, 0)) : \ |
| 131 | (FbDoTypeRRop (b, CARD16, a, x, 8), \ |
| 132 | FbDoTypeRRop ((b) + 2, CARD8, a, x, 0))) |
| 133 | #endif |
| 134 | |
| 135 | #include "fbbits.h" |
| 136 | |
| 137 | #undef BITSSTORE |
| 138 | #undef BITSRROP |
| 139 | #undef BITSMUL |
| 140 | #undef BITSUNIT |
| 141 | #undef BITS |
| 142 | |
| 143 | #undef BRESSOLID |
| 144 | #undef BRESDASH |
| 145 | #undef DOTS |
| 146 | #undef ARC |
| 147 | #undef POLYLINE |
| 148 | #undef POLYSEGMENT |
| 149 | |
| 150 | #define BRESSOLID fbBresSolid32 |
| 151 | #define BRESDASH fbBresDash32 |
| 152 | #define DOTS fbDots32 |
| 153 | #define ARC fbArc32 |
| 154 | #define GLYPH fbGlyph32 |
| 155 | #define POLYLINE fbPolyline32 |
| 156 | #define POLYSEGMENT fbPolySegment32 |
| 157 | #define BITS CARD32 |
| 158 | #if FB_SHIFT == 6 |
| 159 | #define BITS2 FbBits |
| 160 | #endif |
| 161 | |
| 162 | #include "fbbits.h" |
| 163 | |
| 164 | #undef BRESSOLID |
| 165 | #undef BRESDASH |
| 166 | #undef DOTS |
| 167 | #undef ARC |
| 168 | #undef GLYPH |
| 169 | #undef POLYLINE |
| 170 | #undef POLYSEGMENT |
| 171 | #undef BITS |
| 172 | #if FB_SHIFT == 6 |
| 173 | #undef BITS2 |
| 174 | #endif |