Get rid of _swrast_mask_rgba_array() and _swrast_mask_index_array().
[mesa.git] / src / mesa / swrast / s_buffers.c
index b9f20c05c4958e1c71669ecbd8ad097e1ba63a30..1bc198c6765ffc85dd99f7710c16512166be8516 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
+ * Version:  6.5.2
  *
- * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2006  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"),
@@ -59,12 +59,18 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
    CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]);
 
    for (i = 0; i < height; i++) {
+      struct sw_span span;
       GLchan rgba[MAX_WIDTH][4];
       GLint j;
       for (j = 0; j < width; j++) {
          COPY_CHAN4(rgba[j], clearColor);
       }
-      _swrast_mask_rgba_array( ctx, rb, width, x, y + i, rgba );
+      /* setup span struct for masking */
+      INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
+      span.x = x;
+      span.y = y + i;
+      _swrast_mask_rgba_span(ctx, rb, &span, rgba);
+      /* write masked row */
       rb->PutRow(ctx, rb, width, x, y + i, rgba, NULL);
    }
 }
@@ -87,13 +93,19 @@ clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
    ASSERT(rb->DataType == GL_UNSIGNED_INT);
 
    for (i = 0; i < height;i++) {
-      GLuint span[MAX_WIDTH];
+      struct sw_span span;
+      GLuint indexes[MAX_WIDTH];
       GLint j;
       for (j = 0; j < width;j++) {
-         span[j] = ctx->Color.ClearIndex;
+         indexes[j] = ctx->Color.ClearIndex;
       }
-      _swrast_mask_ci_array(ctx, rb, width, x, y + i, span);
-      rb->PutRow(ctx, rb, width, x, y + i, span, NULL);
+      /* setup span struct for masking */
+      INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
+      span.x = x;
+      span.y = y + i;
+      _swrast_mask_ci_span(ctx, rb, &span, indexes);
+      /* write masked row */
+      rb->PutRow(ctx, rb, width, x, y + i, indexes, NULL);
    }
 }
 
@@ -169,8 +181,8 @@ clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
 
    ASSERT(!ctx->Visual.rgbMode);
 
-   ASSERT((ctx->Color.IndexMask & ((1 << ctx->Visual.indexBits) - 1))
-          == (GLuint) ((1 << ctx->Visual.indexBits) - 1));
+   ASSERT((ctx->Color.IndexMask & ((1 << rb->IndexBits) - 1))
+          == (GLuint) ((1 << rb->IndexBits) - 1));
 
    ASSERT(rb->PutMonoRow);
 
@@ -221,7 +233,8 @@ clear_color_buffers(GLcontext *ctx)
       }
    }
    else {
-      const GLuint indexBits = (1 << ctx->Visual.indexBits) - 1;
+      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];
+      const GLuint indexBits = (1 << rb->IndexBits) - 1;
       if ((ctx->Color.IndexMask & indexBits) == indexBits) {
          masking = GL_FALSE;
       }
@@ -293,19 +306,14 @@ _swrast_Clear(GLcontext *ctx, GLbitfield mask,
          clear_color_buffers(ctx);
       }
       if (mask & BUFFER_BIT_DEPTH) {
-         struct gl_renderbuffer *rb
-            = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
-         _swrast_clear_depth_buffer(ctx, rb);
+         _swrast_clear_depth_buffer(ctx, ctx->DrawBuffer->_DepthBuffer);
       }
       if (mask & BUFFER_BIT_ACCUM) {
-         struct gl_renderbuffer *rb
-            = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer;
-         _swrast_clear_accum_buffer(ctx, rb);
+         _swrast_clear_accum_buffer(ctx,
+                       ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
       }
       if (mask & BUFFER_BIT_STENCIL) {
-         struct gl_renderbuffer *rb
-            = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
-         _swrast_clear_stencil_buffer(ctx, rb);
+         _swrast_clear_stencil_buffer(ctx, ctx->DrawBuffer->_StencilBuffer);
       }
    }