blending fixes for CHAN_TYPE==GL_FLOAT (Gerk Huisma)
[mesa.git] / src / mesa / swrast / s_linetemp.h
index 21e786b4b2d8f9725e0c259aa2d7b6a14dfad9f5..fec413c6a20003b69ea8a7ffcfa1b07118c6f579 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: s_linetemp.h,v 1.11 2002/01/16 20:15:01 brianp Exp $ */
+/* $Id: s_linetemp.h,v 1.13 2002/03/19 15:22:50 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  4.1
  *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2002  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"),
  * Optionally, one may provide one-time setup code
  *    SETUP_CODE    - code which is to be executed once per line
  *
- * To enable line stippling define STIPPLE = 1
- * To enable wide lines define WIDE = 1
- *
- * To actually "plot" each pixel either the PLOT macro or
- * (XMAJOR_PLOT and YMAJOR_PLOT macros) must be defined...
+ * To actually "plot" each pixel the PLOT macro must be defined...
  *    PLOT(X,Y) - code to plot a pixel.  Example:
  *                if (Z < *zPtr) {
  *                   *zPtr = Z;
    PIXEL_TYPE *pixelPtr;
    GLint pixelXstep, pixelYstep;
 #endif
-#ifdef STIPPLE
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
-#endif
-#ifdef WIDE
-   /* for wide lines, draw all X in [x+min, x+max] or Y in [y+min, y+max] */
-   GLint width, min, max;
-   width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
-   min = (width-1) / -2;
-   max = min + width - 1;
-#endif
 #ifdef INTERP_TEX
    {
       tex[0]  = invw0 * vert0->texcoord[0][0];
       ystep = -1;
 #endif
 #if defined(INTERP_Z) && defined(DEPTH_TYPE)
-      zPtrYstep = -ctx->DrawBuffer->Width * ((GLint)sizeof(DEPTH_TYPE));
+      zPtrYstep = -((GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE)));
 #endif
 #ifdef PIXEL_ADDRESS
       pixelYstep = BYTES_PER_ROW;
       ystep = 1;
 #endif
 #if defined(INTERP_Z) && defined(DEPTH_TYPE)
-      zPtrYstep = ctx->DrawBuffer->Width * ((GLint)sizeof(DEPTH_TYPE));
+      zPtrYstep = (GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE));
 #endif
 #ifdef PIXEL_ADDRESS
       pixelYstep = -(BYTES_PER_ROW);
       GLint errorInc = dy+dy;
       GLint error = errorInc-dx;
       GLint errorDec = error-dx;
+#ifdef SET_XMAJOR
+      xMajor = GL_TRUE;
+#endif
 #ifdef INTERP_Z
       dz = (z1-z0) / dx;
 #endif
 #endif
 
       for (i=0;i<dx;i++) {
-#ifdef STIPPLE
-         GLushort m;
-         m = 1 << ((swrast->StippleCounter/ctx->Line.StippleFactor) & 0xf);
-         if (ctx->Line.StipplePattern & m) {
-#endif
 #ifdef INTERP_Z
             GLdepth Z = FixedToDepth(z0);
 #endif
                }
             }
 #endif
-#ifdef WIDE
-            {
-               GLint yy;
-               GLint ymin = y0 + min;
-               GLint ymax = y0 + max;
-               for (yy=ymin;yy<=ymax;yy++) {
-                  PLOT( x0, yy );
-               }
-            }
-#else
-#  ifdef XMAJOR_PLOT
-            XMAJOR_PLOT( x0, y0 );
-#  else
+
             PLOT( x0, y0 );
-#  endif
-#endif /*WIDE*/
-#ifdef STIPPLE
-        }
-       swrast->StippleCounter++;
-#endif
+
 #ifdef INTERP_XY
          x0 += xstep;
 #endif
 #endif
 
       for (i=0;i<dy;i++) {
-#ifdef STIPPLE
-         GLushort m;
-         m = 1 << ((swrast->StippleCounter/ctx->Line.StippleFactor) & 0xf);
-         if (ctx->Line.StipplePattern & m) {
-#endif
 #ifdef INTERP_Z
             GLdepth Z = FixedToDepth(z0);
 #endif
                }
             }
 #endif
-#ifdef WIDE
-            {
-               GLint xx;
-               GLint xmin = x0 + min;
-               GLint xmax = x0 + max;
-               for (xx=xmin;xx<=xmax;xx++) {
-                  PLOT( xx, y0 );
-               }
-            }
-#else
-#  ifdef YMAJOR_PLOT
-            YMAJOR_PLOT( x0, y0 );
-#  else
+
             PLOT( x0, y0 );
-#  endif
-#endif /*WIDE*/
-#ifdef STIPPLE
-        }
-       swrast->StippleCounter++;
-#endif
+
 #ifdef INTERP_XY
          y0 += ystep;
 #endif
 #undef BYTES_PER_ROW
 #undef SETUP_CODE
 #undef PLOT
-#undef XMAJOR_PLOT
-#undef YMAJOR_PLOT
 #undef CLIP_HACK
-#undef STIPPLE
-#undef WIDE
 #undef FixedToDepth
+#undef SET_XMAJOR