Fix typo
[mesa.git] / src / mesa / swrast / s_lines.c
index eaf4e8a2faf47ea994ffeb091cc82a93cf1513fe..114ddeb320be0a7abde2ccc6d165cf0329b36542 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: s_lines.c,v 1.2 2000/11/05 18:24:40 keithw Exp $ */
+/* $Id: s_lines.c,v 1.12 2001/03/03 20:33:30 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
  * Version:  3.5
  * 
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2001  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"),
 
 
 #include "glheader.h"
+#include "colormac.h"
 #include "macros.h"
 #include "mmath.h"
-#include "vb.h"
-
+#include "s_aaline.h"
 #include "s_pb.h"
 #include "s_context.h"
 #include "s_depth.h"
  */
 
 
-/*
- * All line drawing functions have the same arguments:
- * v1, v2 - indexes of first and second endpoints into vertex buffer arrays
- */
-
-
-
-
-
-
-#if MAX_WIDTH > MAX_HEIGHT
-#  define MAXPOINTS MAX_WIDTH
-#else
-#  define MAXPOINTS MAX_HEIGHT
-#endif
-
 
 /* Flat, color index line */
 static void flat_ci_line( GLcontext *ctx,
-                          SWvertex *vert0,
-                         SWvertex *vert1 )
+                          const SWvertex *vert0,
+                         const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
 
