VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/mesa-7.2/GL/xmesa_xf86.h@ 68495

Last change on this file since 68495 was 64269, checked in by vboxsync, 8 years ago

bugref:3810: X11 Guest Additions maintenance: remove unnecessary parts of the Mesa 7.2 sources from the tree, leaving only public OpenGL header files. The reason we are not just switching to using the Mesa 11 headers is that they currently conflict with our API definitions in APIspec.txt including due to increased const-correctness.

File size: 6.2 KB
Line 
1
2/**************************************************************************
3
4Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
5All Rights Reserved.
6
7Permission is hereby granted, free of charge, to any person obtaining a
8copy of this software and associated documentation files (the
9"Software"), to deal in the Software without restriction, including
10without limitation the rights to use, copy, modify, merge, publish,
11distribute, sub license, and/or sell copies of the Software, and to
12permit persons to whom the Software is furnished to do so, subject to
13the following conditions:
14
15The above copyright notice and this permission notice (including the
16next paragraph) shall be included in all copies or substantial portions
17of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27**************************************************************************/
28
29/*
30 * Authors:
31 * Kevin E. Martin <[email protected]>
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 "GL/glxtokens.h"
43#include "scrnintstr.h"
44#include "pixmapstr.h"
45#include "gcstruct.h"
46#include "servermd.h"
47
48
49typedef struct _XMesaImageRec {
50 int width, height;
51 char *data;
52 int bytes_per_line; /* Padded to 32 bits */
53 int bits_per_pixel;
54} XMesaImage;
55
56typedef ScreenRec XMesaDisplay;
57typedef PixmapPtr XMesaPixmap;
58typedef ColormapPtr XMesaColormap;
59typedef DrawablePtr XMesaDrawable;
60typedef WindowPtr XMesaWindow;
61typedef GCPtr XMesaGC;
62typedef VisualPtr XMesaVisualInfo;
63typedef DDXPointRec XMesaPoint;
64typedef xColorItem XMesaColor;
65
66#define XMesaSetGeneric(__d,__gc,__val,__mask) \
67do { \
68 CARD32 __v[1]; \
69 (void) __d; \
70 __v[0] = __val; \
71 dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
72} while (0)
73
74#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
75do { \
76 ChangeGCVal __v[1]; \
77 (void) __d; \
78 __v[0].ptr = __pval; \
79 dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
80} while (0)
81
82#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
83#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
84#define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask)
85#define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction)
86#define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle)
87
88#define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile)
89
90#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
91do { \
92 XMesaPoint __p[1]; \
93 (void) __d; \
94 __p[0].x = __x; \
95 __p[0].y = __y; \
96 ValidateGC(__b, __gc); \
97 (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
98} while (0)
99
100#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
101do { \
102 (void) __d; \
103 ValidateGC(__b, __gc); \
104 (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
105} while (0)
106
107#define XMesaDrawLine(__d, __b, __gc, __x0, __y0, __x1, __y1) \
108do { \
109 XMesaPoint __p[2]; \
110 (void) __d; \
111 __p[0].x = __x0; \
112 __p[0].y = __y0; \
113 __p[1].x = __x1; \
114 __p[1].y = __y1; \
115 ValidateGC(__b, __gc); \
116 (*gc->ops->PolyLines)(__b, __gc, CoordModeOrigin, 2, __p); \
117} while (0)
118
119#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
120do { \
121 xRectangle __r[1]; \
122 (void) __d; \
123 ValidateGC((DrawablePtr)__b, __gc); \
124 __r[0].x = __x; \
125 __r[0].y = __y; \
126 __r[0].width = __w; \
127 __r[0].height = __h; \
128 (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
129} while (0)
130
131static _X_INLINE XMesaImage *XMesaGetImage(XMesaDisplay *dpy, PixmapPtr p, int x,
132 int y, unsigned int width,
133 unsigned int height,
134 unsigned long plane_mask, int format)
135{
136 XMesaImage *img = Xcalloc(sizeof(*img));
137
138 img->width = p->drawable.width;
139 img->height = p->drawable.height;
140 img->bits_per_pixel = p->drawable.bitsPerPixel;
141 img->bytes_per_line = PixmapBytePad(width, p->drawable.depth);
142 img->data = malloc(height * img->bytes_per_line);
143
144 /* Assumes: Images are always in ZPixmap format */
145 (*p->drawable.pScreen->GetImage)(&p->drawable, x, y, width, height,
146 plane_mask, ZPixmap, img->data);
147
148 return img;
149}
150
151#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
152do { \
153 /* Assumes: Images are always in ZPixmap format */ \
154 (void) __d; \
155 ASSERT(!__sx && !__sy); /* The SubImage case */ \
156 ValidateGC(__b, __gc); \
157 (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
158 __x, __y, __w, __h, 0, ZPixmap, \
159 ((XMesaImage *)(__i))->data); \
160} while (0)
161
162#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
163do { \
164 (void) __d; \
165 ValidateGC(__db, __gc); \
166 (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
167 __sx, __sy, __w, __h, __x, __y); \
168} while (0)
169
170
171/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
172#ifdef CREATE_PIXMAP_USAGE_SCRATCH
173#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
174 (*__d->CreatePixmap)(__d, __w, __h, __depth, 0)
175#else
176#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
177 (*__d->CreatePixmap)(__d, __w, __h, __depth)
178#endif
179
180#define XMesaFreePixmap(__d,__b) \
181 (*__d->DestroyPixmap)(__b)
182
183#define XMesaFreeGC(__d,__gc) \
184do { \
185 (void) __d; \
186 FreeScratchGC(__gc); \
187} while (0)
188
189#define GET_COLORMAP_SIZE(__v) __v->ColormapEntries
190#define GET_REDMASK(__v) __v->mesa_visual.redMask
191#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
192#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
193#define GET_VISUAL_DEPTH(__v) __v->nplanes
194#define GET_BLACK_PIXEL(__v) __v->display->blackPixel
195#define CHECK_BYTE_ORDER(__v) GL_TRUE
196#define CHECK_FOR_HPCR(__v) GL_FALSE
197
198#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette