mesa/include/GL/xmesa_xf86.h

154 lines
5.0 KiB
C
Raw Normal View History

1999-08-19 08:55:39 +08:00
/**************************************************************************
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>
*
2004-03-05 00:20:38 +08:00
* When we're building the XMesa driver for use in the X server (as the
* indirect render) we include this file when building the xm_*.c files.
* We need to define some types and macros differently when building
* in the Xserver vs. stand-alone Mesa.
1999-08-19 08:55:39 +08:00
*/
#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) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
CARD32 __v[1]; \
(void) __d; \
__v[0] = __val; \
dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
ChangeGCVal __v[1]; \
(void) __d; \
__v[0].ptr = __pval; \
dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
#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 XMesaDrawPoint(__d,__b,__gc,__x,__y) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
XMesaPoint __p[1]; \
(void) __d; \
__p[0].x = __x; \
__p[0].y = __y; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
(void) __d; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
xRectangle __r[1]; \
(void) __d; \
2000-04-06 06:09:10 +08:00
ValidateGC((DrawablePtr)__b, __gc); \
1999-08-19 08:55:39 +08:00
__r[0].x = __x; \
__r[0].y = __y; \
__r[0].width = __w; \
__r[0].height = __h; \
2000-04-06 06:09:10 +08:00
(*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
/* 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); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
(void) __d; \
ValidateGC(__db, __gc); \
(*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
__sx, __sy, __w, __h, __x, __y); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
(*__d->CreatePixmap)(__d, __w, __h, __depth)
2004-03-05 00:20:38 +08:00
1999-08-19 08:55:39 +08:00
#define XMesaFreePixmap(__d,__b) \
(*__d->DestroyPixmap)(__b)
#define XMesaFreeGC(__d,__gc) \
2000-01-18 07:22:57 +08:00
do { \
1999-08-19 08:55:39 +08:00
(void) __d; \
FreeScratchGC(__gc); \
2000-01-18 07:22:57 +08:00
} while (0)
1999-08-19 08:55:39 +08:00
#define GET_COLORMAP_SIZE(__v) __v->ColormapEntries
#define GET_REDMASK(__v) __v->mesa_visual.redMask
#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
#define GET_VISUAL_DEPTH(__v) __v->nplanes
1999-08-19 08:55:39 +08:00
#define GET_BLACK_PIXEL(__v) __v->display->blackPixel
#define CHECK_BYTE_ORDER(__v) GL_TRUE
#define CHECK_FOR_HPCR(__v) GL_FALSE
#endif