Merge branch 'master' into gallium-0.2
[mesa.git] / src / mesa / swrast / s_lines.c
index 781146e67f93ff4d00be86e38891781f186f4910..23cb9b57eff77489f833680e6eb13416c53b97b7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.3
+ * Version:  7.1
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  */
 
 
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
 #include "s_aaline.h"
 #include "s_context.h"
 #include "s_depth.h"
@@ -63,12 +63,13 @@ compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] )
 static void
 draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
 {
-   GLint width, start;
+   const GLint width = (GLint) CLAMP(ctx->Line.Width,
+                                     ctx->Const.MinLineWidth,
+                                     ctx->Const.MaxLineWidth);
+   GLint start;
 
    ASSERT(span->end < MAX_WIDTH);
 
-   width = (GLint) CLAMP( ctx->Line._Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
-
    if (width & 1)
       start = width / 2;
    else
@@ -143,7 +144,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);    \
    }                                                           \
-   if (ctx->Line._Width > 1.0) {                               \
+   if (ctx->Line.Width > 1.0) {                                        \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -161,7 +162,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);   \
    }                                                           \
-   if (ctx->Line._Width > 1.0) {                               \
+   if (ctx->Line.Width > 1.0) {                                        \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -180,7 +181,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);   \
    }                                                           \
-   if (ctx->Line._Width > 1.0) {                               \
+   if (ctx->Line.Width > 1.0) {                                        \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -274,16 +275,21 @@ _swrast_choose_line( GLcontext *ctx )
          USE(general_line);
       }
       else if (ctx->Depth.Test
-               || ctx->Line._Width != 1.0
+               || ctx->Line.Width != 1.0
                || ctx->Line.StippleFlag) {
          /* no texture, but Z, fog, width>1, stipple, etc. */
          if (rgbmode)
+#if CHAN_BITS == 32
+            USE(general_line);
+#else
             USE(rgba_line);
+#endif
          else
             USE(ci_line);
       }
       else {
          ASSERT(!ctx->Depth.Test);
+         ASSERT(ctx->Line.Width == 1.0);
          /* simple lines */
          if (rgbmode)
             USE(simple_no_z_rgba_line);