2 /**************************************************************************
4 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
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:
15 The above copyright notice and this permission notice (including the
16 next paragraph) shall be included in all copies or substantial portions
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.
27 **************************************************************************/
31 * Kevin E. Martin <kevin@precisioninsight.com>
35 #ifndef _XMESA_XF86_H_
36 #define _XMESA_XF86_H_
38 #include "scrnintstr.h"
39 #include "pixmapstr.h"
41 typedef struct _XMesaImageRec XMesaImage
;
43 typedef ScreenRec XMesaDisplay
;
44 typedef PixmapPtr XMesaPixmap
;
45 typedef ColormapPtr XMesaColormap
;
46 typedef DrawablePtr XMesaDrawable
;
47 typedef WindowPtr XMesaWindow
;
48 typedef GCPtr XMesaGC
;
49 typedef VisualPtr XMesaVisualInfo
;
50 typedef DDXPointRec XMesaPoint
;
51 typedef xColorItem XMesaColor
;
53 #define XMesaSetGeneric(__d,__gc,__val,__mask) \
58 dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
61 #define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
65 __v[0].ptr = __pval; \
66 dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
69 #define XMesaSetDashes(__d,__gc,__do,__dl,__n) \
72 SetDashes(__gc, __do, __n, (unsigned char *)__dl); \
75 #define XMesaSetLineAttributes(__d,__gc,__lw,__ls,__cs,__js) \
83 dixChangeGC(NullClient, __gc, \
84 GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, \
88 #define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
89 #define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
90 #define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask)
91 #define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction)
92 #define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle)
94 #define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile)
95 #define XMesaSetStipple(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCStipple)
97 #define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
103 ValidateGC(__b, __gc); \
104 (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
107 #define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
110 ValidateGC(__b, __gc); \
111 (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
114 #define XMesaDrawLine(__d,__b,__gc,__x0,__y0,__x1,__y1) \
118 ValidateGC(__b, __gc); \
123 (*__gc->ops->Polylines)(__b, __gc, CoordModeOrigin, 2, __p); \
126 #define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
130 ValidateGC((DrawablePtr)__b, __gc); \
133 __r[0].width = __w; \
134 __r[0].height = __h; \
135 (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
138 #define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
140 /* Assumes: Images are always in ZPixmap format */ \
142 if (__sx || __sy) /* The non-trivial case */ \
143 XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \
144 ValidateGC(__b, __gc); \
145 (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
146 __x, __y, __w, __h, 0, ZPixmap, \
147 ((XMesaImage *)(__i))->data); \
150 #define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
153 ValidateGC(__db, __gc); \
154 (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
155 __sx, __sy, __w, __h, __x, __y); \
158 #define XMesaFillPolygon(__d,__b,__gc,__p,__n,__s,__m) \
161 ValidateGC(__b, __gc); \
162 (*__gc->ops->FillPolygon)(__b, __gc, __s, __m, __n, __p); \
165 /* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
166 #define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
167 (*__d->CreatePixmap)(__d, __w, __h, __depth)
168 #define XMesaFreePixmap(__d,__b) \
169 (*__d->DestroyPixmap)(__b)
171 #define XMesaFreeGC(__d,__gc) \
174 FreeScratchGC(__gc); \
177 #define GET_COLORMAP_SIZE(__v) __v->ColormapEntries
178 #define GET_REDMASK(__v) __v->mesa_visual.redMask
179 #define GET_GREENMASK(__v) __v->mesa_visual.greenMask
180 #define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
181 #define GET_VISUAL_DEPTH(__v) __v->nplanes
182 #define GET_BLACK_PIXEL(__v) __v->display->blackPixel
183 #define CHECK_BYTE_ORDER(__v) GL_TRUE
184 #define CHECK_FOR_HPCR(__v) GL_FALSE