Import include directory from Mesa3D vendor drop (this time into the right directory)
[reactos.git] / reactos / lib / mesa32 / include / GL / xmesa_xf86.h
1
2 /**************************************************************************
3
4 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
5 All Rights Reserved.
6
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sub license, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
14
15 The above copyright notice and this permission notice (including the
16 next paragraph) shall be included in all copies or substantial portions
17 of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27 **************************************************************************/
28
29 /*
30 * Authors:
31 * Kevin E. Martin <kevin@precisioninsight.com>
32 *
33 * When we're building the XMesa driver for use in the X server (as the
34 * indirect render) we include this file when building the xm_*.c files.
35 * We need to define some types and macros differently when building
36 * in the Xserver vs. stand-alone Mesa.
37 */
38
39 #ifndef _XMESA_XF86_H_
40 #define _XMESA_XF86_H_
41
42 #include "scrnintstr.h"
43 #include "pixmapstr.h"
44
45 typedef struct _XMesaImageRec XMesaImage;
46
47 typedef ScreenRec XMesaDisplay;
48 typedef PixmapPtr XMesaPixmap;
49 typedef ColormapPtr XMesaColormap;
50 typedef DrawablePtr XMesaDrawable;
51 typedef WindowPtr XMesaWindow;
52 typedef GCPtr XMesaGC;
53 typedef VisualPtr XMesaVisualInfo;
54 typedef DDXPointRec XMesaPoint;
55 typedef xColorItem XMesaColor;
56
57 #define XMesaSetGeneric(__d,__gc,__val,__mask) \
58 do { \
59 CARD32 __v[1]; \
60 (void) __d; \
61 __v[0] = __val; \
62 dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
63 } while (0)
64
65 #define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
66 do { \
67 ChangeGCVal __v[1]; \
68 (void) __d; \
69 __v[0].ptr = __pval; \
70 dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
71 } while (0)
72
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
79 #define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile)
80
81 #define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
82 do { \
83 XMesaPoint __p[1]; \
84 (void) __d; \
85 __p[0].x = __x; \
86 __p[0].y = __y; \
87 ValidateGC(__b, __gc); \
88 (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
89 } while (0)
90
91 #define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
92 do { \
93 (void) __d; \
94 ValidateGC(__b, __gc); \
95 (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
96 } while (0)
97
98 #define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
99 do { \
100 xRectangle __r[1]; \
101 (void) __d; \
102 ValidateGC((DrawablePtr)__b, __gc); \
103 __r[0].x = __x; \
104 __r[0].y = __y; \
105 __r[0].width = __w; \
106 __r[0].height = __h; \
107 (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
108 } while (0)
109
110 #define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
111 do { \
112 /* Assumes: Images are always in ZPixmap format */ \
113 (void) __d; \
114 if (__sx || __sy) /* The non-trivial case */ \
115 XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \
116 ValidateGC(__b, __gc); \
117 (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
118 __x, __y, __w, __h, 0, ZPixmap, \
119 ((XMesaImage *)(__i))->data); \
120 } while (0)
121
122 #define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
123 do { \
124 (void) __d; \
125 ValidateGC(__db, __gc); \
126 (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
127 __sx, __sy, __w, __h, __x, __y); \
128 } while (0)
129
130
131 /* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
132 #define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
133 (*__d->CreatePixmap)(__d, __w, __h, __depth)
134
135 #define XMesaFreePixmap(__d,__b) \
136 (*__d->DestroyPixmap)(__b)
137
138 #define XMesaFreeGC(__d,__gc) \
139 do { \
140 (void) __d; \
141 FreeScratchGC(__gc); \
142 } while (0)
143
144 #define GET_COLORMAP_SIZE(__v) __v->ColormapEntries
145 #define GET_REDMASK(__v) __v->mesa_visual.redMask
146 #define GET_GREENMASK(__v) __v->mesa_visual.greenMask
147 #define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
148 #define GET_VISUAL_DEPTH(__v) __v->nplanes
149 #define GET_BLACK_PIXEL(__v) __v->display->blackPixel
150 #define CHECK_BYTE_ORDER(__v) GL_TRUE
151 #define CHECK_FOR_HPCR(__v) GL_FALSE
152
153 #endif