reverse some debug that slipped through
[mesa.git] / src / mesa / drivers / x11 / xm_line.c
index 1855fad99e3e727fe3ff909c31bcd5126a468116..ccb54a391cb9f10632d043d64ed059bc357f321b 100644 (file)
@@ -1,10 +1,8 @@
-/* $Id: xm_line.c,v 1.22 2003/02/17 16:35:57 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.3
  *
- * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2004  Brian Paul   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"),
@@ -35,7 +33,6 @@
 #include "glxheader.h"
 #include "depth.h"
 #include "macros.h"
-#include "mmath.h"
 #include "mtypes.h"
 #include "xmesaP.h"
 
@@ -59,7 +56,7 @@
 /* XXX don't use this, it doesn't dither correctly */
 static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert )
 {
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);
    XMesaDisplay *dpy = xmesa->xm_visual->display;
    XMesaDrawable buffer = xmesa->xm_buffer->buffer;
    XMesaGC gc = xmesa->xm_buffer->gc;
@@ -95,7 +92,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert )
 void xmesa_choose_point( GLcontext *ctx )
 {
 #if 0
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
 
    if (ctx->RenderMode == GL_RENDER
@@ -125,7 +122,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_TRUECOLOR_line
 #define SETUP_CODE                                     \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);            \
    const GLubyte *color = vert1->color;                        \
    XMesaImage *img = xmesa->xm_buffer->backimage;      \
    unsigned long pixel;                                        \
@@ -141,7 +138,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_8A8B8G8R_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
 #define PIXEL_TYPE GLuint
@@ -158,7 +155,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_8R8G8B_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
 #define PIXEL_TYPE GLuint
@@ -175,7 +172,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_8R8G8B24_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;
 #define PIXEL_TYPE bgr_t
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
@@ -195,7 +192,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_5R6G5B_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
 #define PIXEL_TYPE GLushort
@@ -212,7 +209,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_DITHER_5R6G5B_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;
 #define PIXEL_TYPE GLushort
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
@@ -229,7 +226,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_DITHER8_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLint r = color[0], g = color[1], b = color[2];             \
    DITHER_SETUP;
@@ -247,7 +244,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_LOOKUP8_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLubyte pixel;                                              \
    LOOKUP_SETUP;                                               \
@@ -266,7 +263,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_HPCR_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLint r = color[0], g = color[1], b = color[2];
 #define PIXEL_TYPE GLubyte
@@ -284,7 +281,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_TRUECOLOR_z_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    XMesaImage *img = xmesa->xm_buffer->backimage;              \
    unsigned long pixel;                                                \
@@ -306,7 +303,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_8A8B8G8R_z_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
 #define INTERP_Z 1
@@ -329,7 +326,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_8R8G8B_z_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
 #define INTERP_Z 1
@@ -352,7 +349,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_8R8G8B24_z_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -376,7 +373,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_5R6G5B_z_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
 #define INTERP_Z 1
@@ -399,7 +396,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_DITHER_5R6G5B_z_line
 #define SETUP_CODE                                     \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);            \
    const GLubyte *color = vert1->color;
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -421,7 +418,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_DITHER8_z_line
 #define SETUP_CODE                                     \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);            \
    const GLubyte *color = vert1->color;                        \
    GLint r = color[0], g = color[1], b = color[2];     \
    DITHER_SETUP;
@@ -445,7 +442,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_LOOKUP8_z_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLubyte pixel;                                              \
    LOOKUP_SETUP;                                               \
@@ -470,7 +467,7 @@ void xmesa_choose_point( GLcontext *ctx )
  */
 #define NAME flat_HPCR_z_line
 #define SETUP_CODE                                             \
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);                    \
    const GLubyte *color = vert1->color;                                \
    GLint r = color[0], g = color[1], b = color[2];
 #define INTERP_Z 1
@@ -490,13 +487,12 @@ void xmesa_choose_point( GLcontext *ctx )
 
 static swrast_line_func get_line_func( GLcontext *ctx )
 {
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
 
-   (void) DitherValues;  /* silence unused var warning */
-   (void) kernel1;  /* silence unused var warning */
-
+   if ((ctx->Color._DrawDestMask[0] & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
+      return (swrast_line_func) NULL;
    if (ctx->RenderMode != GL_RENDER)      return (swrast_line_func) NULL;
    if (ctx->Line.SmoothFlag)              return (swrast_line_func) NULL;
    if (ctx->Texture._EnabledUnits)        return (swrast_line_func) NULL;