Mesa (gallium-xlib-rework): xlib: remove old xmesa_x. h file and all its defines

Keith Whitwell keithw at kemper.freedesktop.org
Thu Jan 8 15:35:42 UTC 2009


Module: Mesa
Branch: gallium-xlib-rework
Commit: 2b960128e8c87098ed3cfa29380b6ff524df3647
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b960128e8c87098ed3cfa29380b6ff524df3647

Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Thu Jan  8 15:33:32 2009 +0000

xlib: remove old xmesa_x.h file and all its defines

---

 src/gallium/state_trackers/xlib/old_xmesa.h   |    1 -
 src/gallium/state_trackers/xlib/old_xmesa_x.h |   76 -------------------------
 src/gallium/state_trackers/xlib/xm_api.c      |   27 ++++++---
 3 files changed, 17 insertions(+), 87 deletions(-)

diff --git a/src/gallium/state_trackers/xlib/old_xmesa.h b/src/gallium/state_trackers/xlib/old_xmesa.h
index 0d34378..a60ef96 100644
--- a/src/gallium/state_trackers/xlib/old_xmesa.h
+++ b/src/gallium/state_trackers/xlib/old_xmesa.h
@@ -74,7 +74,6 @@ extern "C" {
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#include "old_xmesa_x.h"
 #include "GL/gl.h"
 
 #ifdef AMIWIN
diff --git a/src/gallium/state_trackers/xlib/old_xmesa_x.h b/src/gallium/state_trackers/xlib/old_xmesa_x.h
deleted file mode 100644
index 75e5cec..0000000
--- a/src/gallium/state_trackers/xlib/old_xmesa_x.h
+++ /dev/null
@@ -1,76 +0,0 @@
-
-/**************************************************************************
-
-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 at 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
diff --git a/src/gallium/state_trackers/xlib/xm_api.c b/src/gallium/state_trackers/xlib/xm_api.c
index d00617c..b0dba32 100644
--- a/src/gallium/state_trackers/xlib/xm_api.c
+++ b/src/gallium/state_trackers/xlib/xm_api.c
@@ -161,7 +161,7 @@ bits_per_pixel( XMesaVisual xmv )
    /* free the XImage */
    _mesa_free( img->data );
    img->data = NULL;
-   XMesaDestroyImage( img );
+   XDestroyImage( img );
    return bitsPerPixel;
 }
 
@@ -236,6 +236,10 @@ xmesa_get_window_size(Display *dpy, XMesaBuffer b,
    }
 }
 
+#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.
@@ -245,11 +249,14 @@ xmesa_get_window_size(Display *dpy, XMesaBuffer b,
 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 */;
       }
@@ -261,7 +268,7 @@ choose_pixel_format(XMesaVisual v)
             && 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;
       }
@@ -272,7 +279,7 @@ choose_pixel_format(XMesaVisual v)
    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;
@@ -517,7 +524,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
    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);
    }
 
@@ -533,7 +540,7 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
 
       /* 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;
@@ -676,14 +683,14 @@ XMesaVisual XMesaCreateVisual( Display *display,
       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;
    }
@@ -839,9 +846,9 @@ XMesaCreateWindowBuffer(XMesaVisual v, Window w)
    /* 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;
    }
 




More information about the mesa-commit mailing list