Fix typo
[mesa.git] / src / mesa / swrast / s_accum.c
index dd47e198abc08b716e2d3454e327fa0ba4f25d18..d7f7dd9e0da9f93c2dff1c815d9a4ba5b4dd5745 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: s_accum.c,v 1.3 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_accum.c,v 1.5 2001/03/03 20:33:30 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
  * Version:  3.5
  * 
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2001  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"),
@@ -30,6 +30,7 @@
 #include "mem.h"
 
 #include "s_accum.h"
+#include "s_alphabuf.h"
 #include "s_context.h"
 #include "s_masking.h"
 #include "s_span.h"
@@ -81,7 +82,7 @@ _mesa_alloc_accum_buffer( GLcontext *ctx )
    ctx->DrawBuffer->Accum = (GLaccum *) MALLOC( n );
    if (!ctx->DrawBuffer->Accum) {
       /* unable to setup accumulation buffer */
-      gl_error( ctx, GL_OUT_OF_MEMORY, "glAccum" );
+      _mesa_error( ctx, GL_OUT_OF_MEMORY, "glAccum" );
    }
 #ifdef USE_OPTIMIZED_ACCUM
    swrast->_IntegerAccumMode = GL_TRUE;
@@ -135,7 +136,7 @@ _mesa_clear_accum_buffer( GLcontext *ctx )
    GLuint buffersize;
    GLfloat acc_scale;
 
-   if (ctx->Visual.AccumRedBits==0) {
+   if (ctx->Visual.accumRedBits==0) {
       /* No accumulation buffer! */
       return;
    }
@@ -331,7 +332,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
             for (j = 0; j < height; j++) {
                
                GLuint i, i4;
-               gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+               _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
                for (i = i4 = 0; i < width; i++, i4+=4) {
                   acc[i4+0] += rgba[i][RCOMP];
                   acc[i4+1] += rgba[i][GCOMP];
@@ -352,7 +353,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
             for (j=0;j<height;j++) {
                GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4;
                GLuint i;
-               gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+               _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
                for (i=0;i<width;i++) {
                   *acc += (GLaccum) ( (GLfloat) rgba[i][RCOMP] * rscale );  acc++;
                   *acc += (GLaccum) ( (GLfloat) rgba[i][GCOMP] * gscale );  acc++;
@@ -395,7 +396,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
             assert(swrast->_IntegerAccumScaler <= 1.0);
             for (j = 0; j < height; j++) {
                GLuint i, i4;
-               gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+               _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
                for (i = i4 = 0; i < width; i++, i4 += 4) {
                   acc[i4+0] = rgba[i][RCOMP];
                   acc[i4+1] = rgba[i][GCOMP];
@@ -416,7 +417,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
             GLuint i, j;
             for (j = 0; j < height; j++) {
                GLaccum *acc = ctx->DrawBuffer->Accum + ypos * width4 + xpos * 4;
-               gl_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
+               _mesa_read_rgba_span(ctx, ctx->DrawBuffer, width, xpos, ypos, rgba);
                for (i=0;i<width;i++) {
                   *acc++ = (GLaccum) ((GLfloat) rgba[i][RCOMP] * rscale + d);
                   *acc++ = (GLaccum) ((GLfloat) rgba[i][GCOMP] * gscale + d);
@@ -472,6 +473,11 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
                }
                (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, 
                                              (const GLchan (*)[4])rgba, NULL );
+               if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
+                   && ctx->Color.ColorMask[ACOMP]) {
+                  _mesa_write_alpha_span(ctx, width, xpos, ypos,
+                                         (CONST GLubyte (*)[4]) rgba, NULL);
+               }
                ypos++;
             }
          }
@@ -499,6 +505,11 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
                }
                (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, 
                                              (const GLchan (*)[4])rgba, NULL );
+               if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
+                   && ctx->Color.ColorMask[ACOMP]) {
+                  _mesa_write_alpha_span(ctx, width, xpos, ypos,
+                                         (CONST GLubyte (*)[4]) rgba, NULL);
+               }
                ypos++;
             }
         }
@@ -506,6 +517,6 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value,
         break;
 
       default:
-         gl_error( ctx, GL_INVALID_ENUM, "glAccum" );
+         _mesa_error( ctx, GL_INVALID_ENUM, "glAccum" );
    }
 }