Consolidate texObj->Pos/Neg/X/Y/Z and texObj->Image into a single
[mesa.git] / src / mesa / swrast / s_aaline.c
index deaae01f71122d8046546eb80b49a9e0998cc658..bbdc92b92a51fb85faea792cc1442b3e1d92f560 100644 (file)
@@ -1,8 +1,6 @@
-/* $Id: s_aaline.c,v 1.18 2003/02/27 23:37:53 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.0.1
+ * Version:  5.0.3
  *
  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
  *
 
 
 #include "glheader.h"
+#include "imports.h"
+#include "macros.h"
 #include "swrast/s_aaline.h"
 #include "swrast/s_context.h"
 #include "swrast/s_span.h"
 #include "swrast/swrast.h"
 #include "mtypes.h"
-#include "mmath.h"
 
 
 #define SUB_PIXEL 4
@@ -180,12 +179,16 @@ solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4])
 static INLINE GLchan
 solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4])
 {
-   GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2] + 0.5F;
-   if (z < 0.0F)
+   const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2];
+#if CHAN_TYPE == GL_FLOAT
+   return CLAMP(z, 0.0F, CHAN_MAXF);
+#else
+   if (z < 0)
       return 0;
-   else if (z > CHAN_MAXF)
-      return (GLchan) CHAN_MAXF;
-   return (GLchan) z;
+   else if (z > CHAN_MAX)
+      return CHAN_MAX;
+   return (GLchan) IROUND_POS(z);
+#endif
 }
 
 
@@ -514,8 +517,8 @@ _swrast_choose_aa_line_function(GLcontext *ctx)
 
    if (ctx->Visual.rgbMode) {
       /* RGBA */
-      if (ctx->Texture._EnabledUnits != 0) {
-         if (ctx->Texture._EnabledUnits > 1) {
+      if (ctx->Texture._EnabledCoordUnits != 0) {
+         if (ctx->Texture._EnabledCoordUnits > 1) {
             /* Multitextured! */
             if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR || 
                 ctx->Fog.ColorSumEnabled)