Consolidate texObj->Pos/Neg/X/Y/Z and texObj->Image into a single
[mesa.git] / src / mesa / swrast / s_drawpix.c
index bc791b90784252a398b2906ebd168d9fc481ce97..5d4093f32c003fb93b93119e5e444720d4778f70 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id: s_drawpix.c,v 1.47 2003/03/25 02:23:45 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
  * Version:  5.1
@@ -111,11 +109,11 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
       _swrast_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
       _swrast_span_default_fog(ctx, &span);
-   if (ctx->Texture._EnabledUnits)
+   if (ctx->Texture._EnabledCoordUnits)
       _swrast_span_default_texcoords(ctx, &span);
 
    if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0
-       && ctx->Texture._EnabledUnits == 0
+       && ctx->Texture._EnabledCoordUnits == 0
        && unpack->Alignment == 1
        && !unpack->SwapBytes
        && !unpack->LsbFirst) {
@@ -127,7 +125,6 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
       GLint skipPixels = unpack->SkipPixels;
       GLint skipRows = unpack->SkipRows;
       GLint rowLength;
-      GLdepth zSpan[MAX_WIDTH];  /* only used when zooming */
       GLint zoomY0 = 0;
 
       if (unpack->RowLength > 0)
@@ -187,13 +184,8 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
             return GL_TRUE;
       }
       else {
-         /* setup array of fragment Z value to pass to zoom function */
-         GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMaxF);
-         GLint i;
          if (drawWidth > MAX_WIDTH)
             return GL_FALSE; /* fall back to general case path */
-         for (i=0; i<drawWidth; i++)
-            zSpan[i] = z;
 
          /* save Y value of first row */
          zoomY0 = IROUND(ctx->Current.RasterPos[1]);
@@ -629,7 +621,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
                    GLenum type, const GLvoid *pixels )
 {
    const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0;
-   const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
+   const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
    const GLint desty = y;
    struct sw_span span;
 
@@ -650,7 +642,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
 
    if (ctx->Fog.Enabled)
       _swrast_span_default_fog(ctx, &span);
-   if (ctx->Texture._EnabledUnits)
+   if (ctx->Texture._EnabledCoordUnits)
       _swrast_span_default_texcoords(ctx, &span);
 
    if (type == GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16
@@ -722,20 +714,14 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
                   span.array->z[i] = (GLdepth) (floatSpan[i] * zs + 0.5F);
                }
             }
-            if (ctx->Visual.rgbMode) {
-               if (zoom) {
-                  _swrast_write_zoomed_rgba_span(ctx, &span,
-                                     (const GLchan (*)[4]) span.array->rgba,
-                                     desty, skipPixels);
-               }
-               else
-                  _swrast_write_rgba_span(ctx, &span);
+            if (zoom) {
+               _swrast_write_zoomed_depth_span(ctx, &span, desty, skipPixels);
+            }
+            else if (ctx->Visual.rgbMode) {
+               _swrast_write_rgba_span(ctx, &span);
             }
             else {
-               if (zoom)
-                  _swrast_write_zoomed_index_span(ctx, &span, desty, 0);
-               else
-                  _swrast_write_index_span(ctx, &span);
+               _swrast_write_index_span(ctx, &span);
             }
          }
          skipPixels += spanEnd;
@@ -777,7 +763,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
       _swrast_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
       _swrast_span_default_fog(ctx, &span);
-   if (ctx->Texture._EnabledUnits)
+   if (ctx->Texture._EnabledCoordUnits)
       _swrast_span_default_texcoords(ctx, &span);
 
    if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0