summaryrefslogtreecommitdiffstats
path: root/include/GL/xmesa_xf86.h
blob: 2a30e1e082b6e6c0774db95aba44c0e09e9a77ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

/**************************************************************************

Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

**************************************************************************/

/*
 * Authors:
 *   Kevin E. Martin <kevin@precisioninsight.com>
 *
 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.2 2000/01/16 18:35:25 brianp Exp $
 */

#ifndef _XMESA_XF86_H_
#define _XMESA_XF86_H_

#include "scrnintstr.h"
#include "pixmapstr.h"

typedef struct _XMesaImageRec XMesaImage;

typedef ScreenRec   XMesaDisplay;
typedef PixmapPtr   XMesaPixmap;
typedef ColormapPtr XMesaColormap;
typedef DrawablePtr XMesaDrawable;
typedef WindowPtr   XMesaWindow;
typedef GCPtr       XMesaGC;
typedef VisualPtr   XMesaVisualInfo;
typedef DDXPointRec XMesaPoint;
typedef xColorItem  XMesaColor;

#define XMesaSetGeneric(__d,__gc,__val,__mask) \
{ \
    CARD32 __v[1]; \
    (void) __d; \
    __v[0] = __val; \
    dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
}

#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
{ \
    ChangeGCVal __v[1]; \
    (void) __d; \
    __v[0].ptr = __pval; \
    dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
}

#define XMesaSetDashes(__d,__gc,__do,__dl,__n) \
{ \
    (void) __d; \
    SetDashes(__gc, __do, __n, (unsigned char *)__dl); \
}

#define XMesaSetLineAttributes(__d,__gc,__lw,__ls,__cs,__js) \
{ \
    CARD32 __v[4]; \
    (void) __d; \
    __v[0] = __lw; \
    __v[1] = __ls; \
    __v[2] = __cs; \
    __v[3] = __js; \
    dixChangeGC(NullClient, __gc, \
		GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, \
		__v, NULL); \
}

#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
#define XMesaSetPlaneMask(d,gc,v)  XMesaSetGeneric(d,gc,v,GCPlaneMask)
#define XMesaSetFunction(d,gc,v)   XMesaSetGeneric(d,gc,v,GCFunction)
#define XMesaSetFillStyle(d,gc,v)  XMesaSetGeneric(d,gc,v,GCFillStyle)

#define XMesaSetTile(d,gc,v)       XMesaSetGenericPtr(d,gc,v,GCTile)
#define XMesaSetStipple(d,gc,v)    XMesaSetGenericPtr(d,gc,v,GCStipple)

#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
{ \
    XMesaPoint __p[1]; \
    (void) __d; \
    __p[0].x = __x; \
    __p[0].y = __y; \
    ValidateGC(__b, __gc); \
    (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
}

#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
{ \
    (void) __d; \
    ValidateGC(__b, __gc); \
    (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
}

#define XMesaDrawLine(__d,__b,__gc,__x0,__y0,__x1,__y1) \
{ \
    XMesaPoint __p[2]; \
    (void) __d; \
    ValidateGC(__b, __gc); \
    __p[0].x = __x0; \
    __p[0].y = __y0; \
    __p[1].x = __x1; \
    __p[1].y = __y1; \
    (*__gc->ops->Polylines)(__b, __gc, CoordModeOrigin, 2, __p); \
}

#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
{ \
    xRectangle __r[1]; \
    (void) __d; \
    ValidateGC(__b, __gc); \
    __r[0].x = __x; \
    __r[0].y = __y; \
    __r[0].width = __w; \
    __r[0].height = __h; \
    (*__gc->ops->PolyFillRect)(__b, __gc, 1, __r); \
}

#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
{ \
    /* Assumes: Images are always in ZPixmap format */ \
    (void) __d; \
    if (__sx || __sy) /* The non-trivial case */ \
	XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \
    ValidateGC(__b, __gc); \
    (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
			   __x, __y, __w, __h, 0, ZPixmap, \
			   ((XMesaImage *)(__i))->data); \
}

#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
{ \
    (void) __d; \
    ValidateGC(__db, __gc); \
    (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
			   __sx, __sy, __w, __h, __x, __y); \
}

#define XMesaFillPolygon(__d,__b,__gc,__p,__n,__s,__m) \
{ \
    (void) __d; \
    ValidateGC(__b, __gc); \
    (*__gc->ops->FillPolygon)(__b, __gc, __s, __m, __n, __p); \
}

/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
    (*__d->CreatePixmap)(__d, __w, __h, __depth)
#define XMesaFreePixmap(__d,__b) \
    (*__d->DestroyPixmap)(__b)

#define XMesaFreeGC(__d,__gc) \
{ \
    (void) __d; \
    FreeScratchGC(__gc); \
}

#define GET_COLORMAP_SIZE(__v)  __v->visinfo->ColormapEntries
#define GET_REDMASK(__v)        __v->visinfo->redMask
#define GET_GREENMASK(__v)      __v->visinfo->greenMask
#define GET_BLUEMASK(__v)       __v->visinfo->blueMask

/*XXX this was wrong.  However, using nplanes instead may fail when
 * we have overlay planes in the future!
 */
/*#define GET_BITS_PER_PIXEL(__v) __v->visinfo->bitsPerRGBValue*/
#define GET_BITS_PER_PIXEL(__v) __v->visinfo->nplanes

#define GET_VISUAL_CLASS(__v)   __v->visinfo->class
#define GET_VISUAL_DEPTH(__v)   __v->visinfo->nplanes
#define GET_BLACK_PIXEL(__v)    __v->display->blackPixel
#define CHECK_BYTE_ORDER(__v)   GL_TRUE
#define CHECK_FOR_HPCR(__v)     GL_FALSE

#endif