r300: fix some whitespace
[mesa.git] / src / mesa / drivers / x11 / xm_line.c
index c31054251599db1a0c9c0f4fff32e7f71c85416f..f643b6d3a763371ce973362e7e8d55b750784daf 100644 (file)
@@ -31,9 +31,9 @@
 
 
 #include "glxheader.h"
-#include "depth.h"
-#include "macros.h"
-#include "mtypes.h"
+#include "main/depth.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
 #include "xmesaP.h"
 
 /* Internal swrast includes:
@@ -121,7 +121,7 @@ void xmesa_choose_point( GLcontext *ctx )
 
 
 #define GET_XRB(XRB)  struct xmesa_renderbuffer *XRB = \
-   xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped)
+   xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped)
 
 
 /*
@@ -147,7 +147,7 @@ void xmesa_choose_point( GLcontext *ctx )
 #define SETUP_CODE                                             \
    GET_XRB(xrb);                                               \
    const GLubyte *color = vert1->color;                                \
-   GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
+   GLuint pixel = PACK_8A8B8G8R(color[0], color[1], color[2], color[3]);
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
@@ -164,7 +164,7 @@ void xmesa_choose_point( GLcontext *ctx )
 #define SETUP_CODE                                             \
    GET_XRB(xrb);                                               \
    const GLubyte *color = vert1->color;                                \
-   GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
+   GLuint pixel = PACK_8A8R8G8B(color[0], color[1], color[2], color[3]);
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
@@ -331,7 +331,7 @@ void xmesa_choose_point( GLcontext *ctx )
 #define SETUP_CODE                                             \
    GET_XRB(xrb);                                               \
    const GLubyte *color = vert1->color;                                \
-   GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
+   GLuint pixel = PACK_8A8B8G8R(color[0], color[1], color[2], color[3]);
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define PIXEL_TYPE GLuint
@@ -354,7 +354,7 @@ void xmesa_choose_point( GLcontext *ctx )
 #define SETUP_CODE                                             \
    GET_XRB(xrb);                                               \
    const GLubyte *color = vert1->color;                                \
-   GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
+   GLuint pixel = PACK_8A8R8G8B(color[0], color[1], color[2], color[3]);
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define PIXEL_TYPE GLuint
@@ -556,10 +556,10 @@ xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1)
                                               vert1->color[0], vert1->color[1],
                                               vert1->color[2], vert1->color[3],
                                               xmesa->pixelformat);
-   int x0 = (int) vert0->win[0];
-   int y0 = YFLIP(xrb, (GLint) vert0->win[1]);
-   int x1 = (int) vert1->win[0];
-   int y1 = YFLIP(xrb, (GLint) vert1->win[1]);
+   int x0 =            (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0];
+   int y0 = YFLIP(xrb, (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]);
+   int x1 =            (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0];
+   int y1 = YFLIP(xrb, (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]);
    XMesaSetForeground(dpy, gc, pixel);
    XMesaSetFunction(dpy, gc, GXxor);
    XSetLineAttributes(dpy, gc, (int) ctx->Line.Width,
@@ -581,16 +581,14 @@ static swrast_line_func
 get_line_func(GLcontext *ctx)
 {
 #if CHAN_BITS == 8
-   XMesaContext xmesa = XMESA_CONTEXT(ctx);
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
-   struct xmesa_renderbuffer *xrb;
-
-   if (CHAN_BITS != 8)
-      return NULL;
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);
+   XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
+   const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
+   const struct xmesa_renderbuffer *xrb;
 
-   if ((ctx->DrawBuffer->_ColorDrawBufferMask[0]
-        & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0)
+   if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) &&
+       (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT))
       return (swrast_line_func) NULL;
    if (ctx->RenderMode != GL_RENDER)      return (swrast_line_func) NULL;
    if (ctx->Line.SmoothFlag)              return (swrast_line_func) NULL;
@@ -598,8 +596,9 @@ get_line_func(GLcontext *ctx)
    if (ctx->Light.ShadeModel != GL_FLAT)  return (swrast_line_func) NULL;
    if (ctx->Line.StippleFlag)             return (swrast_line_func) NULL;
    if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
+   if (xmbuf->swAlpha)                    return (swrast_line_func) NULL;
 
-   xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped);
+   xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped);
 
    if (xrb->ximage
        && swrast->_RasterMask==DEPTH_BIT
@@ -662,8 +661,8 @@ get_line_func(GLcontext *ctx)
    }
 
 #ifndef XFree86Server
-   if (ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1
-       && ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT
+   if (ctx->DrawBuffer->_NumColorDrawBuffers == 1
+       && ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT
        && swrast->_RasterMask == LOGIC_OP_BIT
        && ctx->Color.LogicOp == GL_XOR
        && !ctx->Line.StippleFlag