Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xmesa_xf86.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /**************************************************************************
  2. Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
  3. All Rights Reserved.
  4. Permission is hereby granted, free of charge, to any person obtaining a
  5. copy of this software and associated documentation files (the
  6. "Software"), to deal in the Software without restriction, including
  7. without limitation the rights to use, copy, modify, merge, publish,
  8. distribute, sub license, and/or sell copies of the Software, and to
  9. permit persons to whom the Software is furnished to do so, subject to
  10. the following conditions:
  11. The above copyright notice and this permission notice (including the
  12. next paragraph) shall be included in all copies or substantial portions
  13. of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  17. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
  18. ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  19. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  20. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. **************************************************************************/
  22. /*
  23. * Authors:
  24. * Kevin E. Martin <kevin@precisioninsight.com>
  25. *
  26. * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.5 2000/04/05 22:09:10 brianp Exp $
  27. */
  28. #ifndef _XMESA_XF86_H_
  29. #define _XMESA_XF86_H_
  30. #include "scrnintstr.h"
  31. #include "pixmapstr.h"
  32. typedef struct _XMesaImageRec XMesaImage;
  33. typedef ScreenRec XMesaDisplay;
  34. typedef PixmapPtr XMesaPixmap;
  35. typedef ColormapPtr XMesaColormap;
  36. typedef DrawablePtr XMesaDrawable;
  37. typedef WindowPtr XMesaWindow;
  38. typedef GCPtr XMesaGC;
  39. typedef VisualPtr XMesaVisualInfo;
  40. typedef DDXPointRec XMesaPoint;
  41. typedef xColorItem XMesaColor;
  42. #define XMesaSetGeneric(__d,__gc,__val,__mask) \
  43. do { \
  44. CARD32 __v[1]; \
  45. (void) __d; \
  46. __v[0] = __val; \
  47. dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
  48. } while (0)
  49. #define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
  50. do { \
  51. ChangeGCVal __v[1]; \
  52. (void) __d; \
  53. __v[0].ptr = __pval; \
  54. dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
  55. } while (0)
  56. #define XMesaSetDashes(__d,__gc,__do,__dl,__n) \
  57. do { \
  58. (void) __d; \
  59. SetDashes(__gc, __do, __n, (unsigned char *)__dl); \
  60. } while (0)
  61. #define XMesaSetLineAttributes(__d,__gc,__lw,__ls,__cs,__js) \
  62. do { \
  63. CARD32 __v[4]; \
  64. (void) __d; \
  65. __v[0] = __lw; \
  66. __v[1] = __ls; \
  67. __v[2] = __cs; \
  68. __v[3] = __js; \
  69. dixChangeGC(NullClient, __gc, \
  70. GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, \
  71. __v, NULL); \
  72. } while (0)
  73. #define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
  74. #define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
  75. #define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask)
  76. #define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction)
  77. #define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle)
  78. #define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile)
  79. #define XMesaSetStipple(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCStipple)
  80. #define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
  81. do { \
  82. XMesaPoint __p[1]; \
  83. (void) __d; \
  84. __p[0].x = __x; \
  85. __p[0].y = __y; \
  86. ValidateGC(__b, __gc); \
  87. (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
  88. } while (0)
  89. #define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
  90. do { \
  91. (void) __d; \
  92. ValidateGC(__b, __gc); \
  93. (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
  94. } while (0)
  95. #define XMesaDrawLine(__d,__b,__gc,__x0,__y0,__x1,__y1) \
  96. do { \
  97. XMesaPoint __p[2]; \
  98. (void) __d; \
  99. ValidateGC(__b, __gc); \
  100. __p[0].x = __x0; \
  101. __p[0].y = __y0; \
  102. __p[1].x = __x1; \
  103. __p[1].y = __y1; \
  104. (*__gc->ops->Polylines)(__b, __gc, CoordModeOrigin, 2, __p); \
  105. } while (0)
  106. #define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
  107. do { \
  108. xRectangle __r[1]; \
  109. (void) __d; \
  110. ValidateGC((DrawablePtr)__b, __gc); \
  111. __r[0].x = __x; \
  112. __r[0].y = __y; \
  113. __r[0].width = __w; \
  114. __r[0].height = __h; \
  115. (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
  116. } while (0)
  117. #define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
  118. do { \
  119. /* Assumes: Images are always in ZPixmap format */ \
  120. (void) __d; \
  121. if (__sx || __sy) /* The non-trivial case */ \
  122. XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \
  123. ValidateGC(__b, __gc); \
  124. (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
  125. __x, __y, __w, __h, 0, ZPixmap, \
  126. ((XMesaImage *)(__i))->data); \
  127. } while (0)
  128. #define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
  129. do { \
  130. (void) __d; \
  131. ValidateGC(__db, __gc); \
  132. (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
  133. __sx, __sy, __w, __h, __x, __y); \
  134. } while (0)
  135. #define XMesaFillPolygon(__d,__b,__gc,__p,__n,__s,__m) \
  136. do { \
  137. (void) __d; \
  138. ValidateGC(__b, __gc); \
  139. (*__gc->ops->FillPolygon)(__b, __gc, __s, __m, __n, __p); \
  140. } while (0)
  141. /* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
  142. #define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
  143. (*__d->CreatePixmap)(__d, __w, __h, __depth)
  144. #define XMesaFreePixmap(__d,__b) \
  145. (*__d->DestroyPixmap)(__b)
  146. #define XMesaFreeGC(__d,__gc) \
  147. do { \
  148. (void) __d; \
  149. FreeScratchGC(__gc); \
  150. } while (0)
  151. #define GET_COLORMAP_SIZE(__v) __v->visinfo->ColormapEntries
  152. #define GET_REDMASK(__v) __v->visinfo->redMask
  153. #define GET_GREENMASK(__v) __v->visinfo->greenMask
  154. #define GET_BLUEMASK(__v) __v->visinfo->blueMask
  155. #define GET_VISUAL_CLASS(__v) __v->visinfo->class
  156. #define GET_VISUAL_DEPTH(__v) __v->visinfo->nplanes
  157. #define GET_BLACK_PIXEL(__v) __v->display->blackPixel
  158. #define CHECK_BYTE_ORDER(__v) GL_TRUE
  159. #define CHECK_FOR_HPCR(__v) GL_FALSE
  160. #endif