fbbits.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. #ifdef HAVE_DIX_CONFIG_H
  23. #include <dix-config.h>
  24. #endif
  25. #include "fb.h"
  26. #include "miline.h"
  27. #include "mizerarc.h"
  28. #undef BRESSOLID
  29. #undef BRESDASH
  30. #undef DOTS
  31. #undef ARC
  32. #undef GLYPH
  33. #undef BITS
  34. #undef BITS2
  35. #undef BITS4
  36. #define BRESSOLID fbBresSolid8
  37. #define BRESDASH fbBresDash8
  38. #define DOTS fbDots8
  39. #define ARC fbArc8
  40. #define GLYPH fbGlyph8
  41. #define POLYLINE fbPolyline8
  42. #define POLYSEGMENT fbPolySegment8
  43. #define BITS BYTE
  44. #define BITS2 CARD16
  45. #define BITS4 CARD32
  46. #include "fbbits.h"
  47. #undef BRESSOLID
  48. #undef BRESDASH
  49. #undef DOTS
  50. #undef ARC
  51. #undef GLYPH
  52. #undef POLYLINE
  53. #undef POLYSEGMENT
  54. #undef BITS
  55. #undef BITS2
  56. #undef BITS4
  57. #define BRESSOLID fbBresSolid16
  58. #define BRESDASH fbBresDash16
  59. #define DOTS fbDots16
  60. #define ARC fbArc16
  61. #define GLYPH fbGlyph16
  62. #define POLYLINE fbPolyline16
  63. #define POLYSEGMENT fbPolySegment16
  64. #define BITS CARD16
  65. #define BITS2 CARD32
  66. #if FB_SHIFT == 6
  67. #define BITS4 FbBits
  68. #endif
  69. #include "fbbits.h"
  70. #undef BRESSOLID
  71. #undef BRESDASH
  72. #undef DOTS
  73. #undef ARC
  74. #undef GLYPH
  75. #undef POLYLINE
  76. #undef POLYSEGMENT
  77. #undef BITS
  78. #undef BITS2
  79. #if FB_SHIFT == 6
  80. #undef BITS4
  81. #endif
  82. #define BRESSOLID fbBresSolid24
  83. #define BRESDASH fbBresDash24
  84. #define DOTS fbDots24
  85. #define ARC fbArc24
  86. #define POLYLINE fbPolyline24
  87. #define POLYSEGMENT fbPolySegment24
  88. #define BITS CARD32
  89. #define BITSUNIT BYTE
  90. #define BITSMUL 3
  91. #define FbDoTypeStore(b,t,x,s) WRITE(((t *) (b)), (x) >> (s))
  92. #define FbDoTypeRRop(b,t,a,x,s) WRITE((t *) (b), FbDoRRop(READ((t *) (b)),\
  93. (a) >> (s), \
  94. (x) >> (s)))
  95. #define FbDoTypeMaskRRop(b,t,a,x,m,s) WRITE((t *) (b), FbDoMaskRRop(READ((t *) (b)),\
  96. (a) >> (s), \
  97. (x) >> (s), \
  98. (m) >> (s)))
  99. #if BITMAP_BIT_ORDER == LSBFirst
  100. #define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \
  101. (FbDoTypeStore (b, CARD8, x, 0), \
  102. FbDoTypeStore ((b) + 1, CARD16, x, 8)) : \
  103. (FbDoTypeStore (b, CARD16, x, 0), \
  104. FbDoTypeStore ((b) + 2, CARD8, x, 16)))
  105. #define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \
  106. (FbDoTypeRRop(b,CARD8,a,x,0), \
  107. FbDoTypeRRop((b)+1,CARD16,a,x,8)) : \
  108. (FbDoTypeRRop(b,CARD16,a,x,0), \
  109. FbDoTypeRRop((b)+2,CARD8,a,x,16)))
  110. #else
  111. #define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \
  112. (FbDoTypeStore (b, CARD8, x, 16), \
  113. FbDoTypeStore ((b) + 1, CARD16, x, 0)) : \
  114. (FbDoTypeStore (b, CARD16, x, 8), \
  115. FbDoTypeStore ((b) + 2, CARD8, x, 0)))
  116. #define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \
  117. (FbDoTypeRRop (b, CARD8, a, x, 16), \
  118. FbDoTypeRRop ((b) + 1, CARD16, a, x, 0)) : \
  119. (FbDoTypeRRop (b, CARD16, a, x, 8), \
  120. FbDoTypeRRop ((b) + 2, CARD8, a, x, 0)))
  121. #endif
  122. #include "fbbits.h"
  123. #undef BITSSTORE
  124. #undef BITSRROP
  125. #undef BITSMUL
  126. #undef BITSUNIT
  127. #undef BITS
  128. #undef BRESSOLID
  129. #undef BRESDASH
  130. #undef DOTS
  131. #undef ARC
  132. #undef POLYLINE
  133. #undef POLYSEGMENT
  134. #define BRESSOLID fbBresSolid32
  135. #define BRESDASH fbBresDash32
  136. #define DOTS fbDots32
  137. #define ARC fbArc32
  138. #define GLYPH fbGlyph32
  139. #define POLYLINE fbPolyline32
  140. #define POLYSEGMENT fbPolySegment32
  141. #define BITS CARD32
  142. #if FB_SHIFT == 6
  143. #define BITS2 FbBits
  144. #endif
  145. #include "fbbits.h"
  146. #undef BRESSOLID
  147. #undef BRESDASH
  148. #undef DOTS
  149. #undef ARC
  150. #undef GLYPH
  151. #undef POLYLINE
  152. #undef POLYSEGMENT
  153. #undef BITS
  154. #if FB_SHIFT == 6
  155. #undef BITS2
  156. #endif