@@ -83,15 +67,15 @@ static void flat_ci_line( GLcontext *ctx,
 
 #include "s_linetemp.h"
 
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Flat, color index line with Z interpolation/testing */
 static void flat_ci_z_line( GLcontext *ctx,
-                            SWvertex *vert0,
-                           SWvertex *vert1 )
+                            const SWvertex *vert0,
+                           const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    PB_SET_INDEX( PB, vert0->index );
@@ -102,17 +86,17 @@ static void flat_ci_z_line( GLcontext *ctx,
 
 #include "s_linetemp.h"
 
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Flat-shaded, RGBA line */
 static void flat_rgba_line( GLcontext *ctx,
-                            SWvertex *vert0,
-                           SWvertex *vert1 )
+                            const SWvertex *vert0,
+                           const SWvertex *vert1 )
 {
-   const GLchan *color = vert0->color;
+   const GLchan *color = vert1->color;
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
 
@@ -121,17 +105,17 @@ static void flat_rgba_line( GLcontext *ctx,
 
 #include "s_linetemp.h"
 
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Flat-shaded, RGBA line with Z interpolation/testing */
 static void flat_rgba_z_line( GLcontext *ctx,
-                              SWvertex *vert0,
-                             SWvertex *vert1 )
+                              const SWvertex *vert0,
+                             const SWvertex *vert1 )
 {
-   const GLchan *color = vert0->color;
+   const GLchan *color = vert1->color;
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
 
@@ -141,15 +125,15 @@ static void flat_rgba_z_line( GLcontext *ctx,
 
 #include "s_linetemp.h"
 
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Smooth shaded, color index line */
 static void smooth_ci_line( GLcontext *ctx,
-                            SWvertex *vert0,
-                           SWvertex *vert1 )
+                            const SWvertex *vert0,
+                           const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -171,15 +155,15 @@ static void smooth_ci_line( GLcontext *ctx,
 #include "s_linetemp.h"
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Smooth shaded, color index line with Z interpolation/testing */
 static void smooth_ci_z_line( GLcontext *ctx,
-                              SWvertex *vert0,
-                             SWvertex *vert1 )
+                              const SWvertex *vert0,
+                             const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -204,15 +188,15 @@ static void smooth_ci_z_line( GLcontext *ctx,
 #include "s_linetemp.h"
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Smooth-shaded, RGBA line */
 static void smooth_rgba_line( GLcontext *ctx,
-                                     SWvertex *vert0,
-                             SWvertex *vert1 )
+                                     const SWvertex *vert0,
+                             const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -238,15 +222,15 @@ static void smooth_rgba_line( GLcontext *ctx,
 #include "s_linetemp.h"
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Smooth-shaded, RGBA line with Z interpolation/testing */
 static void smooth_rgba_z_line( GLcontext *ctx,
-                                       SWvertex *vert0,
-                               SWvertex *vert1 )
+                                       const SWvertex *vert0,
+                               const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -264,10 +248,10 @@ static void smooth_rgba_z_line( GLcontext *ctx,
 #define INTERP_RGB 1
 #define INTERP_ALPHA 1
 
-#define PLOT(X,Y)                      \
-       pbx[count] = X;                 \
-       pby[count] = Y;                 \
-       pbz[count] = Z;                 \
+#define PLOT(X,Y)                              \
+       pbx[count] = X;                         \
+       pby[count] = Y;                         \
+       pbz[count] = Z;                         \
        pbfog[count] = fog0;                    \
        pbrgba[count][RCOMP] = FixedToInt(r0);  \
        pbrgba[count][GCOMP] = FixedToInt(g0);  \
@@ -278,23 +262,23 @@ static void smooth_rgba_z_line( GLcontext *ctx,
 #include "s_linetemp.h"
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
-#define CHECK_FULL(count)                      \
-       if (count >= PB_SIZE-MAX_WIDTH) {       \
-          PB->count = count;           \
-          gl_flush_pb(ctx);                    \
-          count = PB->count;           \
-       }
+#define CHECK_FULL(count)              \
+   if (count >= PB_SIZE-MAX_WIDTH) {   \
+      PB->count = count;               \
+      _mesa_flush_pb(ctx);                     \
+      count = PB->count;               \
+   }
 
 
 
 /* Smooth shaded, color index, any width, maybe stippled */
 static void general_smooth_ci_line( GLcontext *ctx,
-                                   SWvertex *vert0,
-                                   SWvertex *vert1 )
+                                   const SWvertex *vert0,
+                                   const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -317,7 +301,7 @@ static void general_smooth_ci_line( GLcontext *ctx,
        pbx[count] = X;         \
        pby[count] = Y;         \
        pbz[count] = Z;         \
-       pbfog[count] = fog0;                    \
+       pbfog[count] = fog0;    \
        pbi[count] = I;         \
        count++;                \
        CHECK_FULL(count);
@@ -330,21 +314,21 @@ static void general_smooth_ci_line( GLcontext *ctx,
 #define INTERP_XY 1
 #define INTERP_Z 1
 #define INTERP_INDEX 1
-#define XMAJOR_PLOT(X,Y)                       \
-       pbx[count] = X;  pbx[count+1] = X;      \
-       pby[count] = Y;  pby[count+1] = Y+1;    \
-       pbz[count] = Z;  pbz[count+1] = Z;      \
+#define XMAJOR_PLOT(X,Y)                               \
+       pbx[count] = X;  pbx[count+1] = X;              \
+       pby[count] = Y;  pby[count+1] = Y+1;            \
+       pbz[count] = Z;  pbz[count+1] = Z;              \
        pbfog[count] = fog0;  pbfog[count+1] = fog0;    \
-       pbi[count] = I;  pbi[count+1] = I;      \
-       count += 2;                             \
+       pbi[count] = I;  pbi[count+1] = I;              \
+       count += 2;                                     \
        CHECK_FULL(count);
-#define YMAJOR_PLOT(X,Y)                       \
-       pbx[count] = X;  pbx[count+1] = X+1;    \
-       pby[count] = Y;  pby[count+1] = Y;      \
-       pbz[count] = Z;  pbz[count+1] = Z;      \
+#define YMAJOR_PLOT(X,Y)                               \
+       pbx[count] = X;  pbx[count+1] = X+1;            \
+       pby[count] = Y;  pby[count+1] = Y;              \
+       pbz[count] = Z;  pbz[count+1] = Z;              \
        pbfog[count] = fog0;  pbfog[count+1] = fog0;    \
-       pbi[count] = I;  pbi[count+1] = I;      \
-       count += 2;                             \
+       pbi[count] = I;  pbi[count+1] = I;              \
+       count += 2;                                     \
        CHECK_FULL(count);
 #include "s_linetemp.h"
       }
@@ -367,14 +351,14 @@ static void general_smooth_ci_line( GLcontext *ctx,
    }
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 /* Flat shaded, color index, any width, maybe stippled */
 static void general_flat_ci_line( GLcontext *ctx,
-                                  SWvertex *vert0,
-                                 SWvertex *vert1 )
+                                  const SWvertex *vert0,
+                                 const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count;
@@ -395,7 +379,7 @@ static void general_flat_ci_line( GLcontext *ctx,
        pbx[count] = X;         \
        pby[count] = Y;         \
        pbz[count] = Z;         \
-       pbfog[count] = fog0;            \
+       pbfog[count] = fog0;    \
        count++;                \
        CHECK_FULL(count);
 #include "s_linetemp.h"
@@ -406,19 +390,19 @@ static void general_flat_ci_line( GLcontext *ctx,
          /* special case: unstippled and width=2 */
 #define INTERP_XY 1
 #define INTERP_Z 1
-#define XMAJOR_PLOT(X,Y)                       \
-       pbx[count] = X;  pbx[count+1] = X;      \
-       pby[count] = Y;  pby[count+1] = Y+1;    \
-       pbz[count] = Z;  pbz[count+1] = Z;      \
+#define XMAJOR_PLOT(X,Y)                               \
+       pbx[count] = X;  pbx[count+1] = X;              \
+       pby[count] = Y;  pby[count+1] = Y+1;            \
+       pbz[count] = Z;  pbz[count+1] = Z;              \
        pbfog[count] = fog0;  pbfog[count+1] = fog0;    \
-       count += 2;                             \
+       count += 2;                                     \
        CHECK_FULL(count);
-#define YMAJOR_PLOT(X,Y)                       \
-       pbx[count] = X;  pbx[count+1] = X+1;    \
-       pby[count] = Y;  pby[count+1] = Y;      \
-       pbz[count] = Z;  pbz[count+1] = Z;      \
+#define YMAJOR_PLOT(X,Y)                               \
+       pbx[count] = X;  pbx[count+1] = X+1;            \
+       pby[count] = Y;  pby[count+1] = Y;              \
+       pbz[count] = Z;  pbz[count+1] = Z;              \
        pbfog[count] = fog0;  pbfog[count+1] = fog0;    \
-       count += 2;                             \
+       count += 2;                                     \
        CHECK_FULL(count);
 #include "s_linetemp.h"
       }
@@ -431,7 +415,7 @@ static void general_flat_ci_line( GLcontext *ctx,
        pbx[count] = X;         \
        pby[count] = Y;         \
        pbz[count] = Z;         \
-       pbfog[count] = fog0;            \
+       pbfog[count] = fog0;    \
        count++;                \
        CHECK_FULL(count);
 #include "s_linetemp.h"
@@ -439,14 +423,14 @@ static void general_flat_ci_line( GLcontext *ctx,
    }
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 static void general_smooth_rgba_line( GLcontext *ctx,
-                                      SWvertex *vert0,
-                                     SWvertex *vert1 )
+                                      const SWvertex *vert0,
+                                     const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -470,7 +454,7 @@ static void general_smooth_rgba_line( GLcontext *ctx,
        pbx[count] = X;                         \
        pby[count] = Y;                         \
        pbz[count] = Z;                         \
-       pbfog[count] = fog0;            \
+       pbfog[count] = fog0;                    \
        pbrgba[count][RCOMP] = FixedToInt(r0);  \
        pbrgba[count][GCOMP] = FixedToInt(g0);  \
        pbrgba[count][BCOMP] = FixedToInt(b0);  \
@@ -530,7 +514,7 @@ static void general_smooth_rgba_line( GLcontext *ctx,
        pbx[count] = X;                         \
        pby[count] = Y;                         \
        pbz[count] = Z;                         \
-       pbfog[count] = fog0;    \
+       pbfog[count] = fog0;                    \
        pbrgba[count][RCOMP] = FixedToInt(r0);  \
        pbrgba[count][GCOMP] = FixedToInt(g0);  \
        pbrgba[count][BCOMP] = FixedToInt(b0);  \
@@ -542,16 +526,16 @@ static void general_smooth_rgba_line( GLcontext *ctx,
    }
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 static void general_flat_rgba_line( GLcontext *ctx,
-                                    SWvertex *vert0,
-                                   SWvertex *vert1 )
+                                    const SWvertex *vert0,
+                                   const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
-   const GLchan *color = vert0->color;
+   const GLchan *color = vert1->color;
    PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
 
    if (ctx->Line.StippleFlag) {
@@ -585,14 +569,14 @@ static void general_flat_rgba_line( GLcontext *ctx,
       }
    }
 
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 /* Flat-shaded, textured, any width, maybe stippled */
 static void flat_textured_line( GLcontext *ctx,
-                                SWvertex *vert0,
-                               SWvertex *vert1 )
+                                const SWvertex *vert0,
+                               const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count;
@@ -603,7 +587,7 @@ static void flat_textured_line( GLcontext *ctx,
    GLfloat *pbs = PB->s[0];
    GLfloat *pbt = PB->t[0];
    GLfloat *pbu = PB->u[0];
-   GLchan *color = vert0->color;
+   GLchan *color = (GLchan*) vert1->color;
    PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] );
    count = PB->count;
 
@@ -650,15 +634,15 @@ static void flat_textured_line( GLcontext *ctx,
    }
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
 
 /* Smooth-shaded, textured, any width, maybe stippled */
 static void smooth_textured_line( GLcontext *ctx,
-                                  SWvertex *vert0,
-                                 SWvertex *vert1 )
+                                  const SWvertex *vert0,
+                                 const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -687,7 +671,7 @@ static void smooth_textured_line( GLcontext *ctx,
           pbx[count] = X;                              \
           pby[count] = Y;                              \
           pbz[count] = Z;                              \
-          pbfog[count] = fog0;         \
+          pbfog[count] = fog0;                         \
           pbs[count] = fragTexcoord[0];                \
           pbt[count] = fragTexcoord[1];                \
           pbu[count] = fragTexcoord[2];                \
@@ -713,7 +697,7 @@ static void smooth_textured_line( GLcontext *ctx,
           pbx[count] = X;                              \
           pby[count] = Y;                              \
           pbz[count] = Z;                              \
-          pbfog[count] = fog0;         \
+          pbfog[count] = fog0;                         \
           pbs[count] = fragTexcoord[0];                \
           pbt[count] = fragTexcoord[1];                \
           pbu[count] = fragTexcoord[2];                \
@@ -728,7 +712,7 @@ static void smooth_textured_line( GLcontext *ctx,
    }
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
@@ -736,8 +720,8 @@ static void smooth_textured_line( GLcontext *ctx,
  * color interpolation.
  */
 static void smooth_multitextured_line( GLcontext *ctx,
-                                      SWvertex *vert0,
-                                      SWvertex *vert1 )
+                                      const SWvertex *vert0,
+                                      const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -766,7 +750,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
           pbx[count] = X;                                      \
           pby[count] = Y;                                      \
           pbz[count] = Z;                                      \
-          pbfog[count] = fog0;         \
+          pbfog[count] = fog0;                                 \
           pbrgba[count][RCOMP] = FixedToInt(r0);               \
           pbrgba[count][GCOMP] = FixedToInt(g0);               \
           pbrgba[count][BCOMP] = FixedToInt(b0);               \
@@ -775,7 +759,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
           pbspec[count][GCOMP] = FixedToInt(sg0);              \
           pbspec[count][BCOMP] = FixedToInt(sb0);              \
           for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {   \
-             if (ctx->Texture.Unit[u]._ReallyEnabled) {                \
+             if (ctx->Texture.Unit[u]._ReallyEnabled) {        \
                 PB->s[u][0] = fragTexcoord[u][0];              \
                 PB->s[u][1] = fragTexcoord[u][1];              \
                 PB->s[u][2] = fragTexcoord[u][2];              \
@@ -802,7 +786,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
           pbx[count] = X;                                      \
           pby[count] = Y;                                      \
           pbz[count] = Z;                                      \
-          pbfog[count] = fog0;         \
+          pbfog[count] = fog0;                                 \
           pbrgba[count][RCOMP] = FixedToInt(r0);               \
           pbrgba[count][GCOMP] = FixedToInt(g0);               \
           pbrgba[count][BCOMP] = FixedToInt(b0);               \
@@ -811,7 +795,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
           pbspec[count][GCOMP] = FixedToInt(sg0);              \
           pbspec[count][BCOMP] = FixedToInt(sb0);              \
           for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {   \
-             if (ctx->Texture.Unit[u]._ReallyEnabled) {                \
+             if (ctx->Texture.Unit[u]._ReallyEnabled) {        \
                 PB->s[u][0] = fragTexcoord[u][0];              \
                 PB->s[u][1] = fragTexcoord[u][1];              \
                 PB->s[u][2] = fragTexcoord[u][2];              \
@@ -825,7 +809,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
    }
 
    PB->count = count;
-   gl_flush_pb(ctx);
+   _mesa_flush_pb(ctx);
 }
 
 
@@ -833,8 +817,8 @@ static void smooth_multitextured_line( GLcontext *ctx,
  * color interpolation.
  */
 static void flat_multitextured_line( GLcontext *ctx,
-                                     SWvertex *vert0,
-                                    SWvertex *vert1 )
+                                     const SWvertex *vert0,
+                                    const SWvertex *vert1 )
 {
    struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
    GLint count = PB->count;
@@ -844,10 +828,10 @@ static void flat_multitextured_line( GLcontext *ctx,
    GLfixed *pbfog = PB->fog;
    GLchan (*pbrgba)[4] = PB->rgba;
    GLchan (*pbspec)[3] = PB->spec;
-   GLchan *color = vert0->color;
-   GLchan sRed   = vert0->specular[0];
-   GLchan sGreen = vert0->specular[1];
-   GLchan sBlue  = vert0->specular[2];
+   GLchan *color = (GLchan*) vert1->color;
+   GLchan sRed   = vert1->specular[0];
+   GLchan sGreen = vert1->specular[1];
+   GLchan sBlue  = vert1->specular[2];
 
    PB->mono = GL_FALSE;
 
@@ -865,7 +849,7 @@ static void flat_multitextured_line( GLcontext *ctx,
           pbx[count] = X;                                      \
           pby[count] = Y;                                      \
           pbz[count] = Z;                                      \
-          pbfog[count] = fog0;         \
+          pbfog[count] = fog0;                                 \
           pbrgba[count][RCOMP] = color[0];                     \
           pbrgba[count][GCOMP] = color[1];                     \
           pbrgba[count][BCOMP] = color[2];                     \
@@ -874,7 +858,7 @@ static void flat_multitextured_line( GLcontext *ctx,
           pbspec[count][GCOMP] = sGreen;                       \
           pbspec[count][BCOMP] = sBlue;                        \
           for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {   \
-             if (ctx->Texture.Unit[u]._ReallyEnabled) {                \
+             if (ctx->Texture.Unit[u]._ReallyEnabled) {        \
                 PB->s[u][0] = fragTexcoord[u][0];              \
                 PB->s[u][1] = fragTexcoord[u][1];              \
                 PB->s[u][2] = fragTexcoord[u][2];              \
@@ -899,7 +883,7 @@ static void flat_multitextured_line( GLcontext *ctx,
           pbx[count] = X;                                      \
           pby[count] = Y;                                      \
           pbz[count] = Z;                                      \
-          pbfog[count] = fog0;         \
+          pbfog[count] = fog0;                                 \
           pbrgba[count][RCOMP] = color[0];                     \
           pbrgba[count][GCOMP] = color[1];                     \
           pbrgba[count][BCOMP] = color[2];                     \
@@ -908,7 +892,7 @@ static void flat_multitextured_line( GLcontext *ctx,
           pbspec[count][GCOMP] = sGreen;                       \
           pbspec[count][BCOMP] = sBlue;                        \
           for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {   \
-             if (ctx->Texture.Unit[u]._ReallyEnabled) {                \
+             if (ctx->Texture.Unit[u]._ReallyEnabled) {        \
                 PB->s[u][0] = fragTexcoord[u][0];              \
                 PB->s[u][1] = fragTexcoord[u][1];              \
                 PB->s[u][2] = fragTexcoord[u][2];              \
@@ -922,97 +906,30 @@ static void flat_multitextured_line( GLcontext *ctx,
    }
 
    PB->count = count;
-   gl_flush_pb(ctx);
-}
-
-
-
-
-/*
- * Antialiased RGBA line
- *
- * This AA line function isn't terribly efficient but it's pretty
- * straight-forward to understand.  Also, it doesn't exactly conform
- * to the specification.
- */
-static void aa_rgba_line( GLcontext *ctx,
-                          SWvertex *vert0,
-                         SWvertex *vert1 )
-{
-#define INTERP_RGBA 1
-#define PLOT(x, y)                                             \
-   {                                                           \
-      PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, fog0,              \
-                          red, green, blue, coverage );        \
-   }
-#include "s_lnaatemp.h"
-}
-
-/*
- * Antialiased Textured RGBA line
- *
- * This AA line function isn't terribly efficient but it's pretty
- * straight-forward to understand.  Also, it doesn't exactly conform
- * to the specification.
- */
-static void aa_tex_rgba_line( GLcontext *ctx,
-                              SWvertex *vert0,
-                             SWvertex *vert1 )
-{
-#define INTERP_RGBA 1
-#define INTERP_TEX 1
-#define PLOT(x, y)                                                     \
-   {                                                                   \
-      PB_WRITE_TEX_PIXEL( pb, (x), (y), z, fog0,                        \
-                         red, green, blue, coverage,                   \
-                 fragTexcoord[0], fragTexcoord[1], fragTexcoord[2] );  \
-   }
-#include "s_lnaatemp.h"
+   _mesa_flush_pb(ctx);
 }
 
 
-/*
- * Antialiased Multitextured RGBA line
- *
- * This AA line function isn't terribly efficient but it's pretty
- * straight-forward to understand.  Also, it doesn't exactly conform
- * to the specification.
- */
-static void aa_multitex_rgba_line( GLcontext *ctx,
-                                   SWvertex *vert0,
-                                  SWvertex *vert1 )
+void _swrast_add_spec_terms_line( GLcontext *ctx, 
+                                 const SWvertex *v0,
+                                 const SWvertex *v1 )
 {
-#define INTERP_RGBA 1
-#define INTERP_SPEC 1
-#define INTERP_MULTITEX 1
-#define PLOT(x, y)                                                     \
-   {                                                                   \
-      PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, fog0,             \
-            red, green, blue, coverage, specRed, specGreen, specBlue,  \
-            fragTexcoord );                                            \
-   }
-#include "s_lnaatemp.h"
+   SWvertex *ncv0 = (SWvertex *)v0;
+   SWvertex *ncv1 = (SWvertex *)v1;
+   GLchan c[2][4];
+   COPY_CHAN4( c[0], ncv0->color );
+   COPY_CHAN4( c[1], ncv1->color );
+   ACC_3V( ncv0->color, ncv0->specular );
+   ACC_3V( ncv1->color, ncv1->specular );
+   SWRAST_CONTEXT(ctx)->SpecLine( ctx, ncv0, ncv1 );
+   COPY_CHAN4( ncv0->color, c[0] );
+   COPY_CHAN4( ncv1->color, c[1] );
 }
 
 
-/*
- * Antialiased CI line.  Same comments for RGBA antialiased lines apply.
- */
-static void aa_ci_line( GLcontext *ctx,
-                        SWvertex *vert0,
-                       SWvertex *vert1 )
-{
-#define INTERP_INDEX 1
-#define PLOT(x, y)                                             \
-   {                                                           \
-      PB_WRITE_CI_PIXEL( pb, (x), (y), z, fog0, index + coverage );    \
-   }
-#include "s_lnaatemp.h"
-}
-
-
-
 #ifdef DEBUG
+extern void
+_mesa_print_line_function(GLcontext *ctx);  /* silence compiler warning */
 void
 _mesa_print_line_function(GLcontext *ctx)
 {
@@ -1051,14 +968,6 @@ _mesa_print_line_function(GLcontext *ctx)
       printf("smooth_multitextured_line\n");
    else if (swrast->Line == flat_multitextured_line)
       printf("flat_multitextured_line\n");
-   else if (swrast->Line == aa_rgba_line)
-      printf("aa_rgba_line\n");
-   else if (swrast->Line == aa_tex_rgba_line)
-      printf("aa_tex_rgba_line\n");
-   else if (swrast->Line == aa_multitex_rgba_line)
-      printf("aa_multitex_rgba_line\n");
-   else if (swrast->Line == aa_ci_line)
-      printf("aa_ci_line\n");
    else
       printf("Driver func %p\n", swrast->Line);
 }
@@ -1077,34 +986,17 @@ void
 _swrast_choose_line( GLcontext *ctx )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
-   GLboolean rgbmode = ctx->Visual.RGBAflag;
-   /* TODO: antialiased lines */
+   const GLboolean rgbmode = ctx->Visual.rgbMode;
 
    if (ctx->RenderMode==GL_RENDER) {
       if (ctx->Line.SmoothFlag) {
          /* antialiased lines */
-         if (rgbmode) {
-            if (ctx->Texture._ReallyEnabled) {
-               if (ctx->Texture._MultiTextureEnabled
-                  || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
-                 || ctx->Fog.ColorSumEnabled)
-                  /* Multitextured! */
-                  swrast->Line = aa_multitex_rgba_line;
-               else
-                  swrast->Line = aa_tex_rgba_line;
-            } else {
-               swrast->Line = aa_rgba_line;
-            }
-         }
-         else {
-            swrast->Line = aa_ci_line;
-         }
+         _swrast_choose_aa_line_function(ctx);
+         ASSERT(swrast->Triangle);
       }
       else if (ctx->Texture._ReallyEnabled) {
-         if (ctx->Texture._MultiTextureEnabled
-             || ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR
-            || ctx->Fog.ColorSumEnabled) {
+         if (swrast->_MultiTextureEnabled ||
+            (ctx->_TriangleCaps & DD_SEPERATE_SPECULAR)) {
             /* multi-texture and/or separate specular color */
             if (ctx->Light.ShadeModel==GL_SMOOTH)
                swrast->Line = smooth_multitextured_line;
@@ -1120,8 +1012,7 @@ _swrast_choose_line( GLcontext *ctx )
             }
          }
       }
-      else if (ctx->Line.Width!=1.0 || ctx->Line.StippleFlag
-               || ctx->Line.SmoothFlag) {
+      else if (ctx->Line.Width!=1.0 || ctx->Line.StippleFlag) {
          if (ctx->Light.ShadeModel==GL_SMOOTH) {
             if (rgbmode)
                swrast->Line = general_smooth_rgba_line;
@@ -1169,14 +1060,12 @@ _swrast_choose_line( GLcontext *ctx )
       }
    }
    else if (ctx->RenderMode==GL_FEEDBACK) {
-      swrast->Line = gl_feedback_line;
+      swrast->Line = _mesa_feedback_line;
    }
    else {
       /* GL_SELECT mode */
-      swrast->Line = gl_select_line;
+      swrast->Line = _mesa_select_line;
    }
 
    /*_mesa_print_line_function(ctx);*/
 }
-
-