+++ /dev/null
-
-/**************************************************************************
-
-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>
- *
- * When we're building the XMesa driver for stand-alone Mesa 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.
- */
-
-#ifndef _XMESA_X_H_
-#define _XMESA_X_H_
-
-
-#define XMesaDestroyImage XDestroyImage
-
-#define XMesaPutPixel XPutPixel
-#define XMesaGetPixel XGetPixel
-
-#define XMesaSetForeground XSetForeground
-#define XMesaSetBackground XSetBackground
-#define XMesaSetPlaneMask XSetPlaneMask
-#define XMesaSetFunction XSetFunction
-#define XMesaSetFillStyle XSetFillStyle
-#define XMesaSetTile XSetTile
-
-#define XMesaDrawPoint XDrawPoint
-#define XMesaDrawPoints XDrawPoints
-#define XMesaDrawLine XDrawLine
-#define XMesaFillRectangle XFillRectangle
-#define XMesaGetImage XGetImage
-#define XMesaPutImage XPutImage
-#define XMesaCopyArea XCopyArea
-
-#define XMesaCreatePixmap XCreatePixmap
-#define XMesaFreePixmap XFreePixmap
-#define XMesaFreeGC XFreeGC
-
-#define GET_COLORMAP_SIZE(__v) __v->visinfo->colormap_size
-#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->visinfo->depth
-#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen)
-#define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display)
-#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True)
-
-#endif
/* free the XImage */
_mesa_free( img->data );
img->data = NULL;
- XMesaDestroyImage( img );
+ XDestroyImage( img );
return bitsPerPixel;
}
}
}
+#define GET_REDMASK(__v) __v->mesa_visual.redMask
+#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
+#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
+
/**
* Choose the pixel format for the given visual.
static GLuint
choose_pixel_format(XMesaVisual v)
{
+ boolean native_byte_order = (host_byte_order() ==
+ ImageByteOrder(v->display));
+
if ( GET_REDMASK(v) == 0x0000ff
&& GET_GREENMASK(v) == 0x00ff00
&& GET_BLUEMASK(v) == 0xff0000
&& v->BitsPerPixel == 32) {
- if (CHECK_BYTE_ORDER(v)) {
+ if (native_byte_order) {
/* no byteswapping needed */
return 0 /* PIXEL_FORMAT_U_A8_B8_G8_R8 */;
}
&& GET_GREENMASK(v) == 0x00ff00
&& GET_BLUEMASK(v) == 0x0000ff
&& v->BitsPerPixel == 32) {
- if (CHECK_BYTE_ORDER(v)) {
+ if (native_byte_order) {
/* no byteswapping needed */
return PIPE_FORMAT_A8R8G8B8_UNORM;
}
else if ( GET_REDMASK(v) == 0xf800
&& GET_GREENMASK(v) == 0x07e0
&& GET_BLUEMASK(v) == 0x001f
- && CHECK_BYTE_ORDER(v)
+ && native_byte_order
&& v->BitsPerPixel == 16) {
/* 5-6-5 RGB */
return PIPE_FORMAT_R5G6B5_UNORM;
if (_mesa_getenv("MESA_INFO")) {
_mesa_printf("X/Mesa visual = %p\n", (void *) v);
_mesa_printf("X/Mesa level = %d\n", v->mesa_visual.level);
- _mesa_printf("X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v));
+ _mesa_printf("X/Mesa depth = %d\n", v->visinfo->depth);
_mesa_printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
}
/* X11 graphics context */
b->gc = XCreateGC( v->display, window, 0, NULL );
- XMesaSetFunction( v->display, b->gc, GXcopy );
+ XSetFunction( v->display, b->gc, GXcopy );
}
return GL_TRUE;
else {
/* this is an approximation */
int depth;
- depth = GET_VISUAL_DEPTH(v);
+ depth = v->visinfo->depth;
red_bits = depth / 3;
depth -= red_bits;
green_bits = depth / 2;
depth -= green_bits;
blue_bits = depth;
alpha_bits = 0;
- assert( red_bits + green_bits + blue_bits == GET_VISUAL_DEPTH(v) );
+ assert( red_bits + green_bits + blue_bits == v->visinfo->depth );
}
alpha_bits = v->mesa_visual.alphaBits;
}
/* Check that window depth matches visual depth */
XGetWindowAttributes( v->display, w, &attr );
depth = attr.depth;
- if (GET_VISUAL_DEPTH(v) != depth) {
+ if (v->visinfo->depth != depth) {
_mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual (%d) and window (%d)!\n",
- GET_VISUAL_DEPTH(v), depth);
+ v->visinfo->depth, depth);
return NULL;
}